code_text
stringlengths
604
999k
repo_name
stringlengths
4
100
file_path
stringlengths
4
873
language
stringclasses
23 values
license
stringclasses
15 values
size
int32
1.02k
999k
"use strict";angular.module("ngLocale",[],["$provide",function(a){var e={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};a.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:["bazar","bazar ertəsi","çərşənbə axşamı","çərşənbə","cümə axşamı","cümə","şənbə"],ERANAMES:["eramızdan əvvəl","bizim eramızın"],ERAS:["e.ə.","b.e."],FIRSTDAYOFWEEK:0,MONTH:["yanvar","fevral","mart","aprel","may","iyun","iyul","avqust","sentyabr","oktyabr","noyabr","dekabr"],SHORTDAY:["B.","B.E.","Ç.A.","Ç.","C.A.","C.","Ş."],SHORTMONTH:["yan","fev","mar","apr","may","iyn","iyl","avq","sen","okt","noy","dek"],STANDALONEMONTH:["Yanvar","Fevral","Mart","Aprel","May","İyun","İyul","Avqust","Sentyabr","Oktyabr","Noyabr","Dekabr"],WEEKENDRANGE:[5,6],fullDate:"d MMMM y, EEEE",longDate:"d MMMM y",medium:"d MMM y HH:mm:ss",mediumDate:"d MMM y",mediumTime:"HH:mm:ss","short":"dd.MM.yy HH:mm",shortDate:"dd.MM.yy",shortTime:"HH:mm"},NUMBER_FORMATS:{CURRENCY_SYM:"man.",DECIMAL_SEP:",",GROUP_SEP:".",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-¤ ",negSuf:"",posPre:"¤ ",posSuf:""}]},id:"az-latn",localeID:"az_Latn",pluralCat:function(a,r){return 1==a?e.ONE:e.OTHER}})}]); //# sourceMappingURL=angular-locale_az-latn.min.js.map
keicheng/cdnjs
ajax/libs/angular-i18n/1.5.7/angular-locale_az-latn.min.js
JavaScript
mit
1,372
Prism.languages.fortran={"quoted-number":{pattern:/[BOZ](['"])[A-F0-9]+\1/i,alias:"number"},string:{pattern:/(?:\w+_)?(['"])(?:\1\1|&(?:\r\n?|\n)(?:\s*!.+(?:\r\n?|\n))?|(?!\1).)*(?:\1|&)/,inside:{comment:{pattern:/(&(?:\r\n?|\n)\s*)!.*/,lookbehind:!0}}},comment:/!.*/,"boolean":/\.(?:TRUE|FALSE)\.(?:_\w+)?/i,number:/(?:\b|[+-])(?:\d+(?:\.\d*)?|\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i,keyword:[/\b(?:INTEGER|REAL|DOUBLE ?PRECISION|COMPLEX|CHARACTER|LOGICAL)\b/i,/\b(?:END ?)?(?:BLOCK ?DATA|DO|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE(?! PROCEDURE)|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE)\b/i,/\b(?:ALLOCATABLE|ALLOCATE|BACKSPACE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DIMENSION|DO|END|EQUIVALENCE|EXIT|EXTERNAL|FORMAT|GO ?TO|IMPLICIT(?: NONE)?|INQUIRE|INTENT|INTRINSIC|MODULE PROCEDURE|NAMELIST|NULLIFY|OPEN|OPTIONAL|PARAMETER|POINTER|PRINT|PRIVATE|PUBLIC|READ|RETURN|REWIND|SAVE|SELECT|STOP|TARGET|WHILE|WRITE)\b/i,/\b(?:ASSIGNMENT|DEFAULT|ELEMENTAL|ELSE|ELSEWHERE|ELSEIF|ENTRY|IN|INCLUDE|INOUT|KIND|NULL|ONLY|OPERATOR|OUT|PURE|RECURSIVE|RESULT|SEQUENCE|STAT|THEN|USE)\b/i],operator:[/\*\*|\/\/|=>|[=\/]=|[<>]=?|::|[+\-*=%]|\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV)\.|\.[A-Z]+\./i,{pattern:/(^|(?!\().)\/(?!\))/,lookbehind:!0}],punctuation:/\(\/|\/\)|[(),;:&]/};
Amomo/cdnjs
ajax/libs/prism/1.6.0/components/prism-fortran.min.js
JavaScript
mit
1,282
/******************\ * * * Comment Header * * * \******************/ /* Comment */ /* * Comment Test * * - cloudhead (http://cloudhead.net) * */ /* Colors * ------ * #EDF8FC (background blue) * #166C89 (darkest blue) * * Text: * #333 (standard text) // A comment within a comment! * #1F9EC9 (standard link) * */ /* @group Variables ------------------- */ #comments, .comments { /**/ color: red; /* A C-style comment */ /* A C-style comment */ background-color: orange; font-size: 12px; /* lost comment */ content: "content"; border: 1px solid black; padding: 0; margin: 2em; } /* commented out #more-comments { color: grey; } */ .selector, .lots, .comments { color: grey, /* blue */ orange; -webkit-border-radius: 2px /* webkit only */; -moz-border-radius: 8px /* moz only with operation */; } .test { color: 1px; } .sr-only-focusable { clip: auto; } @-webkit-keyframes hover { /* and Chrome */ 0% { color: red; } } #last { color: blue; } /* */ /* { */ /* */ /* */ /* */ #div { color: #A33; } /* } */ /*by block */ #output-block { comment: /* // Not commented out // */; } /*comment on last line*/
anshul313/chibleetestbackend
node_modules/grunt-contrib-less/node_modules/less/test/css/comments.css
CSS
mit
1,222
/** * @license AngularJS v1.3.0-build.2711+sha.facd904 * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ (function(window, angular, undefined) {'use strict'; var $sanitizeMinErr = angular.$$minErr('$sanitize'); /** * @ngdoc module * @name ngSanitize * @description * * # ngSanitize * * The `ngSanitize` module provides functionality to sanitize HTML. * * * <div doc-module-components="ngSanitize"></div> * * See {@link ngSanitize.$sanitize `$sanitize`} for usage. */ /* * HTML Parser By Misko Hevery (misko@hevery.com) * based on: HTML Parser By John Resig (ejohn.org) * Original code by Erik Arvidsson, Mozilla Public License * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js * * // Use like so: * htmlParser(htmlString, { * start: function(tag, attrs, unary) {}, * end: function(tag) {}, * chars: function(text) {}, * comment: function(text) {} * }); * */ /** * @ngdoc service * @name $sanitize * @function * * @description * The input is sanitized by parsing the html into tokens. All safe tokens (from a whitelist) are * then serialized back to properly escaped html string. This means that no unsafe input can make * it into the returned string, however, since our parser is more strict than a typical browser * parser, it's possible that some obscure input, which would be recognized as valid HTML by a * browser, won't make it through the sanitizer. * The whitelist is configured using the functions `aHrefSanitizationWhitelist` and * `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider `$compileProvider`}. * * @param {string} html Html input. * @returns {string} Sanitized html. * * @example <example module="ngSanitize" deps="angular-sanitize.js"> <file name="index.html"> <script> function Ctrl($scope, $sce) { $scope.snippet = '<p style="color:blue">an html\n' + '<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' + 'snippet</p>'; $scope.deliberatelyTrustDangerousSnippet = function() { return $sce.trustAsHtml($scope.snippet); }; } </script> <div ng-controller="Ctrl"> Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea> <table> <tr> <td>Directive</td> <td>How</td> <td>Source</td> <td>Rendered</td> </tr> <tr id="bind-html-with-sanitize"> <td>ng-bind-html</td> <td>Automatically uses $sanitize</td> <td><pre>&lt;div ng-bind-html="snippet"&gt;<br/>&lt;/div&gt;</pre></td> <td><div ng-bind-html="snippet"></div></td> </tr> <tr id="bind-html-with-trust"> <td>ng-bind-html</td> <td>Bypass $sanitize by explicitly trusting the dangerous value</td> <td> <pre>&lt;div ng-bind-html="deliberatelyTrustDangerousSnippet()"&gt; &lt;/div&gt;</pre> </td> <td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td> </tr> <tr id="bind-default"> <td>ng-bind</td> <td>Automatically escapes</td> <td><pre>&lt;div ng-bind="snippet"&gt;<br/>&lt;/div&gt;</pre></td> <td><div ng-bind="snippet"></div></td> </tr> </table> </div> </file> <file name="protractor.js" type="protractor"> it('should sanitize the html snippet by default', function() { expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()). toBe('<p>an html\n<em>click here</em>\nsnippet</p>'); }); it('should inline raw snippet if bound to a trusted value', function() { expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()). toBe("<p style=\"color:blue\">an html\n" + "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" + "snippet</p>"); }); it('should escape snippet without any filter', function() { expect(element(by.css('#bind-default div')).getInnerHtml()). toBe("&lt;p style=\"color:blue\"&gt;an html\n" + "&lt;em onmouseover=\"this.textContent='PWN3D!'\"&gt;click here&lt;/em&gt;\n" + "snippet&lt;/p&gt;"); }); it('should update', function() { element(by.model('snippet')).clear(); element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>'); expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()). toBe('new <b>text</b>'); expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe( 'new <b onclick="alert(1)">text</b>'); expect(element(by.css('#bind-default div')).getInnerHtml()).toBe( "new &lt;b onclick=\"alert(1)\"&gt;text&lt;/b&gt;"); }); </file> </example> */ function $SanitizeProvider() { this.$get = ['$$sanitizeUri', function($$sanitizeUri) { return function(html) { var buf = []; htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) { return !/^unsafe/.test($$sanitizeUri(uri, isImage)); })); return buf.join(''); }; }]; } function sanitizeText(chars) { var buf = []; var writer = htmlSanitizeWriter(buf, angular.noop); writer.chars(chars); return buf.join(''); } // Regular Expressions for parsing tags and attributes var START_TAG_REGEXP = /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/, END_TAG_REGEXP = /^<\s*\/\s*([\w:-]+)[^>]*>/, ATTR_REGEXP = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g, BEGIN_TAG_REGEXP = /^</, BEGING_END_TAGE_REGEXP = /^<\s*\//, COMMENT_REGEXP = /<!--(.*?)-->/g, DOCTYPE_REGEXP = /<!DOCTYPE([^>]*?)>/i, CDATA_REGEXP = /<!\[CDATA\[(.*?)]]>/g, SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, // Match everything outside of normal chars and " (quote character) NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g; // Good source of info about elements and attributes // http://dev.w3.org/html5/spec/Overview.html#semantics // http://simon.html5.org/html-elements // Safe Void Elements - HTML5 // http://dev.w3.org/html5/spec/Overview.html#void-elements var voidElements = makeMap("area,br,col,hr,img,wbr"); // Elements that you can, intentionally, leave open (and which close themselves) // http://dev.w3.org/html5/spec/Overview.html#optional-tags var optionalEndTagBlockElements = makeMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"), optionalEndTagInlineElements = makeMap("rp,rt"), optionalEndTagElements = angular.extend({}, optionalEndTagInlineElements, optionalEndTagBlockElements); // Safe Block Elements - HTML5 var blockElements = angular.extend({}, optionalEndTagBlockElements, makeMap("address,article," + "aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," + "h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")); // Inline Elements - HTML5 var inlineElements = angular.extend({}, optionalEndTagInlineElements, makeMap("a,abbr,acronym,b," + "bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," + "samp,small,span,strike,strong,sub,sup,time,tt,u,var")); // Special Elements (can contain anything) var specialElements = makeMap("script,style"); var validElements = angular.extend({}, voidElements, blockElements, inlineElements, optionalEndTagElements); //Attributes that have href and hence need to be sanitized var uriAttrs = makeMap("background,cite,href,longdesc,src,usemap"); var validAttrs = angular.extend({}, uriAttrs, makeMap( 'abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,'+ 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,'+ 'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,'+ 'scope,scrolling,shape,size,span,start,summary,target,title,type,'+ 'valign,value,vspace,width')); function makeMap(str) { var obj = {}, items = str.split(','), i; for (i = 0; i < items.length; i++) obj[items[i]] = true; return obj; } /** * @example * htmlParser(htmlString, { * start: function(tag, attrs, unary) {}, * end: function(tag) {}, * chars: function(text) {}, * comment: function(text) {} * }); * * @param {string} html string * @param {object} handler */ function htmlParser( html, handler ) { var index, chars, match, stack = [], last = html; stack.last = function() { return stack[ stack.length - 1 ]; }; while ( html ) { chars = true; // Make sure we're not in a script or style element if ( !stack.last() || !specialElements[ stack.last() ] ) { // Comment if ( html.indexOf("<!--") === 0 ) { // comments containing -- are not allowed unless they terminate the comment index = html.indexOf("--", 4); if ( index >= 0 && html.lastIndexOf("-->", index) === index) { if (handler.comment) handler.comment( html.substring( 4, index ) ); html = html.substring( index + 3 ); chars = false; } // DOCTYPE } else if ( DOCTYPE_REGEXP.test(html) ) { match = html.match( DOCTYPE_REGEXP ); if ( match ) { html = html.replace( match[0], ''); chars = false; } // end tag } else if ( BEGING_END_TAGE_REGEXP.test(html) ) { match = html.match( END_TAG_REGEXP ); if ( match ) { html = html.substring( match[0].length ); match[0].replace( END_TAG_REGEXP, parseEndTag ); chars = false; } // start tag } else if ( BEGIN_TAG_REGEXP.test(html) ) { match = html.match( START_TAG_REGEXP ); if ( match ) { html = html.substring( match[0].length ); match[0].replace( START_TAG_REGEXP, parseStartTag ); chars = false; } } if ( chars ) { index = html.indexOf("<"); var text = index < 0 ? html : html.substring( 0, index ); html = index < 0 ? "" : html.substring( index ); if (handler.chars) handler.chars( decodeEntities(text) ); } } else { html = html.replace(new RegExp("(.*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'), function(all, text){ text = text.replace(COMMENT_REGEXP, "$1").replace(CDATA_REGEXP, "$1"); if (handler.chars) handler.chars( decodeEntities(text) ); return ""; }); parseEndTag( "", stack.last() ); } if ( html == last ) { throw $sanitizeMinErr('badparse', "The sanitizer was unable to parse the following block " + "of html: {0}", html); } last = html; } // Clean up any remaining tags parseEndTag(); function parseStartTag( tag, tagName, rest, unary ) { tagName = angular.lowercase(tagName); if ( blockElements[ tagName ] ) { while ( stack.last() && inlineElements[ stack.last() ] ) { parseEndTag( "", stack.last() ); } } if ( optionalEndTagElements[ tagName ] && stack.last() == tagName ) { parseEndTag( "", tagName ); } unary = voidElements[ tagName ] || !!unary; if ( !unary ) stack.push( tagName ); var attrs = {}; rest.replace(ATTR_REGEXP, function(match, name, doubleQuotedValue, singleQuotedValue, unquotedValue) { var value = doubleQuotedValue || singleQuotedValue || unquotedValue || ''; attrs[name] = decodeEntities(value); }); if (handler.start) handler.start( tagName, attrs, unary ); } function parseEndTag( tag, tagName ) { var pos = 0, i; tagName = angular.lowercase(tagName); if ( tagName ) // Find the closest opened tag of the same type for ( pos = stack.length - 1; pos >= 0; pos-- ) if ( stack[ pos ] == tagName ) break; if ( pos >= 0 ) { // Close all the open elements, up the stack for ( i = stack.length - 1; i >= pos; i-- ) if (handler.end) handler.end( stack[ i ] ); // Remove the open elements from the stack stack.length = pos; } } } var hiddenPre=document.createElement("pre"); var spaceRe = /^(\s*)([\s\S]*?)(\s*)$/; /** * decodes all entities into regular string * @param value * @returns {string} A string with decoded entities. */ function decodeEntities(value) { if (!value) { return ''; } // Note: IE8 does not preserve spaces at the start/end of innerHTML // so we must capture them and reattach them afterward var parts = spaceRe.exec(value); var spaceBefore = parts[1]; var spaceAfter = parts[3]; var content = parts[2]; if (content) { hiddenPre.innerHTML=content.replace(/</g,"&lt;"); // innerText depends on styling as it doesn't display hidden elements. // Therefore, it's better to use textContent not to cause unnecessary // reflows. However, IE<9 don't support textContent so the innerText // fallback is necessary. content = 'textContent' in hiddenPre ? hiddenPre.textContent : hiddenPre.innerText; } return spaceBefore + content + spaceAfter; } /** * Escapes all potentially dangerous characters, so that the * resulting string can be safely inserted into attribute or * element text. * @param value * @returns {string} escaped text */ function encodeEntities(value) { return value. replace(/&/g, '&amp;'). replace(SURROGATE_PAIR_REGEXP, function (value) { var hi = value.charCodeAt(0); var low = value.charCodeAt(1); return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';'; }). replace(NON_ALPHANUMERIC_REGEXP, function(value){ // unsafe chars are: \u0000-\u001f \u007f-\u009f \u00ad \u0600-\u0604 \u070f \u17b4 \u17b5 \u200c-\u200f \u2028-\u202f \u2060-\u206f \ufeff \ufff0-\uffff from jslint.com/lint.html // decimal values are: 0-31, 127-159, 173, 1536-1540, 1807, 6068, 6069, 8204-8207, 8232-8239, 8288-8303, 65279, 65520-65535 var c = value.charCodeAt(0); // if unsafe character encode if(c <= 159 || c == 173 || (c >= 1536 && c <= 1540) || c == 1807 || c == 6068 || c == 6069 || (c >= 8204 && c <= 8207) || (c >= 8232 && c <= 8239) || (c >= 8288 && c <= 8303) || c == 65279 || (c >= 65520 && c <= 65535)) return '&#' + c + ';'; return value; // avoids multilingual issues }). replace(/</g, '&lt;'). replace(/>/g, '&gt;'); } var trim = (function() { // native trim is way faster: http://jsperf.com/angular-trim-test // but IE doesn't have it... :-( // TODO: we should move this into IE/ES5 polyfill if (!String.prototype.trim) { return function(value) { return angular.isString(value) ? value.replace(/^\s\s*/, '').replace(/\s\s*$/, '') : value; }; } return function(value) { return angular.isString(value) ? value.trim() : value; }; })(); // Custom logic for accepting certain style options only - textAngular // Currently allows only the color, background-color, text-align, float, width and height attributes // all other attributes should be easily done through classes. function validStyles(styleAttr){ var result = ''; var styleArray = styleAttr.split(';'); angular.forEach(styleArray, function(value){ var v = value.split(':'); if(v.length == 2){ var key = trim(angular.lowercase(v[0])); var value = trim(angular.lowercase(v[1])); if( (key === 'color' || key === 'background-color') && ( value.match(/^rgb\([0-9%,\. ]*\)$/i) || value.match(/^rgba\([0-9%,\. ]*\)$/i) || value.match(/^hsl\([0-9%,\. ]*\)$/i) || value.match(/^hsla\([0-9%,\. ]*\)$/i) || value.match(/^#[0-9a-f]{3,6}$/i) || value.match(/^[a-z]*$/i) ) || key === 'text-align' && ( value === 'left' || value === 'right' || value === 'center' || value === 'justify' ) || key === 'float' && ( value === 'left' || value === 'right' || value === 'none' ) || (key === 'width' || key === 'height') && ( value.match(/[0-9\.]*(px|em|rem|%)/) ) ) result += key + ': ' + value + ';'; } }); return result; } // this function is used to manually allow specific attributes on specific tags with certain prerequisites function validCustomTag(tag, attrs, lkey, value){ // catch the div placeholder for the iframe replacement if (tag === 'img' && attrs['ta-insert-video']){ if(lkey === 'ta-insert-video' || lkey === 'allowfullscreen' || lkey === 'frameborder' || (lkey === 'contenteditble' && value === 'false')) return true; } return false; } /** * create an HTML/XML writer which writes to buffer * @param {Array} buf use buf.jain('') to get out sanitized html string * @returns {object} in the form of { * start: function(tag, attrs, unary) {}, * end: function(tag) {}, * chars: function(text) {}, * comment: function(text) {} * } */ function htmlSanitizeWriter(buf, uriValidator){ var ignore = false; var out = angular.bind(buf, buf.push); return { start: function(tag, attrs, unary){ tag = angular.lowercase(tag); if (!ignore && specialElements[tag]) { ignore = tag; } if (!ignore && validElements[tag] === true) { out('<'); out(tag); angular.forEach(attrs, function(value, key){ var lkey=angular.lowercase(key); var isImage=(tag === 'img' && lkey === 'src') || (lkey === 'background'); if ((lkey === 'style' && (value = validStyles(value)) !== '') || validCustomTag(tag, attrs, lkey, value) || validAttrs[lkey] === true && (uriAttrs[lkey] !== true || uriValidator(value, isImage))) { out(' '); out(key); out('="'); out(encodeEntities(value)); out('"'); } }); out(unary ? '/>' : '>'); } }, end: function(tag){ tag = angular.lowercase(tag); if (!ignore && validElements[tag] === true) { out('</'); out(tag); out('>'); } if (tag == ignore) { ignore = false; } }, chars: function(chars){ if (!ignore) { out(encodeEntities(chars)); } } }; } // define ngSanitize module and register $sanitize service angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider); /* global sanitizeText: false */ /** * @ngdoc filter * @name linky * @function * * @description * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and * plain email address links. * * Requires the {@link ngSanitize `ngSanitize`} module to be installed. * * @param {string} text Input text. * @param {string} target Window (_blank|_self|_parent|_top) or named frame to open links in. * @returns {string} Html-linkified text. * * @usage <span ng-bind-html="linky_expression | linky"></span> * * @example <example module="ngSanitize" deps="angular-sanitize.js"> <file name="index.html"> <script> function Ctrl($scope) { $scope.snippet = 'Pretty text with some links:\n'+ 'http://angularjs.org/,\n'+ 'mailto:us@somewhere.org,\n'+ 'another@somewhere.org,\n'+ 'and one more: ftp://127.0.0.1/.'; $scope.snippetWithTarget = 'http://angularjs.org/'; } </script> <div ng-controller="Ctrl"> Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea> <table> <tr> <td>Filter</td> <td>Source</td> <td>Rendered</td> </tr> <tr id="linky-filter"> <td>linky filter</td> <td> <pre>&lt;div ng-bind-html="snippet | linky"&gt;<br>&lt;/div&gt;</pre> </td> <td> <div ng-bind-html="snippet | linky"></div> </td> </tr> <tr id="linky-target"> <td>linky target</td> <td> <pre>&lt;div ng-bind-html="snippetWithTarget | linky:'_blank'"&gt;<br>&lt;/div&gt;</pre> </td> <td> <div ng-bind-html="snippetWithTarget | linky:'_blank'"></div> </td> </tr> <tr id="escaped-html"> <td>no filter</td> <td><pre>&lt;div ng-bind="snippet"&gt;<br>&lt;/div&gt;</pre></td> <td><div ng-bind="snippet"></div></td> </tr> </table> </file> <file name="protractor.js" type="protractor"> it('should linkify the snippet with urls', function() { expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()). toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' + 'another@somewhere.org, and one more: ftp://127.0.0.1/.'); expect(element.all(by.css('#linky-filter a')).count()).toEqual(4); }); it('should not linkify snippet without the linky filter', function() { expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()). toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' + 'another@somewhere.org, and one more: ftp://127.0.0.1/.'); expect(element.all(by.css('#escaped-html a')).count()).toEqual(0); }); it('should update', function() { element(by.model('snippet')).clear(); element(by.model('snippet')).sendKeys('new http://link.'); expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()). toBe('new http://link.'); expect(element.all(by.css('#linky-filter a')).count()).toEqual(1); expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()) .toBe('new http://link.'); }); it('should work with the target property', function() { expect(element(by.id('linky-target')). element(by.binding("snippetWithTarget | linky:'_blank'")).getText()). toBe('http://angularjs.org/'); expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank'); }); </file> </example> */ angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) { var LINKY_URL_REGEXP = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/, MAILTO_REGEXP = /^mailto:/; return function(text, target) { if (!text) return text; var match; var raw = text; var html = []; var url; var i; while ((match = raw.match(LINKY_URL_REGEXP))) { // We can not end in these as they are sometimes found at the end of the sentence url = match[0]; // if we did not match ftp/http/mailto then assume mailto if (match[2] == match[3]) url = 'mailto:' + url; i = match.index; addText(raw.substr(0, i)); addLink(url, match[0].replace(MAILTO_REGEXP, '')); raw = raw.substring(i + match[0].length); } addText(raw); return $sanitize(html.join('')); function addText(text) { if (!text) { return; } html.push(sanitizeText(text)); } function addLink(url, text) { html.push('<a '); if (angular.isDefined(target)) { html.push('target="'); html.push(target); html.push('" '); } html.push('href="'); html.push(url); html.push('">'); addText(text); html.push('</a>'); } }; }]); })(window, window.angular);
sujonvidia/cdnjs
ajax/libs/textAngular/1.3.0-pre2/src/textAngular-sanitize.js
JavaScript
mit
24,051
/*! jQuery UI - v1.11.2 - 2014-10-16 * http://jqueryui.com * Includes: core.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, draggable.css, menu.css, progressbar.css, resizable.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS%2CTahoma%2CVerdana%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=gloss_wave&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=highlight_soft&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=glass&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=glass&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=highlight_soft&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=diagonals_thick&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=diagonals_thick&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=flat&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;min-height:0;font-size:100%}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-dialog{overflow:hidden;position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:none}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{position:relative;margin:0;padding:3px 1em 3px .4em;cursor:pointer;min-height:0;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-button{display:inline-block;overflow:hidden;position:relative;text-decoration:none;cursor:pointer}.ui-selectmenu-button span.ui-icon{right:0.5em;left:auto;margin-top:-8px;position:absolute;top:50%}.ui-selectmenu-button span.ui-selectmenu-text{text-align:left;padding:0.4em 2.1em 0.4em 1em;display:block;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Trebuchet MS,Tahoma,Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Trebuchet MS,Tahoma,Verdana,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #ddd;background:#eee url("images/ui-bg_highlight-soft_100_eeeeee_1x100.png") 50% top repeat-x;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #e78f08;background:#f6a828 url("images/ui-bg_gloss-wave_35_f6a828_500x100.png") 50% 50% repeat-x;color:#fff;font-weight:bold}.ui-widget-header a{color:#fff}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #ccc;background:#f6f6f6 url("images/ui-bg_glass_100_f6f6f6_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#1c94c4}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#1c94c4;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #fbcb09;background:#fdf5ce url("images/ui-bg_glass_100_fdf5ce_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#c77405}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#c77405;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #fbd850;background:#fff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#eb8f00}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#eb8f00;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #fed22f;background:#ffe45c url("images/ui-bg_highlight-soft_75_ffe45c_1x100.png") 50% top repeat-x;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#b81900 url("images/ui-bg_diagonals-thick_18_b81900_40x40.png") 50% 50% repeat;color:#fff}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#fff}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#fff}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_222222_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_ef8c08_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url("images/ui-icons_ef8c08_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_ef8c08_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_228ef1_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_ffd27a_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:4px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:4px}.ui-widget-overlay{background:#666 url("images/ui-bg_diagonals-thick_20_666666_40x40.png") 50% 50% repeat;opacity:.5;filter:Alpha(Opacity=50)}.ui-widget-shadow{margin:-5px 0 0 -5px;padding:5px;background:#000 url("images/ui-bg_flat_10_000000_40x100.png") 50% 50% repeat-x;opacity:.2;filter:Alpha(Opacity=20);border-radius:5px}
qltf8/groupproject
jquery-ui-1.11.2/jquery-ui.min.css
CSS
mit
30,163
<?php /** * CodeIgniter * * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * * Copyright (c) 2014 - 2016, British Columbia Institute of Technology * * 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. * * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.3.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); /** * Postgre Utility Class * * @package CodeIgniter * @subpackage Drivers * @category Database * @author EllisLab Dev Team * @link https://codeigniter.com/user_guide/database/ */ class CI_DB_postgre_utility extends CI_DB_utility { /** * List databases statement * * @var string */ protected $_list_databases = 'SELECT datname FROM pg_database'; /** * OPTIMIZE TABLE statement * * @var string */ protected $_optimize_table = 'REINDEX TABLE %s'; // -------------------------------------------------------------------- /** * Export * * @param array $params Preferences * @return mixed */ protected function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsupported_feature'); } }
Tracy1994/HealthHome
system/database/drivers/postgre/postgre_utility.php
PHP
mit
2,508
YUI.add('tree-sortable', function (Y, NAME) { /*jshint expr:true, onevar:false */ /** Extension for `Tree` that makes nodes sortable. @module tree @submodule tree-sortable @main tree-sortable **/ /** Extension for `Tree` that makes nodes sortable. @class Tree.Sortable @constructor @param {Object} [config] Configuration options. @param {Function} [config.sortComparator] Default comparator function to use when sorting a node's children if the node itself doesn't have a custom comparator function. If not specified, insertion order will be used by default. @param {Boolean} [config.sortReverse=false] If `true`, node children will be sorted in reverse (descending) order by default. Otherwise they'll be sorted in ascending order. @extensionfor Tree **/ /** Fired after a node's children are re-sorted. @event sort @param {Tree.Node} node Node whose children were sorted. @param {Boolean} reverse `true` if the children were sorted in reverse (descending) order, `false` otherwise. @param {String} src Source of the event. **/ var EVT_SORT = 'sort'; function Sortable() {} Sortable.prototype = { // -- Public Properties ---------------------------------------------------- /** If `true`, node children will be sorted in reverse (descending) order by default. Otherwise they'll be sorted in ascending order. @property {Boolean} sortReverse @default false **/ sortReverse: false, // -- Lifecycle ------------------------------------------------------------ initializer: function (config) { this.nodeExtensions = this.nodeExtensions.concat(Y.Tree.Node.Sortable); if (config) { if (config.sortComparator) { this.sortComparator = config.sortComparator; } if ('sortReverse' in config) { this.sortReverse = config.sortReverse; } } }, // -- Public Methods ------------------------------------------------------- /** Sorts the children of every node in this tree. A `sort` event will be fired for each node whose children are sorted, which can get very noisy. If this is a large tree, you may want to set the `silent` option to `true` to suppress these events. @method sort @param {Object} [options] Options. @param {Boolean} [options.silent] If `true`, no `sort` events will be fired. @param {Function} [options.sortComparator] Custom comparator function to use. If specified, this will become the new comparator function for each node, overwriting any previous comparator function that was set for the node. @param {Boolean} [options.sortReverse] If `true`, children will be sorted in reverse (descending) order. Otherwise they'll be sorted in ascending order. This will become each node's new sort order, overwriting any previous sort order that was set for the node. @param {String} [options.src] Source of the sort operation. Will be passed along to the `sort` event facade. @chainable **/ sort: function (options) { return this.sortNode(this.rootNode, Y.merge(options, {deep: true})); }, /** Default comparator function to use when sorting a node's children if the node itself doesn't have a custom comparator function. If not specified, insertion order will be used by default. @method sortComparator @param {Tree.Node} node Node being sorted. @return {Number|String} Value by which the node should be sorted relative to its siblings. **/ sortComparator: function (node) { return node.index(); }, /** Sorts the children of the specified node. By default, only the node's direct children are sorted. To sort all nodes in the hierarchy (children, children's children, etc.), set the `deep` option to `true`. If this is a very deep hierarchy, you may also want to set `silent` to true to avoid generating a flood of `sort` events. @method sortNode @param {Tree.Node} node Node whose children should be sorted. @param {Object} [options] Options. @param {Boolean} [options.deep=false] If `true`, all of this node's children (and their children, and so on) will be traversed and re-sorted as well. @param {Boolean} [options.silent] If `true`, no `sort` event will be fired. @param {Function} [options.sortComparator] Custom comparator function to use. If specified, this will become the node's new comparator function, overwriting any previous comparator function that was set for the node. @param {Boolean} [options.sortReverse] If `true`, children will be sorted in reverse (descending) order. Otherwise they'll be sorted in ascending order. This will become the node's new sort order, overwriting any previous sort order that was set for the node. @param {String} [options.src] Source of the sort operation. Will be passed along to the `sort` event facade. @chainable **/ sortNode: function (node, options) { // Nothing to do if the node has no children. if (!node.children.length) { return this; } options || (options = {}); if (options.deep) { // Unset the `deep` option so we don't cause an infinite loop. options = Y.merge(options, {deep: false}); var self = this; // Traverse and sort all nodes (including this one). this.traverseNode(node, function (nodeToSort) { self.sortNode(nodeToSort, options); }); return this; } var comparator = this._getSortComparator(node, options), reverse; if ('sortReverse' in options) { reverse = node.sortReverse = options.sortReverse; } else if ('sortReverse' in node) { reverse = node.sortReverse; } else { reverse = this.sortReverse; } node.children.sort(Y.rbind(this._sort, this, comparator, reverse)); node._isIndexStale = true; if (!options.silent) { this.fire(EVT_SORT, { node : node, reverse: !!reverse, src : options.src }); } return this; }, // -- Protected Methods ---------------------------------------------------- /** Compares value _a_ to value _b_ for sorting purposes. Values are assumed to be the result of calling a sortComparator function. @method _compare @param {Mixed} a First value to compare. @param {Mixed} b Second value to compare. @return {Number} `-1` if _a_ should come before _b_, `0` if they're equivalent, `1` if _a_ should come after _b_. @protected **/ _compare: function (a, b) { return a < b ? -1 : (a > b ? 1 : 0); }, /** Compares value _a_ to value _b_ for sorting purposes, but sorts them in reverse (descending) order. Values are assumed to be the result of calling a sortComparator function. @method _compareReverse @param {Mixed} a First value to compare. @param {Mixed} b Second value to compare. @return {Number} `-1` if _a_ should come before _b_, `0` if they're equivalent, `1` if _a_ should come after _b_. @protected **/ _compareReverse: function (a, b) { return b < a ? -1 : (b > a ? 1 : 0); }, /** Overrides `Tree#_getDefaultNodeIndex()` to provide insertion-time sorting for nodes inserted without an explicit index. @method _getDefaultNodeIndex @param {Tree.Node} parent Parent node. @param {Tree.Node} node Node being inserted. @param {Object} [options] Options passed to `insertNode()`. @return {Number} Index at which _node_ should be inserted into _parent_'s `children` array. @protected **/ _getDefaultNodeIndex: function (parent, node) { /*jshint bitwise:false */ var children = parent.children, comparator = this._getSortComparator(parent), max = children.length, min = 0, reverse = 'sortReverse' in parent ? parent.sortReverse : this.sortReverse; if (!max) { return max; } // Special case: if the sortComparator is the default sortComparator, // cheat and just return the first or last index of the children array. // // This is necessary because the default sortComparator relies on // the node's index, which is always -1 for uninserted nodes. if (comparator._unboundComparator === Sortable.prototype.sortComparator) { return reverse ? 0 : max; } var compare = reverse ? this._compareReverse : this._compare, needle = comparator(node); // Perform an iterative binary search to determine the correct position // for the node based on the return value of the comparator function. var middle; while (min < max) { middle = (min + max) >> 1; // Divide by two and discard remainder. if (compare(comparator(children[middle]), needle) < 0) { min = middle + 1; } else { max = middle; } } return min; }, /** Returns a sort comparator function derived from the given _node_ and _options_, and bound to the correct `thisObj` based on where it was found. @method _getSortComparator @param {Tree.Node} node Node on which to look for a `sortComparator` function. @param {Object} [options] Options object on which to look for a `sortComparator` function. @return {Function} Properly bound sort comparator function. @protected **/ _getSortComparator: function (node, options) { var boundComparator, comparator, thisObj; if (options && options.sortComparator) { comparator = node.sortComparator = options.sortComparator; } else if (node.sortComparator) { comparator = node.sortComparator; thisObj = node; } else { comparator = this.sortComparator; thisObj = this; } boundComparator = function () { return comparator.apply(thisObj, arguments); }; boundComparator._unboundComparator = comparator; return boundComparator; }, /** Array sort function used by `sortNode()` to re-sort a node's children. @method _sort @param {Tree.Node} a First node to compare. @param {Tree.Node} b Second node to compare. @param {Function} comparator Comparator function. @param {Boolean} [reverse=false] If `true`, this will be a reverse (descending) comparison. @return {Number} `-1` if _a_ is less than _b_, `0` if equal, `1` if greater. @protected **/ _sort: function (a, b, comparator, reverse) { return this[reverse ? '_compareReverse' : '_compare']( comparator(a), comparator(b)); } }; Y.Tree.Sortable = Sortable; /** @module tree @submodule tree-sortable **/ /** `Tree.Node` extension that adds methods useful for nodes in trees that use the `Tree.Sortable` extension. @class Tree.Node.Sortable @constructor @extensionfor Tree.Node **/ function NodeSortable() {} NodeSortable.prototype = { /** Sorts this node's children. @method sort @param {Object} [options] Options. @param {Boolean} [options.silent] If `true`, no `sort` event will be fired. @param {Function} [options.sortComparator] Custom comparator function to use. If specified, this will become the node's new comparator function, overwriting any previous comparator function that was set for the node. @param {Boolean} [options.sortReverse] If `true`, children will be sorted in reverse (descending) order. Otherwise they'll be sorted in ascending order. This will become the node's new sort order, overwriting any previous sort order that was set for the node. @param {String} [options.src] Source of the sort operation. Will be passed along to the `sort` event facade. @chainable **/ sort: function (options) { this.tree.sortNode(this, options); return this; } }; Y.Tree.Node.Sortable = NodeSortable; }, '@VERSION@', {"requires": ["tree"]});
bootcdn/cdnjs
ajax/libs/yui/3.18.1/tree-sortable/tree-sortable.js
JavaScript
mit
12,727
// Web analytics by Piwik - http://piwik.org // Copyleft 2007, All rights reversed. var _pk_use_title_as_name = 0; var _pk_install_tracker = 1; var _pk_tracker_pause = 500; var _pk_download_extensions = "7z|aac|avi|csv|doc|exe|flv|gif|gz|jpe?g|js|mp(3|4|e?g)|mov|pdf|phps|png|ppt|rar|sit|tar|torrent|txt|wma|wmv|xls|xml|zip"; // Beginning script function _pk_plug_normal(_pk_pl) { if (_pk_tm.indexOf(_pk_pl) != -1 && (navigator.mimeTypes[_pk_pl].enabledPlugin != null)) return '1'; return '0'; } function _pk_plug_ie(_pk_pl) { pk_found = false; document.write('<SCR' + 'IPT LANGUAGE=VBScript>\n on error resume next \n pk_found = IsObject(CreateObject("' + _pk_pl + '")) </SCR' + 'IPT>\n'); if (pk_found) return '1'; return '0'; } var _pk_jav = '0'; if(navigator.javaEnabled()) _pk_jav='1'; var _pk_agent = navigator.userAgent.toLowerCase(); var _pk_moz = (navigator.appName.indexOf("Netscape") != -1); var _pk_ie = (_pk_agent.indexOf("msie") != -1); var _pk_win = ((_pk_agent.indexOf("win") != -1) || (_pk_agent.indexOf("32bit") != -1)); var _pk_cookie = (navigator.cookieEnabled)? '1' : '0'; if((typeof (navigator.cookieEnabled) == "undefined") && (_pk_cookie == '0')) { document.cookie="_pk_testcookie" _pk_cookie=(document.cookie.indexOf("_pk_testcookie")!=-1)? '1' : '0'; } var _pk_dir='0',_pk_fla='0',_pk_pdf='0',_pk_qt = '0',_pk_rea = '0',_pk_wma='0'; if (_pk_win && _pk_ie){ _pk_dir = _pk_plug_ie("SWCtl.SWCtl.1"); _pk_fla = _pk_plug_ie("ShockwaveFlash.ShockwaveFlash.1"); if (_pk_plug_ie("PDF.PdfCtrl.1") == '1' || _pk_plug_ie('PDF.PdfCtrl.5') == '1' || _pk_plug_ie('PDF.PdfCtrl.6') == '1') _pk_pdf = '1'; _pk_qt = _pk_plug_ie("Quicktime.Quicktime"); // Old : "QuickTimeCheckObject.QuickTimeCheck.1" _pk_rea = _pk_plug_ie("rmocx.RealPlayer G2 Control.1"); _pk_wma = _pk_plug_ie("wmplayer.ocx"); // Old : "MediaPlayer.MediaPlayer.1" } else { var _pk_tm = ''; for (var i=0; i < navigator.mimeTypes.length; i++) _pk_tm += navigator.mimeTypes[i].type.toLowerCase(); _pk_dir = _pk_plug_normal("application/x-director"); _pk_fla = _pk_plug_normal("application/x-shockwave-flash"); _pk_pdf = _pk_plug_normal("application/pdf"); _pk_qt = _pk_plug_normal("video/quicktime"); _pk_rea = _pk_plug_normal("audio/x-pn-realaudio-plugin"); _pk_wma = _pk_plug_normal("application/x-mplayer2"); } var _pk_rtu = ''; try { _pk_rtu = top.document.referrer; } catch(e1) { if(parent){ try{ _pk_rtu = parent.document.referrer; } catch(e2) { _pk_rtu=''; } } } if(_pk_rtu == '') { _pk_rtu = document.referrer; } function _pk_escape(_pk_str){ if(typeof(encodeURIComponent) == 'function') { return encodeURIComponent(_pk_str); } else { return escape(_pk_str); } } var _pk_title = ''; if (document.title && document.title!="") _pk_title = _pk_escape(document.title); var _pk_called; function _pk_getUrlLog( _pk_action_name, _pk_site, _pk_pkurl, _pk_custom_vars ) { var _pk_custom_vars_str = ''; if(typeof _pk_custom_vars == "undefined"){ _pk_custom_vars = false; } if (_pk_custom_vars) { for (var i in _pk_custom_vars){ if (!Array.prototype[i]){ _pk_custom_vars_str = _pk_custom_vars_str + '&vars['+ escape(i) + ']' + "=" + escape(_pk_custom_vars[i]); } } } var _pk_url = document.location.href; var _pk_da = new Date(); var _pk_src = _pk_pkurl +'?url='+_pk_escape(document.location.href) +'&action_name='+_pk_escape(_pk_action_name) +'&idsite='+_pk_site +'&res='+screen.width+'x'+screen.height +'&col='+screen.colorDepth +'&h='+_pk_da.getHours()+'&m='+_pk_da.getMinutes()+'&s='+_pk_da.getSeconds() +'&fla='+_pk_fla+'&dir='+_pk_dir+'&qt='+_pk_qt+'&realp='+_pk_rea+'&pdf='+_pk_pdf +'&wma='+_pk_wma+'&java='+_pk_jav+'&cookie='+_pk_cookie +'&title='+_pk_title +'&urlref='+_pk_escape(_pk_rtu) +_pk_custom_vars_str; return _pk_src; } function piwik_log( _pk_action_name, _pk_site, _pk_pkurl, _pk_custom_vars ) { if(_pk_called && (!_pk_action_name || _pk_action_name=="")) return; var _pk_src = _pk_getUrlLog(_pk_action_name, _pk_site, _pk_pkurl, _pk_custom_vars ); document.writeln('<img src="'+_pk_src+'" alt="Piwik" style="border:0" />'); if(!_pk_action_name || _pk_action_name=="") _pk_called=1; _pk_init_tracker(_pk_site, _pk_pkurl); } function _pk_add_event(elm, evType, fn, useCapture) { if (elm.addEventListener) { elm.addEventListener(evType, fn, useCapture); return true; } else if (elm.attachEvent) { var r = elm.attachEvent('on' + evType, fn); return r; } else { elm['on' + evType] = fn; } } var _pk_tracker_site, _pk_tracker_url; function _pk_init_tracker(_pk_site, _pk_pkurl) { if( typeof(piwik_install_tracker) != "undefined" ) _pk_install_tracker = piwik_install_tracker; if( typeof(piwik_tracker_pause) != "undefined" ) _pk_tracker_pause = piwik_tracker_pause; if( typeof(piwik_download_extensions) != "undefined" ) _pk_download_extensions = piwik_download_extensions; _pk_hosts_alias = ( typeof(piwik_hosts_alias) != "undefined" ? piwik_hosts_alias : new Array()) _pk_hosts_alias.push(window.location.hostname); if( !_pk_install_tracker ) return; _pk_tracker_site = _pk_site; _pk_tracker_url = _pk_pkurl; if (document.getElementsByTagName) { linksElements = document.getElementsByTagName('a') for (var i = 0; i < linksElements.length; i++) { if( linksElements[i].className != 'piwik_ignore' ) _pk_add_event(linksElements[i], 'mousedown', _pk_click, false); } } } function _pk_dummy() { return true; } function _pk_pause(_pk_time_msec) { var _pk_now = new Date(); var _pk_expire = _pk_now.getTime() + _pk_time_msec; while(_pk_now.getTime() < _pk_expire) _pk_now = new Date(); } // _pk_type only 'download' and 'link' types supported function piwik_track(url, _pk_site, _pk_url, _pk_type) { var _pk_image = new Image(); _pk_image.onLoad = function() { _pk_dummy(); }; _pk_image.src = _pk_url + '?idsite=' + _pk_site + '&' + _pk_type + '=' + escape(url) + '&rand=' + Math.random() + '&redirect=0'; _pk_pause(_pk_tracker_pause); } function _pk_is_site_hostname(_pk_hostname) { for(i = 0; i < _pk_hosts_alias.length; i++) if( _pk_hostname == _pk_hosts_alias[i] ) return true; return false; } function _pk_click(e) { var source; if (typeof e == 'undefined') var e = window.event; if (typeof e.target != 'undefined') source = e.target; else if (typeof e.srcElement != 'undefined') source = e.srcElement; else return true; while( source.tagName != "A" ) source = source.parentNode; if( typeof source.href == 'undefined' ) return true; var _pk_download = new RegExp('\\.(' + _pk_download_extensions + ')$', 'i'); var _pk_link_type; var _pk_not_site_hostname = !_pk_is_site_hostname(source.hostname); if( source.className == "piwik_download" ) _pk_link_type = 'download'; else if( source.className == "piwik_link" ) { _pk_link_type = 'link'; _pk_not_site_hostname = 1; } else _pk_link_type = (_pk_download.test(source.href) ? 'download' : 'link'); if( _pk_not_site_hostname || _pk_link_type == 'download' ) piwik_track(source.href, _pk_tracker_site, _pk_tracker_url, _pk_link_type); return true; }
rlugojr/cdnjs
ajax/libs/piwik/0.2.1/piwik.js
JavaScript
mit
7,113
<?php /* * This file is part of Psy Shell. * * (c) 2012-2015 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Psy\Command; use PhpParser\Node; use PhpParser\Parser; use Psy\ParserFactory; use Psy\VarDumper\Presenter; use Psy\VarDumper\PresenterAware; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\VarDumper\Caster\Caster; /** * Parse PHP code and show the abstract syntax tree. */ class ParseCommand extends Command implements PresenterAware { private $presenter; private $parserFactory; private $parsers; /** * {@inheritdoc} */ public function __construct($name = null) { $this->parserFactory = new ParserFactory(); $this->parsers = array(); parent::__construct($name); } /** * PresenterAware interface. * * @param Presenter $presenter */ public function setPresenter(Presenter $presenter) { $this->presenter = clone $presenter; $this->presenter->addCasters(array( 'PhpParser\Node' => function (Node $node, array $a) { $a = array( Caster::PREFIX_VIRTUAL . 'type' => $node->getType(), Caster::PREFIX_VIRTUAL . 'attributes' => $node->getAttributes(), ); foreach ($node->getSubNodeNames() as $name) { $a[Caster::PREFIX_VIRTUAL . $name] = $node->$name; } return $a; }, )); } /** * {@inheritdoc} */ protected function configure() { $definition = array( new InputArgument('code', InputArgument::REQUIRED, 'PHP code to parse.'), new InputOption('depth', '', InputOption::VALUE_REQUIRED, 'Depth to parse', 10), ); if ($this->parserFactory->hasKindsSupport()) { $msg = 'One of PhpParser\\ParserFactory constants: ' . implode(', ', ParserFactory::getPossibleKinds()) . " (default is based on current interpreter's version)"; $defaultKind = $this->parserFactory->getDefaultKind(); $definition[] = new InputOption('kind', '', InputOption::VALUE_REQUIRED, $msg, $defaultKind); } $this ->setName('parse') ->setDefinition($definition) ->setDescription('Parse PHP code and show the abstract syntax tree.') ->setHelp( <<<'HELP' Parse PHP code and show the abstract syntax tree. This command is used in the development of PsySH. Given a string of PHP code, it pretty-prints the PHP Parser parse tree. See https://github.com/nikic/PHP-Parser It prolly won't be super useful for most of you, but it's here if you want to play. HELP ); } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $code = $input->getArgument('code'); if (strpos('<?', $code) === false) { $code = '<?php ' . $code; } $parserKind = $input->getOption('kind'); $depth = $input->getOption('depth'); $nodes = $this->parse($this->getParser($parserKind), $code); $output->page($this->presenter->present($nodes, $depth)); } /** * Lex and parse a string of code into statements. * * @param Parser $parser * @param string $code * * @return array Statements */ private function parse(Parser $parser, $code) { try { return $parser->parse($code); } catch (\PhpParser\Error $e) { if (strpos($e->getMessage(), 'unexpected EOF') === false) { throw $e; } // If we got an unexpected EOF, let's try it again with a semicolon. return $parser->parse($code . ';'); } } /** * Get (or create) the Parser instance. * * @param string|null $kind One of Psy\ParserFactory constants (only for PHP parser 2.0 and above). * * @return Parser */ private function getParser($kind = null) { if (!array_key_exists($kind, $this->parsers)) { $this->parsers[$kind] = $this->parserFactory->createParser($kind); } return $this->parsers[$kind]; } }
Khairulrabbi/htmis
vendor/psy/psysh/src/Psy/Command/ParseCommand.php
PHP
mit
4,592
.hljs{display:block;overflow-x:auto;padding:.5em;background:white;color:black;-webkit-text-size-adjust:none}.hljs-comment,.hljs-template_comment,.hljs-javadoc{color:#800}.hljs-keyword,.method,.hljs-list .hljs-keyword,.nginx .hljs-title,.hljs-tag .hljs-title,.setting .hljs-value,.hljs-winutils,.tex .hljs-command,.http .hljs-title,.hljs-request,.hljs-status{color:#008}.hljs-envvar,.tex .hljs-special{color:#660}.hljs-string,.hljs-tag .hljs-value,.hljs-cdata,.hljs-filter .hljs-argument,.hljs-attr_selector,.apache .hljs-cbracket,.hljs-date,.hljs-regexp,.coffeescript .hljs-attribute{color:#080}.hljs-sub .hljs-identifier,.hljs-pi,.hljs-tag,.hljs-tag .hljs-keyword,.hljs-decorator,.ini .hljs-title,.hljs-shebang,.hljs-prompt,.hljs-hexcolor,.hljs-rules .hljs-value,.hljs-literal,.hljs-symbol,.ruby .hljs-symbol .hljs-string,.hljs-number,.css .hljs-function,.clojure .hljs-attribute{color:#066}.hljs-class .hljs-title,.smalltalk .hljs-class,.hljs-javadoctag,.hljs-yardoctag,.hljs-phpdoc,.hljs-dartdoc,.hljs-type,.hljs-typename,.hljs-tag .hljs-attribute,.hljs-doctype,.hljs-class .hljs-id,.hljs-built_in,.setting,.hljs-params,.hljs-variable{color:#606}.css .hljs-tag,.hljs-rules .hljs-property,.hljs-pseudo,.hljs-subst{color:#000}.css .hljs-class,.css .hljs-id{color:#9b703f}.hljs-value .hljs-important{color:#f70;font-weight:bold}.hljs-rules .hljs-keyword{color:#c5af75}.hljs-annotation,.apache .hljs-sqbracket,.nginx .hljs-built_in{color:#9b859d}.hljs-preprocessor,.hljs-preprocessor *,.hljs-pragma{color:#444}.tex .hljs-formula{background-color:#eee;font-style:italic}.diff .hljs-header,.hljs-chunk{color:#808080;font-weight:bold}.diff .hljs-change{background-color:#bccff9}.hljs-addition{background-color:#baeeba}.hljs-deletion{background-color:#ffc8bd}.hljs-comment .hljs-yardoctag{font-weight:bold}
hibrahimsafak/cdnjs
ajax/libs/highlight.js/8.2/styles/googlecode.min.css
CSS
mit
1,801
.hljs-comment,.hljs-title{color:#687d68}.hljs-variable,.hljs-attribute,.hljs-tag,.hljs-regexp,.ruby .hljs-constant,.xml .hljs-tag .hljs-title,.xml .hljs-pi,.xml .hljs-doctype,.html .hljs-doctype,.css .hljs-id,.css .hljs-class,.css .hljs-pseudo{color:#e6193c}.hljs-number,.hljs-preprocessor,.hljs-pragma,.hljs-built_in,.hljs-literal,.hljs-params,.hljs-constant{color:#87711d}.hljs-ruby .hljs-class .hljs-title,.css .hljs-rules .hljs-attribute{color:#c3c322}.hljs-string,.hljs-value,.hljs-inheritance,.hljs-header,.ruby .hljs-symbol,.xml .hljs-cdata{color:#29a329}.css .hljs-hexcolor{color:#1999b3}.hljs-function,.python .hljs-decorator,.python .hljs-title,.ruby .hljs-function .hljs-title,.ruby .hljs-title .hljs-keyword,.perl .hljs-sub,.javascript .hljs-title,.coffeescript .hljs-title{color:#3d62f5}.hljs-keyword,.javascript .hljs-function{color:#ad2bee}.hljs{display:block;overflow-x:auto;background:#f0fff0;color:#5e6e5e;padding:.5em;-webkit-text-size-adjust:none}.coffeescript .javascript,.javascript .xml,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:.5}
rndme/cdnjs
ajax/libs/highlight.js/8.2/styles/atelier-seaside.light.min.css
CSS
mit
1,099
var LcovOnly = require('./lcovonly'), util = require('util'); /** * a `Report` implementation that produces an LCOV coverage and prints it * to standard out. * * Usage * ----- * * var report = require('istanbul').Report.create('text-lcov'); * * @class TextLcov * @module report * @extends LcovOnly * @constructor * @param {Object} opts optional * @param {String} [opts.log] the method used to log to console. */ function TextLcov(opts) { var that = this; LcovOnly.call(this); this.opts = opts || {}; this.opts.log = this.opts.log || console.log; this.opts.writer = { println: function (ln) { that.opts.log(ln); } }; } TextLcov.TYPE = 'text-lcov'; util.inherits(TextLcov, LcovOnly); LcovOnly.super_.mix(TextLcov, { writeReport: function (collector) { var that = this, writer = this.opts.writer; collector.files().forEach(function (key) { that.writeFileCoverage(writer, collector.fileCoverageFor(key)); }); this.emit('done'); } }); module.exports = TextLcov;
zenners/angular-contacts
node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/node_modules/jstest/node_modules/karma/node_modules/grunt-conventional-changelog/node_modules/conventional-changelog/node_modules/istanbul/lib/report/text-lcov.js
JavaScript
mit
1,104
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Node; /** * Compiles a call to {@link FormRendererInterface::renderBlock()}. * * The function name is used as block name. For example, if the function name * is "foo", the block "foo" will be rendered. * * @author Bernhard Schussek <bschussek@gmail.com> */ class RenderBlockNode extends \Twig_Node_Expression_Function { public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); $arguments = iterator_to_array($this->getNode('arguments')); $compiler->write('$this->env->getExtension(\'form\')->renderer->renderBlock('); if (isset($arguments[0])) { $compiler->subcompile($arguments[0]); $compiler->raw(', \''.$this->getAttribute('name').'\''); if (isset($arguments[1])) { $compiler->raw(', '); $compiler->subcompile($arguments[1]); } } $compiler->raw(')'); } }
emmanueldd/SymfonyShop
vendor/symfony/symfony/src/Symfony/Bridge/Twig/Node/RenderBlockNode.php
PHP
mit
1,204
/* * jQuery Mobile Framework Git Build: SHA1: b49cc06499abf8f987cf90f35349cfac0918c939 <> Date: Tue Oct 2 11:22:34 2012 -0700 * http://jquerymobile.com * * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * */ (function ( root, doc, factory ) { if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. define( [ "jquery" ], function ( $ ) { factory( $, root, doc ); return $.mobile; }); } else { // Browser globals factory( root.jQuery, root, doc ); } }( this, document, function ( jQuery, window, document, undefined ) { (function( $, window, undefined ) { var nsNormalizeDict = {}; // jQuery.mobile configurable options $.mobile = $.extend( {}, { // Version of the jQuery Mobile Framework version: "1.2.0", // Namespace used framework-wide for data-attrs. Default is no namespace ns: "", // Define the url parameter used for referencing widget-generated sub-pages. // Translates to to example.html&ui-page=subpageIdentifier // hash segment before &ui-page= is used to make Ajax request subPageUrlKey: "ui-page", // Class assigned to page currently in view, and during transitions activePageClass: "ui-page-active", // Class used for "active" button state, from CSS framework activeBtnClass: "ui-btn-active", // Class used for "focus" form element state, from CSS framework focusClass: "ui-focus", // Automatically handle clicks and form submissions through Ajax, when same-domain ajaxEnabled: true, // Automatically load and show pages based on location.hash hashListeningEnabled: true, // disable to prevent jquery from bothering with links linkBindingEnabled: true, // Set default page transition - 'none' for no transitions defaultPageTransition: "fade", // Set maximum window width for transitions to apply - 'false' for no limit maxTransitionWidth: false, // Minimum scroll distance that will be remembered when returning to a page minScrollBack: 250, // DEPRECATED: the following property is no longer in use, but defined until 2.0 to prevent conflicts touchOverflowEnabled: false, // Set default dialog transition - 'none' for no transitions defaultDialogTransition: "pop", // Error response message - appears when an Ajax page request fails pageLoadErrorMessage: "Error Loading Page", // For error messages, which theme does the box uses? pageLoadErrorMessageTheme: "e", // replace calls to window.history.back with phonegaps navigation helper // where it is provided on the window object phonegapNavigationEnabled: false, //automatically initialize the DOM when it's ready autoInitializePage: true, pushStateEnabled: true, // allows users to opt in to ignoring content by marking a parent element as // data-ignored ignoreContentEnabled: false, // turn of binding to the native orientationchange due to android orientation behavior orientationChangeEnabled: true, buttonMarkup: { hoverDelay: 200 }, // TODO might be useful upstream in jquery itself ? keyCode: { ALT: 18, BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, COMMAND: 91, COMMAND_LEFT: 91, // COMMAND COMMAND_RIGHT: 93, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, MENU: 93, // COMMAND_RIGHT 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, WINDOWS: 91 // COMMAND }, // Scroll page vertically: scroll to 0 to hide iOS address bar, or pass a Y value silentScroll: function( ypos ) { if ( $.type( ypos ) !== "number" ) { ypos = $.mobile.defaultHomeScroll; } // prevent scrollstart and scrollstop events $.event.special.scrollstart.enabled = false; setTimeout( function() { window.scrollTo( 0, ypos ); $( document ).trigger( "silentscroll", { x: 0, y: ypos }); }, 20 ); setTimeout( function() { $.event.special.scrollstart.enabled = true; }, 150 ); }, // Expose our cache for testing purposes. nsNormalizeDict: nsNormalizeDict, // Take a data attribute property, prepend the namespace // and then camel case the attribute string. Add the result // to our nsNormalizeDict so we don't have to do this again. nsNormalize: function( prop ) { if ( !prop ) { return; } return nsNormalizeDict[ prop ] || ( nsNormalizeDict[ prop ] = $.camelCase( $.mobile.ns + prop ) ); }, // Find the closest parent with a theme class on it. Note that // we are not using $.fn.closest() on purpose here because this // method gets called quite a bit and we need it to be as fast // as possible. getInheritedTheme: function( el, defaultTheme ) { var e = el[ 0 ], ltr = "", re = /ui-(bar|body|overlay)-([a-z])\b/, c, m; while ( e ) { c = e.className || ""; if ( c && ( m = re.exec( c ) ) && ( ltr = m[ 2 ] ) ) { // We found a parent with a theme class // on it so bail from this loop. break; } e = e.parentNode; } // Return the theme letter we found, if none, return the // specified default. return ltr || defaultTheme || "a"; }, // TODO the following $ and $.fn extensions can/probably should be moved into jquery.mobile.core.helpers // // Find the closest javascript page element to gather settings data jsperf test // http://jsperf.com/single-complex-selector-vs-many-complex-selectors/edit // possibly naive, but it shows that the parsing overhead for *just* the page selector vs // the page and dialog selector is negligable. This could probably be speed up by // doing a similar parent node traversal to the one found in the inherited theme code above closestPageData: function( $target ) { return $target .closest( ':jqmData(role="page"), :jqmData(role="dialog")' ) .data( "page" ); }, enhanceable: function( $set ) { return this.haveParents( $set, "enhance" ); }, hijackable: function( $set ) { return this.haveParents( $set, "ajax" ); }, haveParents: function( $set, attr ) { if ( !$.mobile.ignoreContentEnabled ) { return $set; } var count = $set.length, $newSet = $(), e, $element, excluded; for ( var i = 0; i < count; i++ ) { $element = $set.eq( i ); excluded = false; e = $set[ i ]; while ( e ) { var c = e.getAttribute ? e.getAttribute( "data-" + $.mobile.ns + attr ) : ""; if ( c === "false" ) { excluded = true; break; } e = e.parentNode; } if ( !excluded ) { $newSet = $newSet.add( $element ); } } return $newSet; }, getScreenHeight: function() { // Native innerHeight returns more accurate value for this across platforms, // jQuery version is here as a normalized fallback for platforms like Symbian return window.innerHeight || $( window ).height(); } }, $.mobile ); // Mobile version of data and removeData and hasData methods // ensures all data is set and retrieved using jQuery Mobile's data namespace $.fn.jqmData = function( prop, value ) { var result; if ( typeof prop !== "undefined" ) { if ( prop ) { prop = $.mobile.nsNormalize( prop ); } // undefined is permitted as an explicit input for the second param // in this case it returns the value and does not set it to undefined if( arguments.length < 2 || value === undefined ){ result = this.data( prop ); } else { result = this.data( prop, value ); } } return result; }; $.jqmData = function( elem, prop, value ) { var result; if ( typeof prop !== "undefined" ) { result = $.data( elem, prop ? $.mobile.nsNormalize( prop ) : prop, value ); } return result; }; $.fn.jqmRemoveData = function( prop ) { return this.removeData( $.mobile.nsNormalize( prop ) ); }; $.jqmRemoveData = function( elem, prop ) { return $.removeData( elem, $.mobile.nsNormalize( prop ) ); }; $.fn.removeWithDependents = function() { $.removeWithDependents( this ); }; $.removeWithDependents = function( elem ) { var $elem = $( elem ); ( $elem.jqmData( 'dependents' ) || $() ).remove(); $elem.remove(); }; $.fn.addDependents = function( newDependents ) { $.addDependents( $( this ), newDependents ); }; $.addDependents = function( elem, newDependents ) { var dependents = $( elem ).jqmData( 'dependents' ) || $(); $( elem ).jqmData( 'dependents', $.merge( dependents, newDependents ) ); }; // note that this helper doesn't attempt to handle the callback // or setting of an html elements text, its only purpose is // to return the html encoded version of the text in all cases. (thus the name) $.fn.getEncodedText = function() { return $( "<div/>" ).text( $( this ).text() ).html(); }; // fluent helper function for the mobile namespaced equivalent $.fn.jqmEnhanceable = function() { return $.mobile.enhanceable( this ); }; $.fn.jqmHijackable = function() { return $.mobile.hijackable( this ); }; // Monkey-patching Sizzle to filter the :jqmData selector var oldFind = $.find, jqmDataRE = /:jqmData\(([^)]*)\)/g; $.find = function( selector, context, ret, extra ) { selector = selector.replace( jqmDataRE, "[data-" + ( $.mobile.ns || "" ) + "$1]" ); return oldFind.call( this, selector, context, ret, extra ); }; $.extend( $.find, oldFind ); $.find.matches = function( expr, set ) { return $.find( expr, null, null, set ); }; $.find.matchesSelector = function( node, expr ) { return $.find( expr, null, null, [ node ] ).length > 0; }; })( jQuery, this ); /*! * jQuery UI Widget v1.9.0-beta.1 * * Copyright 2012, https://github.com/jquery/jquery-ui/blob/1.9.0-beta.1/AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI/Widget */ (function( $, undefined ) { var uuid = 0, slice = Array.prototype.slice, _cleanData = $.cleanData; $.cleanData = function( elems ) { for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { try { $( elem ).triggerHandler( "remove" ); // http://bugs.jquery.com/ticket/8235 } catch( e ) {} } _cleanData( elems ); }; $.widget = function( name, base, prototype ) { var fullName, existingConstructor, constructor, basePrototype, namespace = name.split( "." )[ 0 ]; name = name.split( "." )[ 1 ]; fullName = namespace + "-" + name; if ( !prototype ) { prototype = base; base = $.Widget; } // create selector for plugin $.expr[ ":" ][ fullName ] = function( elem ) { return !!$.data( elem, fullName ); }; $[ namespace ] = $[ namespace ] || {}; existingConstructor = $[ namespace ][ name ]; constructor = $[ namespace ][ name ] = function( options, element ) { // allow instantiation without "new" keyword if ( !this._createWidget ) { return new constructor( options, element ); } // allow instantiation without initializing for simple inheritance // must use "new" keyword (the code above always passes args) if ( arguments.length ) { this._createWidget( options, element ); } }; // extend with the existing constructor to carry over any static properties $.extend( constructor, existingConstructor, { version: prototype.version, // copy the object used to create the prototype in case we need to // redefine the widget later _proto: $.extend( {}, prototype ), // track widgets that inherit from this widget in case this widget is // redefined after a widget inherits from it _childConstructors: [] }); basePrototype = new base(); // we need to make the options hash a property directly on the new instance // otherwise we'll modify the options hash on the prototype that we're // inheriting from basePrototype.options = $.widget.extend( {}, basePrototype.options ); $.each( prototype, function( prop, value ) { if ( $.isFunction( value ) ) { prototype[ prop ] = (function() { var _super = function() { return base.prototype[ prop ].apply( this, arguments ); }, _superApply = function( args ) { return base.prototype[ prop ].apply( this, args ); }; return function() { var __super = this._super, __superApply = this._superApply, returnValue; this._super = _super; this._superApply = _superApply; returnValue = value.apply( this, arguments ); this._super = __super; this._superApply = __superApply; return returnValue; }; })(); } }); constructor.prototype = $.widget.extend( basePrototype, { // TODO: remove support for widgetEventPrefix // always use the name + a colon as the prefix, e.g., draggable:start // don't prefix for widgets that aren't DOM-based widgetEventPrefix: name }, prototype, { constructor: constructor, namespace: namespace, widgetName: name, // TODO remove widgetBaseClass, see #8155 widgetBaseClass: fullName, widgetFullName: fullName }); // If this widget is being redefined then we need to find all widgets that // are inheriting from it and redefine all of them so that they inherit from // the new version of this widget. We're essentially trying to replace one // level in the prototype chain. if ( existingConstructor ) { $.each( existingConstructor._childConstructors, function( i, child ) { var childPrototype = child.prototype; // redefine the child widget using the same prototype that was // originally used, but inherit from the new version of the base $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); }); // remove the list of existing child constructors from the old constructor // so the old child constructors can be garbage collected delete existingConstructor._childConstructors; } else { base._childConstructors.push( constructor ); } $.widget.bridge( name, constructor ); }; $.widget.extend = function( target ) { var input = slice.call( arguments, 1 ), inputIndex = 0, inputLength = input.length, key, value; for ( ; inputIndex < inputLength; inputIndex++ ) { for ( key in input[ inputIndex ] ) { value = input[ inputIndex ][ key ]; if (input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { target[ key ] = $.isPlainObject( value ) ? $.widget.extend( {}, target[ key ], value ) : value; } } } return target; }; $.widget.bridge = function( name, object ) { var fullName = object.prototype.widgetFullName; $.fn[ name ] = function( options ) { var isMethodCall = typeof options === "string", args = slice.call( arguments, 1 ), returnValue = this; // allow multiple hashes to be passed on init options = !isMethodCall && args.length ? $.widget.extend.apply( null, [ options ].concat(args) ) : options; if ( isMethodCall ) { this.each(function() { var methodValue, instance = $.data( this, fullName ); if ( !instance ) { return $.error( "cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'" ); } if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { return $.error( "no such method '" + options + "' for " + name + " widget instance" ); } methodValue = instance[ options ].apply( instance, args ); if ( methodValue !== instance && methodValue !== undefined ) { returnValue = methodValue && methodValue.jquery ? returnValue.pushStack( methodValue.get() ) : methodValue; return false; } }); } else { this.each(function() { var instance = $.data( this, fullName ); if ( instance ) { instance.option( options || {} )._init(); } else { new object( options, this ); } }); } return returnValue; }; }; $.Widget = function( options, element ) {}; $.Widget._childConstructors = []; $.Widget.prototype = { widgetName: "widget", widgetEventPrefix: "", defaultElement: "<div>", options: { disabled: false, // callbacks create: null }, _createWidget: function( options, element ) { element = $( element || this.defaultElement || this )[ 0 ]; this.element = $( element ); this.uuid = uuid++; this.eventNamespace = "." + this.widgetName + this.uuid; this.options = $.widget.extend( {}, this.options, this._getCreateOptions(), options ); this.bindings = $(); this.hoverable = $(); this.focusable = $(); if ( element !== this ) { // 1.9 BC for #7810 // TODO remove dual storage $.data( element, this.widgetName, this ); $.data( element, this.widgetFullName, this ); this._on({ remove: "destroy" }); this.document = $( element.style ? // element within the document element.ownerDocument : // element is window or document element.document || element ); this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); } this._create(); this._trigger( "create", null, this._getCreateEventData() ); this._init(); }, _getCreateOptions: $.noop, _getCreateEventData: $.noop, _create: $.noop, _init: $.noop, destroy: function() { this._destroy(); // we can probably remove the unbind calls in 2.0 // all event bindings should go through this._on() this.element .unbind( this.eventNamespace ) // 1.9 BC for #7810 // TODO remove dual storage .removeData( this.widgetName ) .removeData( this.widgetFullName ) // support: jquery <1.6.3 // http://bugs.jquery.com/ticket/9413 .removeData( $.camelCase( this.widgetFullName ) ); this.widget() .unbind( this.eventNamespace ) .removeAttr( "aria-disabled" ) .removeClass( this.widgetFullName + "-disabled " + "ui-state-disabled" ); // clean up events and states this.bindings.unbind( this.eventNamespace ); this.hoverable.removeClass( "ui-state-hover" ); this.focusable.removeClass( "ui-state-focus" ); }, _destroy: $.noop, widget: function() { return this.element; }, option: function( key, value ) { var options = key, parts, curOption, i; if ( arguments.length === 0 ) { // don't return a reference to the internal hash return $.widget.extend( {}, this.options ); } if ( typeof key === "string" ) { // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } options = {}; parts = key.split( "." ); key = parts.shift(); if ( parts.length ) { curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); for ( i = 0; i < parts.length - 1; i++ ) { curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; curOption = curOption[ parts[ i ] ]; } key = parts.pop(); if ( value === undefined ) { return curOption[ key ] === undefined ? null : curOption[ key ]; } curOption[ key ] = value; } else { if ( value === undefined ) { return this.options[ key ] === undefined ? null : this.options[ key ]; } options[ key ] = value; } } this._setOptions( options ); return this; }, _setOptions: function( options ) { var key; for ( key in options ) { this._setOption( key, options[ key ] ); } return this; }, _setOption: function( key, value ) { this.options[ key ] = value; if ( key === "disabled" ) { this.widget() .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value ) .attr( "aria-disabled", value ); this.hoverable.removeClass( "ui-state-hover" ); this.focusable.removeClass( "ui-state-focus" ); } return this; }, enable: function() { return this._setOption( "disabled", false ); }, disable: function() { return this._setOption( "disabled", true ); }, _on: function( element, handlers ) { // no element argument, shuffle and use this.element if ( !handlers ) { handlers = element; element = this.element; } else { // accept selectors, DOM elements element = $( element ); this.bindings = this.bindings.add( element ); } var instance = this; $.each( handlers, function( event, handler ) { function handlerProxy() { // allow widgets to customize the disabled handling // - disabled as an array instead of boolean // - disabled class as method for disabling individual parts if ( instance.options.disabled === true || $( this ).hasClass( "ui-state-disabled" ) ) { return; } return ( typeof handler === "string" ? instance[ handler ] : handler ) .apply( instance, arguments ); } // copy the guid so direct unbinding works if ( typeof handler !== "string" ) { handlerProxy.guid = handler.guid = handler.guid || handlerProxy.guid || $.guid++; } var match = event.match( /^(\w+)\s*(.*)$/ ), eventName = match[1] + instance.eventNamespace, selector = match[2]; if ( selector ) { instance.widget().delegate( selector, eventName, handlerProxy ); } else { element.bind( eventName, handlerProxy ); } }); }, _off: function( element, eventName ) { eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace; element.unbind( eventName ).undelegate( eventName ); }, _delay: function( handler, delay ) { function handlerProxy() { return ( typeof handler === "string" ? instance[ handler ] : handler ) .apply( instance, arguments ); } var instance = this; return setTimeout( handlerProxy, delay || 0 ); }, _hoverable: function( element ) { this.hoverable = this.hoverable.add( element ); this._on( element, { mouseenter: function( event ) { $( event.currentTarget ).addClass( "ui-state-hover" ); }, mouseleave: function( event ) { $( event.currentTarget ).removeClass( "ui-state-hover" ); } }); }, _focusable: function( element ) { this.focusable = this.focusable.add( element ); this._on( element, { focusin: function( event ) { $( event.currentTarget ).addClass( "ui-state-focus" ); }, focusout: function( event ) { $( event.currentTarget ).removeClass( "ui-state-focus" ); } }); }, _trigger: function( type, event, data ) { var prop, orig, callback = this.options[ type ]; data = data || {}; event = $.Event( event ); event.type = ( type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type ).toLowerCase(); // the original event may come from any element // so we need to reset the target on the new event event.target = this.element[ 0 ]; // copy original event properties over to the new event orig = event.originalEvent; if ( orig ) { for ( prop in orig ) { if ( !( prop in event ) ) { event[ prop ] = orig[ prop ]; } } } this.element.trigger( event, data ); return !( $.isFunction( callback ) && callback.apply( this.element[0], [ event ].concat( data ) ) === false || event.isDefaultPrevented() ); } }; $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { if ( typeof options === "string" ) { options = { effect: options }; } var hasOptions, effectName = !options ? method : options === true || typeof options === "number" ? defaultEffect : options.effect || defaultEffect; options = options || {}; if ( typeof options === "number" ) { options = { duration: options }; } hasOptions = !$.isEmptyObject( options ); options.complete = callback; if ( options.delay ) { element.delay( options.delay ); } if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) { element[ method ]( options ); } else if ( effectName !== method && element[ effectName ] ) { element[ effectName ]( options.duration, options.easing, callback ); } else { element.queue(function( next ) { $( this )[ method ](); if ( callback ) { callback.call( element[ 0 ] ); } next(); }); } }; }); // DEPRECATED if ( $.uiBackCompat !== false ) { $.Widget.prototype._getCreateOptions = function() { return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; }; } })( jQuery ); (function( $, undefined ) { $.widget( "mobile.widget", { // decorate the parent _createWidget to trigger `widgetinit` for users // who wish to do post post `widgetcreate` alterations/additions // // TODO create a pull request for jquery ui to trigger this event // in the original _createWidget _createWidget: function() { $.Widget.prototype._createWidget.apply( this, arguments ); this._trigger( 'init' ); }, _getCreateOptions: function() { var elem = this.element, options = {}; $.each( this.options, function( option ) { var value = elem.jqmData( option.replace( /[A-Z]/g, function( c ) { return "-" + c.toLowerCase(); }) ); if ( value !== undefined ) { options[ option ] = value; } }); return options; }, enhanceWithin: function( target, useKeepNative ) { this.enhance( $( this.options.initSelector, $( target )), useKeepNative ); }, enhance: function( targets, useKeepNative ) { var page, keepNative, $widgetElements = $( targets ), self = this; // if ignoreContentEnabled is set to true the framework should // only enhance the selected elements when they do NOT have a // parent with the data-namespace-ignore attribute $widgetElements = $.mobile.enhanceable( $widgetElements ); if ( useKeepNative && $widgetElements.length ) { // TODO remove dependency on the page widget for the keepNative. // Currently the keepNative value is defined on the page prototype so // the method is as well page = $.mobile.closestPageData( $widgetElements ); keepNative = ( page && page.keepNativeSelector()) || ""; $widgetElements = $widgetElements.not( keepNative ); } $widgetElements[ this.widgetName ](); }, raise: function( msg ) { throw "Widget [" + this.widgetName + "]: " + msg; } }); })( jQuery ); (function( $, window ) { // DEPRECATED // NOTE global mobile object settings $.extend( $.mobile, { // DEPRECATED Should the text be visble in the loading message? loadingMessageTextVisible: undefined, // DEPRECATED When the text is visible, what theme does the loading box use? loadingMessageTheme: undefined, // DEPRECATED default message setting loadingMessage: undefined, // DEPRECATED // Turn on/off page loading message. Theme doubles as an object argument // with the following shape: { theme: '', text: '', html: '', textVisible: '' } // NOTE that the $.mobile.loading* settings and params past the first are deprecated showPageLoadingMsg: function( theme, msgText, textonly ) { $.mobile.loading( 'show', theme, msgText, textonly ); }, // DEPRECATED hidePageLoadingMsg: function() { $.mobile.loading( 'hide' ); }, loading: function() { this.loaderWidget.loader.apply( this.loaderWidget, arguments ); } }); // TODO move loader class down into the widget settings var loaderClass = "ui-loader", $html = $( "html" ), $window = $( window ); $.widget( "mobile.loader", { // NOTE if the global config settings are defined they will override these // options options: { // the theme for the loading message theme: "a", // whether the text in the loading message is shown textVisible: false, // custom html for the inner content of the loading message html: "", // the text to be displayed when the popup is shown text: "loading" }, defaultHtml: "<div class='" + loaderClass + "'>" + "<span class='ui-icon ui-icon-loading'></span>" + "<h1></h1>" + "</div>", // For non-fixed supportin browsers. Position at y center (if scrollTop supported), above the activeBtn (if defined), or just 100px from top fakeFixLoader: function() { var activeBtn = $( "." + $.mobile.activeBtnClass ).first(); this.element .css({ top: $.support.scrollTop && $window.scrollTop() + $window.height() / 2 || activeBtn.length && activeBtn.offset().top || 100 }); }, // check position of loader to see if it appears to be "fixed" to center // if not, use abs positioning checkLoaderPosition: function() { var offset = this.element.offset(), scrollTop = $window.scrollTop(), screenHeight = $.mobile.getScreenHeight(); if ( offset.top < scrollTop || ( offset.top - scrollTop ) > screenHeight ) { this.element.addClass( "ui-loader-fakefix" ); this.fakeFixLoader(); $window .unbind( "scroll", this.checkLoaderPosition ) .bind( "scroll", this.fakeFixLoader ); } }, resetHtml: function() { this.element.html( $( this.defaultHtml ).html() ); }, // Turn on/off page loading message. Theme doubles as an object argument // with the following shape: { theme: '', text: '', html: '', textVisible: '' } // NOTE that the $.mobile.loading* settings and params past the first are deprecated // TODO sweet jesus we need to break some of this out show: function( theme, msgText, textonly ) { var textVisible, message, $header, loadSettings; this.resetHtml(); // use the prototype options so that people can set them globally at // mobile init. Consistency, it's what's for dinner if ( $.type(theme) === "object" ) { loadSettings = $.extend( {}, this.options, theme ); // prefer object property from the param then the old theme setting theme = loadSettings.theme || $.mobile.loadingMessageTheme; } else { loadSettings = this.options; // here we prefer the them value passed as a string argument, then // we prefer the global option because we can't use undefined default // prototype options, then the prototype option theme = theme || $.mobile.loadingMessageTheme || loadSettings.theme; } // set the message text, prefer the param, then the settings object // then loading message message = msgText || $.mobile.loadingMessage || loadSettings.text; // prepare the dom $html.addClass( "ui-loading" ); if ( $.mobile.loadingMessage !== false || loadSettings.html ) { // boolean values require a bit more work :P, supports object properties // and old settings if ( $.mobile.loadingMessageTextVisible !== undefined ) { textVisible = $.mobile.loadingMessageTextVisible; } else { textVisible = loadSettings.textVisible; } // add the proper css given the options (theme, text, etc) // Force text visibility if the second argument was supplied, or // if the text was explicitly set in the object args this.element.attr("class", loaderClass + " ui-corner-all ui-body-" + theme + " ui-loader-" + ( textVisible || msgText || theme.text ? "verbose" : "default" ) + ( loadSettings.textonly || textonly ? " ui-loader-textonly" : "" ) ); // TODO verify that jquery.fn.html is ok to use in both cases here // this might be overly defensive in preventing unknowing xss // if the html attribute is defined on the loading settings, use that // otherwise use the fallbacks from above if ( loadSettings.html ) { this.element.html( loadSettings.html ); } else { this.element.find( "h1" ).text( message ); } // attach the loader to the DOM this.element.appendTo( $.mobile.pageContainer ); // check that the loader is visible this.checkLoaderPosition(); // on scroll check the loader position $window.bind( "scroll", $.proxy( this.checkLoaderPosition, this ) ); } }, hide: function() { $html.removeClass( "ui-loading" ); if ( $.mobile.loadingMessage ) { this.element.removeClass( "ui-loader-fakefix" ); } $( window ).unbind( "scroll", $.proxy( this.fakeFixLoader, this) ); $( window ).unbind( "scroll", $.proxy( this.checkLoaderPosition, this ) ); } }); $window.bind( 'pagecontainercreate', function() { $.mobile.loaderWidget = $.mobile.loaderWidget || $( $.mobile.loader.prototype.defaultHtml ).loader(); }); })(jQuery, this); // This plugin is an experiment for abstracting away the touch and mouse // events so that developers don't have to worry about which method of input // the device their document is loaded on supports. // // The idea here is to allow the developer to register listeners for the // basic mouse events, such as mousedown, mousemove, mouseup, and click, // and the plugin will take care of registering the correct listeners // behind the scenes to invoke the listener at the fastest possible time // for that device, while still retaining the order of event firing in // the traditional mouse environment, should multiple handlers be registered // on the same element for different events. // // The current version exposes the following virtual events to jQuery bind methods: // "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel" (function( $, window, document, undefined ) { var dataPropertyName = "virtualMouseBindings", touchTargetPropertyName = "virtualTouchID", virtualEventNames = "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split( " " ), touchEventProps = "clientX clientY pageX pageY screenX screenY".split( " " ), mouseHookProps = $.event.mouseHooks ? $.event.mouseHooks.props : [], mouseEventProps = $.event.props.concat( mouseHookProps ), activeDocHandlers = {}, resetTimerID = 0, startX = 0, startY = 0, didScroll = false, clickBlockList = [], blockMouseTriggers = false, blockTouchTriggers = false, eventCaptureSupported = "addEventListener" in document, $document = $( document ), nextTouchID = 1, lastTouchID = 0, threshold; $.vmouse = { moveDistanceThreshold: 10, clickDistanceThreshold: 10, resetTimerDuration: 1500 }; function getNativeEvent( event ) { while ( event && typeof event.originalEvent !== "undefined" ) { event = event.originalEvent; } return event; } function createVirtualEvent( event, eventType ) { var t = event.type, oe, props, ne, prop, ct, touch, i, j, len; event = $.Event( event ); event.type = eventType; oe = event.originalEvent; props = $.event.props; // addresses separation of $.event.props in to $.event.mouseHook.props and Issue 3280 // https://github.com/jquery/jquery-mobile/issues/3280 if ( t.search( /^(mouse|click)/ ) > -1 ) { props = mouseEventProps; } // 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 ( oe ) { for ( i = props.length, prop; i; ) { prop = props[ --i ]; event[ prop ] = oe[ prop ]; } } // make sure that if the mouse and click virtual events are generated // without a .which one is defined if ( t.search(/mouse(down|up)|click/) > -1 && !event.which ) { event.which = 1; } if ( t.search(/^touch/) !== -1 ) { ne = getNativeEvent( oe ); t = ne.touches; ct = ne.changedTouches; touch = ( t && t.length ) ? t[0] : ( ( ct && ct.length ) ? ct[ 0 ] : undefined ); if ( touch ) { for ( j = 0, len = touchEventProps.length; j < len; j++) { prop = touchEventProps[ j ]; event[ prop ] = touch[ prop ]; } } } return event; } function getVirtualBindingFlags( element ) { var flags = {}, b, k; while ( element ) { b = $.data( element, dataPropertyName ); for ( k in b ) { if ( b[ k ] ) { flags[ k ] = flags.hasVirtualBinding = true; } } element = element.parentNode; } return flags; } function getClosestElementWithVirtualBinding( element, eventType ) { var b; while ( element ) { b = $.data( element, dataPropertyName ); if ( b && ( !eventType || b[ eventType ] ) ) { return element; } element = element.parentNode; } return null; } function enableTouchBindings() { blockTouchTriggers = false; } function disableTouchBindings() { blockTouchTriggers = true; } function enableMouseBindings() { lastTouchID = 0; clickBlockList.length = 0; blockMouseTriggers = false; // When mouse bindings are enabled, our // touch bindings are disabled. disableTouchBindings(); } function disableMouseBindings() { // When mouse bindings are disabled, our // touch bindings are enabled. enableTouchBindings(); } function startResetTimer() { clearResetTimer(); resetTimerID = setTimeout( function() { resetTimerID = 0; enableMouseBindings(); }, $.vmouse.resetTimerDuration ); } function clearResetTimer() { if ( resetTimerID ) { clearTimeout( resetTimerID ); resetTimerID = 0; } } function triggerVirtualEvent( eventType, event, flags ) { var ve; if ( ( flags && flags[ eventType ] ) || ( !flags && getClosestElementWithVirtualBinding( event.target, eventType ) ) ) { ve = createVirtualEvent( event, eventType ); $( event.target).trigger( ve ); } return ve; } function mouseEventCallback( event ) { var touchID = $.data( event.target, touchTargetPropertyName ); if ( !blockMouseTriggers && ( !lastTouchID || lastTouchID !== touchID ) ) { var ve = triggerVirtualEvent( "v" + event.type, event ); if ( ve ) { if ( ve.isDefaultPrevented() ) { event.preventDefault(); } if ( ve.isPropagationStopped() ) { event.stopPropagation(); } if ( ve.isImmediatePropagationStopped() ) { event.stopImmediatePropagation(); } } } } function handleTouchStart( event ) { var touches = getNativeEvent( event ).touches, target, flags; if ( touches && touches.length === 1 ) { target = event.target; flags = getVirtualBindingFlags( target ); if ( flags.hasVirtualBinding ) { lastTouchID = nextTouchID++; $.data( target, touchTargetPropertyName, lastTouchID ); clearResetTimer(); disableMouseBindings(); didScroll = false; var t = getNativeEvent( event ).touches[ 0 ]; startX = t.pageX; startY = t.pageY; triggerVirtualEvent( "vmouseover", event, flags ); triggerVirtualEvent( "vmousedown", event, flags ); } } } function handleScroll( event ) { if ( blockTouchTriggers ) { return; } if ( !didScroll ) { triggerVirtualEvent( "vmousecancel", event, getVirtualBindingFlags( event.target ) ); } didScroll = true; startResetTimer(); } function handleTouchMove( event ) { if ( blockTouchTriggers ) { return; } var t = getNativeEvent( event ).touches[ 0 ], didCancel = didScroll, moveThreshold = $.vmouse.moveDistanceThreshold, flags = getVirtualBindingFlags( event.target ); didScroll = didScroll || ( Math.abs( t.pageX - startX ) > moveThreshold || Math.abs( t.pageY - startY ) > moveThreshold ); if ( didScroll && !didCancel ) { triggerVirtualEvent( "vmousecancel", event, flags ); } triggerVirtualEvent( "vmousemove", event, flags ); startResetTimer(); } function handleTouchEnd( event ) { if ( blockTouchTriggers ) { return; } disableTouchBindings(); var flags = getVirtualBindingFlags( event.target ), t; triggerVirtualEvent( "vmouseup", event, flags ); if ( !didScroll ) { var ve = triggerVirtualEvent( "vclick", event, flags ); if ( ve && ve.isDefaultPrevented() ) { // The target of the mouse events that follow the touchend // event don't necessarily match the target used during the // touch. This means we need to rely on coordinates for blocking // any click that is generated. t = getNativeEvent( event ).changedTouches[ 0 ]; clickBlockList.push({ touchID: lastTouchID, x: t.clientX, y: t.clientY }); // Prevent any mouse events that follow from triggering // virtual event notifications. blockMouseTriggers = true; } } triggerVirtualEvent( "vmouseout", event, flags); didScroll = false; startResetTimer(); } function hasVirtualBindings( ele ) { var bindings = $.data( ele, dataPropertyName ), k; if ( bindings ) { for ( k in bindings ) { if ( bindings[ k ] ) { return true; } } } return false; } function dummyMouseHandler() {} function getSpecialEventObject( eventType ) { var realType = eventType.substr( 1 ); return { setup: function( data, namespace ) { // If this is the first virtual mouse binding for this element, // add a bindings object to its data. if ( !hasVirtualBindings( this ) ) { $.data( this, dataPropertyName, {} ); } // If setup is called, we know it is the first binding for this // eventType, so initialize the count for the eventType to zero. var bindings = $.data( this, dataPropertyName ); bindings[ eventType ] = true; // If this is the first virtual mouse event for this type, // register a global handler on the document. activeDocHandlers[ eventType ] = ( activeDocHandlers[ eventType ] || 0 ) + 1; if ( activeDocHandlers[ eventType ] === 1 ) { $document.bind( realType, mouseEventCallback ); } // Some browsers, like Opera Mini, won't dispatch mouse/click events // for elements unless they actually have handlers registered on them. // To get around this, we register dummy handlers on the elements. $( this ).bind( realType, dummyMouseHandler ); // For now, if event capture is not supported, we rely on mouse handlers. if ( eventCaptureSupported ) { // If this is the first virtual mouse binding for the document, // register our touchstart handler on the document. activeDocHandlers[ "touchstart" ] = ( activeDocHandlers[ "touchstart" ] || 0) + 1; if ( activeDocHandlers[ "touchstart" ] === 1 ) { $document.bind( "touchstart", handleTouchStart ) .bind( "touchend", handleTouchEnd ) // On touch platforms, touching the screen and then dragging your finger // causes the window content to scroll after some distance threshold is // exceeded. On these platforms, a scroll prevents a click event from being // dispatched, and on some platforms, even the touchend is suppressed. To // mimic the suppression of the click event, we need to watch for a scroll // event. Unfortunately, some platforms like iOS don't dispatch scroll // events until *AFTER* the user lifts their finger (touchend). This means // we need to watch both scroll and touchmove events to figure out whether // or not a scroll happenens before the touchend event is fired. .bind( "touchmove", handleTouchMove ) .bind( "scroll", handleScroll ); } } }, teardown: function( data, namespace ) { // If this is the last virtual binding for this eventType, // remove its global handler from the document. --activeDocHandlers[ eventType ]; if ( !activeDocHandlers[ eventType ] ) { $document.unbind( realType, mouseEventCallback ); } if ( eventCaptureSupported ) { // If this is the last virtual mouse binding in existence, // remove our document touchstart listener. --activeDocHandlers[ "touchstart" ]; if ( !activeDocHandlers[ "touchstart" ] ) { $document.unbind( "touchstart", handleTouchStart ) .unbind( "touchmove", handleTouchMove ) .unbind( "touchend", handleTouchEnd ) .unbind( "scroll", handleScroll ); } } var $this = $( this ), bindings = $.data( this, dataPropertyName ); // teardown may be called when an element was // removed from the DOM. If this is the case, // jQuery core may have already stripped the element // of any data bindings so we need to check it before // using it. if ( bindings ) { bindings[ eventType ] = false; } // Unregister the dummy event handler. $this.unbind( realType, dummyMouseHandler ); // If this is the last virtual mouse binding on the // element, remove the binding data from the element. if ( !hasVirtualBindings( this ) ) { $this.removeData( dataPropertyName ); } } }; } // Expose our custom events to the jQuery bind/unbind mechanism. for ( var i = 0; i < virtualEventNames.length; i++ ) { $.event.special[ virtualEventNames[ i ] ] = getSpecialEventObject( virtualEventNames[ i ] ); } // Add a capture click handler to block clicks. // Note that we require event capture support for this so if the device // doesn't support it, we punt for now and rely solely on mouse events. if ( eventCaptureSupported ) { document.addEventListener( "click", function( e ) { var cnt = clickBlockList.length, target = e.target, x, y, ele, i, o, touchID; if ( cnt ) { x = e.clientX; y = e.clientY; threshold = $.vmouse.clickDistanceThreshold; // The idea here is to run through the clickBlockList to see if // the current click event is in the proximity of one of our // vclick events that had preventDefault() called on it. If we find // one, then we block the click. // // Why do we have to rely on proximity? // // Because the target of the touch event that triggered the vclick // can be different from the target of the click event synthesized // by the browser. The target of a mouse/click event that is syntehsized // from a touch event seems to be implementation specific. For example, // some browsers will fire mouse/click events for a link that is near // a touch event, even though the target of the touchstart/touchend event // says the user touched outside the link. Also, it seems that with most // browsers, the target of the mouse/click event is not calculated until the // time it is dispatched, so if you replace an element that you touched // with another element, the target of the mouse/click will be the new // element underneath that point. // // Aside from proximity, we also check to see if the target and any // of its ancestors were the ones that blocked a click. This is necessary // because of the strange mouse/click target calculation done in the // Android 2.1 browser, where if you click on an element, and there is a // mouse/click handler on one of its ancestors, the target will be the // innermost child of the touched element, even if that child is no where // near the point of touch. ele = target; while ( ele ) { for ( i = 0; i < cnt; i++ ) { o = clickBlockList[ i ]; touchID = 0; if ( ( ele === target && Math.abs( o.x - x ) < threshold && Math.abs( o.y - y ) < threshold ) || $.data( ele, touchTargetPropertyName ) === o.touchID ) { // XXX: We may want to consider removing matches from the block list // instead of waiting for the reset timer to fire. e.preventDefault(); e.stopPropagation(); return; } } ele = ele.parentNode; } } }, true); } })( jQuery, window, document ); (function( $, undefined ) { var support = { touch: "ontouchend" in document }; $.mobile = $.mobile || {}; $.mobile.support = $.mobile.support || {}; $.extend( $.support, support ); $.extend( $.mobile.support, support ); }( jQuery )); (function( $, window, undefined ) { // add new event shortcuts $.each( ( "touchstart touchmove touchend " + "tap taphold " + "swipe swipeleft swiperight " + "scrollstart scrollstop" ).split( " " ), function( i, name ) { $.fn[ name ] = function( fn ) { return fn ? this.bind( name, fn ) : this.trigger( name ); }; // jQuery < 1.8 if ( $.attrFn ) { $.attrFn[ name ] = true; } }); var supportTouch = $.mobile.support.touch, scrollEvent = "touchmove scroll", touchStartEvent = supportTouch ? "touchstart" : "mousedown", touchStopEvent = supportTouch ? "touchend" : "mouseup", touchMoveEvent = supportTouch ? "touchmove" : "mousemove"; function triggerCustomEvent( obj, eventType, event ) { var originalType = event.type; event.type = eventType; $.event.handle.call( obj, event ); event.type = originalType; } // also handles scrollstop $.event.special.scrollstart = { enabled: true, setup: function() { var thisObject = this, $this = $( thisObject ), scrolling, timer; function trigger( event, state ) { scrolling = state; triggerCustomEvent( thisObject, scrolling ? "scrollstart" : "scrollstop", event ); } // iPhone triggers scroll after a small delay; use touchmove instead $this.bind( scrollEvent, function( event ) { if ( !$.event.special.scrollstart.enabled ) { return; } if ( !scrolling ) { trigger( event, true ); } clearTimeout( timer ); timer = setTimeout( function() { trigger( event, false ); }, 50 ); }); } }; // also handles taphold $.event.special.tap = { tapholdThreshold: 750, setup: function() { var thisObject = this, $this = $( thisObject ); $this.bind( "vmousedown", function( event ) { if ( event.which && event.which !== 1 ) { return false; } var origTarget = event.target, origEvent = event.originalEvent, timer; function clearTapTimer() { clearTimeout( timer ); } function clearTapHandlers() { clearTapTimer(); $this.unbind( "vclick", clickHandler ) .unbind( "vmouseup", clearTapTimer ); $( document ).unbind( "vmousecancel", clearTapHandlers ); } function clickHandler( event ) { clearTapHandlers(); // ONLY trigger a 'tap' event if the start target is // the same as the stop target. if ( origTarget === event.target ) { triggerCustomEvent( thisObject, "tap", event ); } } $this.bind( "vmouseup", clearTapTimer ) .bind( "vclick", clickHandler ); $( document ).bind( "vmousecancel", clearTapHandlers ); timer = setTimeout( function() { triggerCustomEvent( thisObject, "taphold", $.Event( "taphold", { target: origTarget } ) ); }, $.event.special.tap.tapholdThreshold ); }); } }; // also handles swipeleft, swiperight $.event.special.swipe = { scrollSupressionThreshold: 30, // More than this horizontal displacement, and we will suppress scrolling. durationThreshold: 1000, // More time than this, and it isn't a swipe. horizontalDistanceThreshold: 30, // Swipe horizontal displacement must be more than this. verticalDistanceThreshold: 75, // Swipe vertical displacement must be less than this. setup: function() { var thisObject = this, $this = $( thisObject ); $this.bind( touchStartEvent, function( event ) { var data = event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event, start = { time: ( new Date() ).getTime(), coords: [ data.pageX, data.pageY ], origin: $( event.target ) }, stop; function moveHandler( event ) { if ( !start ) { return; } var data = event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event; stop = { time: ( new Date() ).getTime(), coords: [ data.pageX, data.pageY ] }; // prevent scrolling if ( Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.scrollSupressionThreshold ) { event.preventDefault(); } } $this.bind( touchMoveEvent, moveHandler ) .one( touchStopEvent, function( event ) { $this.unbind( touchMoveEvent, moveHandler ); if ( start && stop ) { if ( stop.time - start.time < $.event.special.swipe.durationThreshold && Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.horizontalDistanceThreshold && Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ) < $.event.special.swipe.verticalDistanceThreshold ) { start.origin.trigger( "swipe" ) .trigger( start.coords[0] > stop.coords[ 0 ] ? "swipeleft" : "swiperight" ); } } start = stop = undefined; }); }); } }; $.each({ scrollstop: "scrollstart", taphold: "tap", swipeleft: "swipe", swiperight: "swipe" }, function( event, sourceEvent ) { $.event.special[ event ] = { setup: function() { $( this ).bind( sourceEvent, $.noop ); } }; }); })( jQuery, this ); (function( $, undefined ) { $.extend( $.support, { orientation: "orientation" in window && "onorientationchange" in window }); }( jQuery )); // throttled resize event (function( $ ) { $.event.special.throttledresize = { setup: function() { $( this ).bind( "resize", handler ); }, teardown: function() { $( this ).unbind( "resize", handler ); } }; var throttle = 250, handler = function() { curr = ( new Date() ).getTime(); diff = curr - lastCall; if ( diff >= throttle ) { lastCall = curr; $( this ).trigger( "throttledresize" ); } else { if ( heldCall ) { clearTimeout( heldCall ); } // Promise a held call will still execute heldCall = setTimeout( handler, throttle - diff ); } }, lastCall = 0, heldCall, curr, diff; })( jQuery ); (function( $, window ) { var win = $( window ), event_name = "orientationchange", special_event, get_orientation, last_orientation, initial_orientation_is_landscape, initial_orientation_is_default, portrait_map = { "0": true, "180": true }; // It seems that some device/browser vendors use window.orientation values 0 and 180 to // denote the "default" orientation. For iOS devices, and most other smart-phones tested, // the default orientation is always "portrait", but in some Android and RIM based tablets, // the default orientation is "landscape". The following code attempts to use the window // dimensions to figure out what the current orientation is, and then makes adjustments // to the to the portrait_map if necessary, so that we can properly decode the // window.orientation value whenever get_orientation() is called. // // Note that we used to use a media query to figure out what the orientation the browser // thinks it is in: // // initial_orientation_is_landscape = $.mobile.media("all and (orientation: landscape)"); // // but there was an iPhone/iPod Touch bug beginning with iOS 4.2, up through iOS 5.1, // where the browser *ALWAYS* applied the landscape media query. This bug does not // happen on iPad. if ( $.support.orientation ) { // Check the window width and height to figure out what the current orientation // of the device is at this moment. Note that we've initialized the portrait map // values to 0 and 180, *AND* we purposely check for landscape so that if we guess // wrong, , we default to the assumption that portrait is the default orientation. // We use a threshold check below because on some platforms like iOS, the iPhone // form-factor can report a larger width than height if the user turns on the // developer console. The actual threshold value is somewhat arbitrary, we just // need to make sure it is large enough to exclude the developer console case. var ww = window.innerWidth || $( window ).width(), wh = window.innerHeight || $( window ).height(), landscape_threshold = 50; initial_orientation_is_landscape = ww > wh && ( ww - wh ) > landscape_threshold; // Now check to see if the current window.orientation is 0 or 180. initial_orientation_is_default = portrait_map[ window.orientation ]; // If the initial orientation is landscape, but window.orientation reports 0 or 180, *OR* // if the initial orientation is portrait, but window.orientation reports 90 or -90, we // need to flip our portrait_map values because landscape is the default orientation for // this device/browser. if ( ( initial_orientation_is_landscape && initial_orientation_is_default ) || ( !initial_orientation_is_landscape && !initial_orientation_is_default ) ) { portrait_map = { "-90": true, "90": true }; } } $.event.special.orientationchange = $.extend( {}, $.event.special.orientationchange, { setup: function() { // If the event is supported natively, return false so that jQuery // will bind to the event using DOM methods. if ( $.support.orientation && !$.event.special.orientationchange.disabled ) { return false; } // Get the current orientation to avoid initial double-triggering. last_orientation = get_orientation(); // Because the orientationchange event doesn't exist, simulate the // event by testing window dimensions on resize. win.bind( "throttledresize", handler ); }, teardown: function() { // If the event is not supported natively, return false so that // jQuery will unbind the event using DOM methods. if ( $.support.orientation && !$.event.special.orientationchange.disabled ) { return false; } // Because the orientationchange event doesn't exist, unbind the // resize event handler. win.unbind( "throttledresize", handler ); }, add: function( handleObj ) { // Save a reference to the bound event handler. var old_handler = handleObj.handler; handleObj.handler = function( event ) { // Modify event object, adding the .orientation property. event.orientation = get_orientation(); // Call the originally-bound event handler and return its result. return old_handler.apply( this, arguments ); }; } }); // If the event is not supported natively, this handler will be bound to // the window resize event to simulate the orientationchange event. function handler() { // Get the current orientation. var orientation = get_orientation(); if ( orientation !== last_orientation ) { // The orientation has changed, so trigger the orientationchange event. last_orientation = orientation; win.trigger( event_name ); } } // Get the current page orientation. This method is exposed publicly, should it // be needed, as jQuery.event.special.orientationchange.orientation() $.event.special.orientationchange.orientation = get_orientation = function() { var isPortrait = true, elem = document.documentElement; // prefer window orientation to the calculation based on screensize as // the actual screen resize takes place before or after the orientation change event // has been fired depending on implementation (eg android 2.3 is before, iphone after). // More testing is required to determine if a more reliable method of determining the new screensize // is possible when orientationchange is fired. (eg, use media queries + element + opacity) if ( $.support.orientation ) { // if the window orientation registers as 0 or 180 degrees report // portrait, otherwise landscape isPortrait = portrait_map[ window.orientation ]; } else { isPortrait = elem && elem.clientWidth / elem.clientHeight < 1.1; } return isPortrait ? "portrait" : "landscape"; }; $.fn[ event_name ] = function( fn ) { return fn ? this.bind( event_name, fn ) : this.trigger( event_name ); }; // jQuery < 1.8 if ( $.attrFn ) { $.attrFn[ event_name ] = true; } }( jQuery, this )); (function( $, undefined ) { var $window = $( window ), $html = $( "html" ); /* $.mobile.media method: pass a CSS media type or query and get a bool return note: this feature relies on actual media query support for media queries, though types will work most anywhere examples: $.mobile.media('screen') // tests for screen media type $.mobile.media('screen and (min-width: 480px)') // tests for screen media type with window width > 480px $.mobile.media('@media screen and (-webkit-min-device-pixel-ratio: 2)') // tests for webkit 2x pixel ratio (iPhone 4) */ $.mobile.media = (function() { // TODO: use window.matchMedia once at least one UA implements it var cache = {}, testDiv = $( "<div id='jquery-mediatest'></div>" ), fakeBody = $( "<body>" ).append( testDiv ); return function( query ) { if ( !( query in cache ) ) { var styleBlock = document.createElement( "style" ), cssrule = "@media " + query + " { #jquery-mediatest { position:absolute; } }"; //must set type for IE! styleBlock.type = "text/css"; if ( styleBlock.styleSheet ) { styleBlock.styleSheet.cssText = cssrule; } else { styleBlock.appendChild( document.createTextNode(cssrule) ); } $html.prepend( fakeBody ).prepend( styleBlock ); cache[ query ] = testDiv.css( "position" ) === "absolute"; fakeBody.add( styleBlock ).remove(); } return cache[ query ]; }; })(); })(jQuery); (function( $, undefined ) { // thx Modernizr function propExists( prop ) { var uc_prop = prop.charAt( 0 ).toUpperCase() + prop.substr( 1 ), props = ( prop + " " + vendors.join( uc_prop + " " ) + uc_prop ).split( " " ); for ( var v in props ) { if ( fbCSS[ props[ v ] ] !== undefined ) { return true; } } } var fakeBody = $( "<body>" ).prependTo( "html" ), fbCSS = fakeBody[ 0 ].style, vendors = [ "Webkit", "Moz", "O" ], webos = "palmGetResource" in window, //only used to rule out scrollTop opera = window.opera, operamini = window.operamini && ({}).toString.call( window.operamini ) === "[object OperaMini]", bb = window.blackberry && !propExists( "-webkit-transform" ); //only used to rule out box shadow, as it's filled opaque on BB 5 and lower function validStyle( prop, value, check_vend ) { var div = document.createElement( 'div' ), uc = function( txt ) { return txt.charAt( 0 ).toUpperCase() + txt.substr( 1 ); }, vend_pref = function( vend ) { return "-" + vend.charAt( 0 ).toLowerCase() + vend.substr( 1 ) + "-"; }, check_style = function( vend ) { var vend_prop = vend_pref( vend ) + prop + ": " + value + ";", uc_vend = uc( vend ), propStyle = uc_vend + uc( prop ); div.setAttribute( "style", vend_prop ); if ( !!div.style[ propStyle ] ) { ret = true; } }, check_vends = check_vend ? [ check_vend ] : vendors, ret; for( var i = 0; i < check_vends.length; i++ ) { check_style( check_vends[i] ); } return !!ret; } // Thanks to Modernizr src for this test idea. `perspective` check is limited to Moz to prevent a false positive for 3D transforms on Android. function transform3dTest() { var prop = "transform-3d"; return validStyle( 'perspective', '10px', 'moz' ) || $.mobile.media( "(-" + vendors.join( "-" + prop + "),(-" ) + "-" + prop + "),(" + prop + ")" ); } // Test for dynamic-updating base tag support ( allows us to avoid href,src attr rewriting ) function baseTagTest() { var fauxBase = location.protocol + "//" + location.host + location.pathname + "ui-dir/", base = $( "head base" ), fauxEle = null, href = "", link, rebase; if ( !base.length ) { base = fauxEle = $( "<base>", { "href": fauxBase }).appendTo( "head" ); } else { href = base.attr( "href" ); } link = $( "<a href='testurl' />" ).prependTo( fakeBody ); rebase = link[ 0 ].href; base[ 0 ].href = href || location.pathname; if ( fauxEle ) { fauxEle.remove(); } return rebase.indexOf( fauxBase ) === 0; } // Thanks Modernizr function cssPointerEventsTest() { var element = document.createElement( 'x' ), documentElement = document.documentElement, getComputedStyle = window.getComputedStyle, supports; if ( !( 'pointerEvents' in element.style ) ) { return false; } element.style.pointerEvents = 'auto'; element.style.pointerEvents = 'x'; documentElement.appendChild( element ); supports = getComputedStyle && getComputedStyle( element, '' ).pointerEvents === 'auto'; documentElement.removeChild( element ); return !!supports; } function boundingRect() { var div = document.createElement( "div" ); return typeof div.getBoundingClientRect !== "undefined"; } // non-UA-based IE version check by James Padolsey, modified by jdalton - from http://gist.github.com/527683 // allows for inclusion of IE 6+, including Windows Mobile 7 $.extend( $.mobile, { browser: {} } ); $.mobile.browser.ie = (function() { var v = 3, div = document.createElement( "div" ), a = div.all || []; do { div.innerHTML = "<!--[if gt IE " + ( ++v ) + "]><br><![endif]-->"; } while( a[0] ); return v > 4 ? v : !v; })(); $.extend( $.support, { cssTransitions: "WebKitTransitionEvent" in window || validStyle( 'transition', 'height 100ms linear' ) && !opera, pushState: "pushState" in history && "replaceState" in history, mediaquery: $.mobile.media( "only all" ), cssPseudoElement: !!propExists( "content" ), touchOverflow: !!propExists( "overflowScrolling" ), cssTransform3d: transform3dTest(), boxShadow: !!propExists( "boxShadow" ) && !bb, scrollTop: ( "pageXOffset" in window || "scrollTop" in document.documentElement || "scrollTop" in fakeBody[ 0 ] ) && !webos && !operamini, dynamicBaseTag: baseTagTest(), cssPointerEvents: cssPointerEventsTest(), boundingRect: boundingRect() }); fakeBody.remove(); // $.mobile.ajaxBlacklist is used to override ajaxEnabled on platforms that have known conflicts with hash history updates (BB5, Symbian) // or that generally work better browsing in regular http for full page refreshes (Opera Mini) // Note: This detection below is used as a last resort. // We recommend only using these detection methods when all other more reliable/forward-looking approaches are not possible var nokiaLTE7_3 = (function() { var ua = window.navigator.userAgent; //The following is an attempt to match Nokia browsers that are running Symbian/s60, with webkit, version 7.3 or older return ua.indexOf( "Nokia" ) > -1 && ( ua.indexOf( "Symbian/3" ) > -1 || ua.indexOf( "Series60/5" ) > -1 ) && ua.indexOf( "AppleWebKit" ) > -1 && ua.match( /(BrowserNG|NokiaBrowser)\/7\.[0-3]/ ); })(); // Support conditions that must be met in order to proceed // default enhanced qualifications are media query support OR IE 7+ $.mobile.gradeA = function() { return ( $.support.mediaquery || $.mobile.browser.ie && $.mobile.browser.ie >= 7 ) && ( $.support.boundingRect || $.fn.jquery.match(/1\.[0-7+]\.[0-9+]?/) !== null ); }; $.mobile.ajaxBlacklist = // BlackBerry browsers, pre-webkit window.blackberry && !window.WebKitPoint || // Opera Mini operamini || // Symbian webkits pre 7.3 nokiaLTE7_3; // Lastly, this workaround is the only way we've found so far to get pre 7.3 Symbian webkit devices // to render the stylesheets when they're referenced before this script, as we'd recommend doing. // This simply reappends the CSS in place, which for some reason makes it apply if ( nokiaLTE7_3 ) { $(function() { $( "head link[rel='stylesheet']" ).attr( "rel", "alternate stylesheet" ).attr( "rel", "stylesheet" ); }); } // For ruling out shadows via css if ( !$.support.boxShadow ) { $( "html" ).addClass( "ui-mobile-nosupport-boxshadow" ); } })( jQuery ); (function( $, undefined ) { $.widget( "mobile.page", $.mobile.widget, { options: { theme: "c", domCache: false, keepNativeDefault: ":jqmData(role='none'), :jqmData(role='nojs')" }, _create: function() { var self = this; // if false is returned by the callbacks do not create the page if ( self._trigger( "beforecreate" ) === false ) { return false; } self.element .attr( "tabindex", "0" ) .addClass( "ui-page ui-body-" + self.options.theme ) .bind( "pagebeforehide", function() { self.removeContainerBackground(); } ) .bind( "pagebeforeshow", function() { self.setContainerBackground(); } ); }, removeContainerBackground: function() { $.mobile.pageContainer.removeClass( "ui-overlay-" + $.mobile.getInheritedTheme( this.element.parent() ) ); }, // set the page container background to the page theme setContainerBackground: function( theme ) { if ( this.options.theme ) { $.mobile.pageContainer.addClass( "ui-overlay-" + ( theme || this.options.theme ) ); } }, keepNativeSelector: function() { var options = this.options, keepNativeDefined = options.keepNative && $.trim( options.keepNative ); if ( keepNativeDefined && options.keepNative !== options.keepNativeDefault ) { return [options.keepNative, options.keepNativeDefault].join( ", " ); } return options.keepNativeDefault; } }); })( jQuery ); // Script: jQuery hashchange event // // *Version: 1.3, Last updated: 7/21/2010* // // Project Home - http://benalman.com/projects/jquery-hashchange-plugin/ // GitHub - http://github.com/cowboy/jquery-hashchange/ // Source - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js // (Minified) - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (0.8kb gzipped) // // About: License // // Copyright (c) 2010 "Cowboy" Ben Alman, // Dual licensed under the MIT and GPL licenses. // http://benalman.com/about/license/ // // About: Examples // // These working examples, complete with fully commented code, illustrate a few // ways in which this plugin can be used. // // hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/ // document.domain - http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/ // // About: Support and Testing // // Information about what version or versions of jQuery this plugin has been // tested with, what browsers it has been tested in, and where the unit tests // reside (so you can test it yourself). // // jQuery Versions - 1.2.6, 1.3.2, 1.4.1, 1.4.2 // Browsers Tested - Internet Explorer 6-8, Firefox 2-4, Chrome 5-6, Safari 3.2-5, // Opera 9.6-10.60, iPhone 3.1, Android 1.6-2.2, BlackBerry 4.6-5. // Unit Tests - http://benalman.com/code/projects/jquery-hashchange/unit/ // // About: Known issues // // While this jQuery hashchange event implementation is quite stable and // robust, there are a few unfortunate browser bugs surrounding expected // hashchange event-based behaviors, independent of any JavaScript // window.onhashchange abstraction. See the following examples for more // information: // // Chrome: Back Button - http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/ // Firefox: Remote XMLHttpRequest - http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/ // WebKit: Back Button in an Iframe - http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/ // Safari: Back Button from a different domain - http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/ // // Also note that should a browser natively support the window.onhashchange // event, but not report that it does, the fallback polling loop will be used. // // About: Release History // // 1.3 - (7/21/2010) Reorganized IE6/7 Iframe code to make it more // "removable" for mobile-only development. Added IE6/7 document.title // support. Attempted to make Iframe as hidden as possible by using // techniques from http://www.paciellogroup.com/blog/?p=604. Added // support for the "shortcut" format $(window).hashchange( fn ) and // $(window).hashchange() like jQuery provides for built-in events. // Renamed jQuery.hashchangeDelay to <jQuery.fn.hashchange.delay> and // lowered its default value to 50. Added <jQuery.fn.hashchange.domain> // and <jQuery.fn.hashchange.src> properties plus document-domain.html // file to address access denied issues when setting document.domain in // IE6/7. // 1.2 - (2/11/2010) Fixed a bug where coming back to a page using this plugin // from a page on another domain would cause an error in Safari 4. Also, // IE6/7 Iframe is now inserted after the body (this actually works), // which prevents the page from scrolling when the event is first bound. // Event can also now be bound before DOM ready, but it won't be usable // before then in IE6/7. // 1.1 - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug // where browser version is incorrectly reported as 8.0, despite // inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag. // 1.0 - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special // window.onhashchange functionality into a separate plugin for users // who want just the basic event & back button support, without all the // extra awesomeness that BBQ provides. This plugin will be included as // part of jQuery BBQ, but also be available separately. (function( $, window, undefined ) { // Reused string. var str_hashchange = 'hashchange', // Method / object references. doc = document, fake_onhashchange, special = $.event.special, // Does the browser support window.onhashchange? Note that IE8 running in // IE7 compatibility mode reports true for 'onhashchange' in window, even // though the event isn't supported, so also test document.documentMode. doc_mode = doc.documentMode, supports_onhashchange = 'on' + str_hashchange in window && ( doc_mode === undefined || doc_mode > 7 ); // Get location.hash (or what you'd expect location.hash to be) sans any // leading #. Thanks for making this necessary, Firefox! function get_fragment( url ) { url = url || location.href; return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' ); }; // Method: jQuery.fn.hashchange // // Bind a handler to the window.onhashchange event or trigger all bound // window.onhashchange event handlers. This behavior is consistent with // jQuery's built-in event handlers. // // Usage: // // > jQuery(window).hashchange( [ handler ] ); // // Arguments: // // handler - (Function) Optional handler to be bound to the hashchange // event. This is a "shortcut" for the more verbose form: // jQuery(window).bind( 'hashchange', handler ). If handler is omitted, // all bound window.onhashchange event handlers will be triggered. This // is a shortcut for the more verbose // jQuery(window).trigger( 'hashchange' ). These forms are described in // the <hashchange event> section. // // Returns: // // (jQuery) The initial jQuery collection of elements. // Allow the "shortcut" format $(elem).hashchange( fn ) for binding and // $(elem).hashchange() for triggering, like jQuery does for built-in events. $.fn[ str_hashchange ] = function( fn ) { return fn ? this.bind( str_hashchange, fn ) : this.trigger( str_hashchange ); }; // Property: jQuery.fn.hashchange.delay // // The numeric interval (in milliseconds) at which the <hashchange event> // polling loop executes. Defaults to 50. // Property: jQuery.fn.hashchange.domain // // If you're setting document.domain in your JavaScript, and you want hash // history to work in IE6/7, not only must this property be set, but you must // also set document.domain BEFORE jQuery is loaded into the page. This // property is only applicable if you are supporting IE6/7 (or IE8 operating // in "IE7 compatibility" mode). // // In addition, the <jQuery.fn.hashchange.src> property must be set to the // path of the included "document-domain.html" file, which can be renamed or // modified if necessary (note that the document.domain specified must be the // same in both your main JavaScript as well as in this file). // // Usage: // // jQuery.fn.hashchange.domain = document.domain; // Property: jQuery.fn.hashchange.src // // If, for some reason, you need to specify an Iframe src file (for example, // when setting document.domain as in <jQuery.fn.hashchange.domain>), you can // do so using this property. Note that when using this property, history // won't be recorded in IE6/7 until the Iframe src file loads. This property // is only applicable if you are supporting IE6/7 (or IE8 operating in "IE7 // compatibility" mode). // // Usage: // // jQuery.fn.hashchange.src = 'path/to/file.html'; $.fn[ str_hashchange ].delay = 50; /* $.fn[ str_hashchange ].domain = null; $.fn[ str_hashchange ].src = null; */ // Event: hashchange event // // Fired when location.hash changes. In browsers that support it, the native // HTML5 window.onhashchange event is used, otherwise a polling loop is // initialized, running every <jQuery.fn.hashchange.delay> milliseconds to // see if the hash has changed. In IE6/7 (and IE8 operating in "IE7 // compatibility" mode), a hidden Iframe is created to allow the back button // and hash-based history to work. // // Usage as described in <jQuery.fn.hashchange>: // // > // Bind an event handler. // > jQuery(window).hashchange( function(e) { // > var hash = location.hash; // > ... // > }); // > // > // Manually trigger the event handler. // > jQuery(window).hashchange(); // // A more verbose usage that allows for event namespacing: // // > // Bind an event handler. // > jQuery(window).bind( 'hashchange', function(e) { // > var hash = location.hash; // > ... // > }); // > // > // Manually trigger the event handler. // > jQuery(window).trigger( 'hashchange' ); // // Additional Notes: // // * The polling loop and Iframe are not created until at least one handler // is actually bound to the 'hashchange' event. // * If you need the bound handler(s) to execute immediately, in cases where // a location.hash exists on page load, via bookmark or page refresh for // example, use jQuery(window).hashchange() or the more verbose // jQuery(window).trigger( 'hashchange' ). // * The event can be bound before DOM ready, but since it won't be usable // before then in IE6/7 (due to the necessary Iframe), recommended usage is // to bind it inside a DOM ready handler. // Override existing $.event.special.hashchange methods (allowing this plugin // to be defined after jQuery BBQ in BBQ's source code). special[ str_hashchange ] = $.extend( special[ str_hashchange ], { // Called only when the first 'hashchange' event is bound to window. setup: function() { // If window.onhashchange is supported natively, there's nothing to do.. if ( supports_onhashchange ) { return false; } // Otherwise, we need to create our own. And we don't want to call this // until the user binds to the event, just in case they never do, since it // will create a polling loop and possibly even a hidden Iframe. $( fake_onhashchange.start ); }, // Called only when the last 'hashchange' event is unbound from window. teardown: function() { // If window.onhashchange is supported natively, there's nothing to do.. if ( supports_onhashchange ) { return false; } // Otherwise, we need to stop ours (if possible). $( fake_onhashchange.stop ); } }); // fake_onhashchange does all the work of triggering the window.onhashchange // event for browsers that don't natively support it, including creating a // polling loop to watch for hash changes and in IE 6/7 creating a hidden // Iframe to enable back and forward. fake_onhashchange = (function() { var self = {}, timeout_id, // Remember the initial hash so it doesn't get triggered immediately. last_hash = get_fragment(), fn_retval = function( val ) { return val; }, history_set = fn_retval, history_get = fn_retval; // Start the polling loop. self.start = function() { timeout_id || poll(); }; // Stop the polling loop. self.stop = function() { timeout_id && clearTimeout( timeout_id ); timeout_id = undefined; }; // This polling loop checks every $.fn.hashchange.delay milliseconds to see // if location.hash has changed, and triggers the 'hashchange' event on // window when necessary. function poll() { var hash = get_fragment(), history_hash = history_get( last_hash ); if ( hash !== last_hash ) { history_set( last_hash = hash, history_hash ); $(window).trigger( str_hashchange ); } else if ( history_hash !== last_hash ) { location.href = location.href.replace( /#.*/, '' ) + history_hash; } timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay ); }; // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv $.browser.msie && !supports_onhashchange && (function() { // Not only do IE6/7 need the "magical" Iframe treatment, but so does IE8 // when running in "IE7 compatibility" mode. var iframe, iframe_src; // When the event is bound and polling starts in IE 6/7, create a hidden // Iframe for history handling. self.start = function() { if ( !iframe ) { iframe_src = $.fn[ str_hashchange ].src; iframe_src = iframe_src && iframe_src + get_fragment(); // Create hidden Iframe. Attempt to make Iframe as hidden as possible // by using techniques from http://www.paciellogroup.com/blog/?p=604. iframe = $('<iframe tabindex="-1" title="empty"/>').hide() // When Iframe has completely loaded, initialize the history and // start polling. .one( 'load', function() { iframe_src || history_set( get_fragment() ); poll(); }) // Load Iframe src if specified, otherwise nothing. .attr( 'src', iframe_src || 'javascript:0' ) // Append Iframe after the end of the body to prevent unnecessary // initial page scrolling (yes, this works). .insertAfter( 'body' )[0].contentWindow; // Whenever `document.title` changes, update the Iframe's title to // prettify the back/next history menu entries. Since IE sometimes // errors with "Unspecified error" the very first time this is set // (yes, very useful) wrap this with a try/catch block. doc.onpropertychange = function() { try { if ( event.propertyName === 'title' ) { iframe.document.title = doc.title; } } catch(e) {} }; } }; // Override the "stop" method since an IE6/7 Iframe was created. Even // if there are no longer any bound event handlers, the polling loop // is still necessary for back/next to work at all! self.stop = fn_retval; // Get history by looking at the hidden Iframe's location.hash. history_get = function() { return get_fragment( iframe.location.href ); }; // Set a new history item by opening and then closing the Iframe // document, *then* setting its location.hash. If document.domain has // been set, update that as well. history_set = function( hash, history_hash ) { var iframe_doc = iframe.document, domain = $.fn[ str_hashchange ].domain; if ( hash !== history_hash ) { // Update Iframe with any initial `document.title` that might be set. iframe_doc.title = doc.title; // Opening the Iframe's document after it has been closed is what // actually adds a history entry. iframe_doc.open(); // Set document.domain for the Iframe document as well, if necessary. domain && iframe_doc.write( '<script>document.domain="' + domain + '"</script>' ); iframe_doc.close(); // Update the Iframe's hash, for great justice. iframe.location.hash = hash; } }; })(); // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // ^^^^^^^^^^^^^^^^^^^ REMOVE IF NOT SUPPORTING IE6/7/8 ^^^^^^^^^^^^^^^^^^^ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ return self; })(); })(jQuery,this); (function( $, window, undefined ) { var createHandler = function( sequential ) { // Default to sequential if ( sequential === undefined ) { sequential = true; } return function( name, reverse, $to, $from ) { var deferred = new $.Deferred(), reverseClass = reverse ? " reverse" : "", active = $.mobile.urlHistory.getActive(), toScroll = active.lastScroll || $.mobile.defaultHomeScroll, screenHeight = $.mobile.getScreenHeight(), maxTransitionOverride = $.mobile.maxTransitionWidth !== false && $( window ).width() > $.mobile.maxTransitionWidth, none = !$.support.cssTransitions || maxTransitionOverride || !name || name === "none" || Math.max( $( window ).scrollTop(), toScroll ) > $.mobile.getMaxScrollForTransition(), toPreClass = " ui-page-pre-in", toggleViewportClass = function() { $.mobile.pageContainer.toggleClass( "ui-mobile-viewport-transitioning viewport-" + name ); }, scrollPage = function() { // By using scrollTo instead of silentScroll, we can keep things better in order // Just to be precautios, disable scrollstart listening like silentScroll would $.event.special.scrollstart.enabled = false; window.scrollTo( 0, toScroll ); // reenable scrollstart listening like silentScroll would setTimeout( function() { $.event.special.scrollstart.enabled = true; }, 150 ); }, cleanFrom = function() { $from .removeClass( $.mobile.activePageClass + " out in reverse " + name ) .height( "" ); }, startOut = function() { // if it's not sequential, call the doneOut transition to start the TO page animating in simultaneously if ( !sequential ) { doneOut(); } else { $from.animationComplete( doneOut ); } // Set the from page's height and start it transitioning out // Note: setting an explicit height helps eliminate tiling in the transitions $from .height( screenHeight + $( window ).scrollTop() ) .addClass( name + " out" + reverseClass ); }, doneOut = function() { if ( $from && sequential ) { cleanFrom(); } startIn(); }, startIn = function() { // Prevent flickering in phonegap container: see comments at #4024 regarding iOS $to.css( "z-index", -10 ); $to.addClass( $.mobile.activePageClass + toPreClass ); // Send focus to page as it is now display: block $.mobile.focusPage( $to ); // Set to page height $to.height( screenHeight + toScroll ); scrollPage(); // Restores visibility of the new page: added together with $to.css( "z-index", -10 ); $to.css( "z-index", "" ); if ( !none ) { $to.animationComplete( doneIn ); } $to .removeClass( toPreClass ) .addClass( name + " in" + reverseClass ); if ( none ) { doneIn(); } }, doneIn = function() { if ( !sequential ) { if ( $from ) { cleanFrom(); } } $to .removeClass( "out in reverse " + name ) .height( "" ); toggleViewportClass(); // In some browsers (iOS5), 3D transitions block the ability to scroll to the desired location during transition // This ensures we jump to that spot after the fact, if we aren't there already. if ( $( window ).scrollTop() !== toScroll ) { scrollPage(); } deferred.resolve( name, reverse, $to, $from, true ); }; toggleViewportClass(); if ( $from && !none ) { startOut(); } else { doneOut(); } return deferred.promise(); }; }; // generate the handlers from the above var sequentialHandler = createHandler(), simultaneousHandler = createHandler( false ), defaultGetMaxScrollForTransition = function() { return $.mobile.getScreenHeight() * 3; }; // Make our transition handler the public default. $.mobile.defaultTransitionHandler = sequentialHandler; //transition handler dictionary for 3rd party transitions $.mobile.transitionHandlers = { "default": $.mobile.defaultTransitionHandler, "sequential": sequentialHandler, "simultaneous": simultaneousHandler }; $.mobile.transitionFallbacks = {}; // If transition is defined, check if css 3D transforms are supported, and if not, if a fallback is specified $.mobile._maybeDegradeTransition = function( transition ) { if ( transition && !$.support.cssTransform3d && $.mobile.transitionFallbacks[ transition ] ) { transition = $.mobile.transitionFallbacks[ transition ]; } return transition; }; // Set the getMaxScrollForTransition to default if no implementation was set by user $.mobile.getMaxScrollForTransition = $.mobile.getMaxScrollForTransition || defaultGetMaxScrollForTransition; })( jQuery, this ); (function( $, undefined ) { //define vars for interal use var $window = $( window ), $html = $( 'html' ), $head = $( 'head' ), //url path helpers for use in relative url management path = { // This scary looking regular expression parses an absolute URL or its relative // variants (protocol, site, document, query, and hash), into the various // components (protocol, host, path, query, fragment, etc that make up the // URL as well as some other commonly used sub-parts. When used with RegExp.exec() // or String.match, it parses the URL into a results array that looks like this: // // [0]: http://jblas:password@mycompany.com:8080/mail/inbox?msg=1234&type=unread#msg-content // [1]: http://jblas:password@mycompany.com:8080/mail/inbox?msg=1234&type=unread // [2]: http://jblas:password@mycompany.com:8080/mail/inbox // [3]: http://jblas:password@mycompany.com:8080 // [4]: http: // [5]: // // [6]: jblas:password@mycompany.com:8080 // [7]: jblas:password // [8]: jblas // [9]: password // [10]: mycompany.com:8080 // [11]: mycompany.com // [12]: 8080 // [13]: /mail/inbox // [14]: /mail/ // [15]: inbox // [16]: ?msg=1234&type=unread // [17]: #msg-content // urlParseRE: /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/, // Abstraction to address xss (Issue #4787) by removing the authority in // browsers that auto decode it. All references to location.href should be // replaced with a call to this method so that it can be dealt with properly here getLocation: function( url ) { var uri = url ? this.parseUrl( url ) : location, hash = this.parseUrl( url || location.href ).hash; // mimic the browser with an empty string when the hash is empty hash = hash === "#" ? "" : hash; // Make sure to parse the url or the location object for the hash because using location.hash // is autodecoded in firefox, the rest of the url should be from the object (location unless // we're testing) to avoid the inclusion of the authority return uri.protocol + "//" + uri.host + uri.pathname + uri.search + hash; }, parseLocation: function() { return this.parseUrl( this.getLocation() ); }, //Parse a URL into a structure that allows easy access to //all of the URL components by name. parseUrl: function( url ) { // If we're passed an object, we'll assume that it is // a parsed url object and just return it back to the caller. if ( $.type( url ) === "object" ) { return url; } var matches = path.urlParseRE.exec( url || "" ) || []; // Create an object that allows the caller to access the sub-matches // by name. Note that IE returns an empty string instead of undefined, // like all other browsers do, so we normalize everything so its consistent // no matter what browser we're running on. return { href: matches[ 0 ] || "", hrefNoHash: matches[ 1 ] || "", hrefNoSearch: matches[ 2 ] || "", domain: matches[ 3 ] || "", protocol: matches[ 4 ] || "", doubleSlash: matches[ 5 ] || "", authority: matches[ 6 ] || "", username: matches[ 8 ] || "", password: matches[ 9 ] || "", host: matches[ 10 ] || "", hostname: matches[ 11 ] || "", port: matches[ 12 ] || "", pathname: matches[ 13 ] || "", directory: matches[ 14 ] || "", filename: matches[ 15 ] || "", search: matches[ 16 ] || "", hash: matches[ 17 ] || "" }; }, //Turn relPath into an asbolute path. absPath is //an optional absolute path which describes what //relPath is relative to. makePathAbsolute: function( relPath, absPath ) { if ( relPath && relPath.charAt( 0 ) === "/" ) { return relPath; } relPath = relPath || ""; absPath = absPath ? absPath.replace( /^\/|(\/[^\/]*|[^\/]+)$/g, "" ) : ""; var absStack = absPath ? absPath.split( "/" ) : [], relStack = relPath.split( "/" ); for ( var i = 0; i < relStack.length; i++ ) { var d = relStack[ i ]; switch ( d ) { case ".": break; case "..": if ( absStack.length ) { absStack.pop(); } break; default: absStack.push( d ); break; } } return "/" + absStack.join( "/" ); }, //Returns true if both urls have the same domain. isSameDomain: function( absUrl1, absUrl2 ) { return path.parseUrl( absUrl1 ).domain === path.parseUrl( absUrl2 ).domain; }, //Returns true for any relative variant. isRelativeUrl: function( url ) { // All relative Url variants have one thing in common, no protocol. return path.parseUrl( url ).protocol === ""; }, //Returns true for an absolute url. isAbsoluteUrl: function( url ) { return path.parseUrl( url ).protocol !== ""; }, //Turn the specified realtive URL into an absolute one. This function //can handle all relative variants (protocol, site, document, query, fragment). makeUrlAbsolute: function( relUrl, absUrl ) { if ( !path.isRelativeUrl( relUrl ) ) { return relUrl; } if ( absUrl === undefined ) { absUrl = documentBase; } var relObj = path.parseUrl( relUrl ), absObj = path.parseUrl( absUrl ), protocol = relObj.protocol || absObj.protocol, doubleSlash = relObj.protocol ? relObj.doubleSlash : ( relObj.doubleSlash || absObj.doubleSlash ), authority = relObj.authority || absObj.authority, hasPath = relObj.pathname !== "", pathname = path.makePathAbsolute( relObj.pathname || absObj.filename, absObj.pathname ), search = relObj.search || ( !hasPath && absObj.search ) || "", hash = relObj.hash; return protocol + doubleSlash + authority + pathname + search + hash; }, //Add search (aka query) params to the specified url. addSearchParams: function( url, params ) { var u = path.parseUrl( url ), p = ( typeof params === "object" ) ? $.param( params ) : params, s = u.search || "?"; return u.hrefNoSearch + s + ( s.charAt( s.length - 1 ) !== "?" ? "&" : "" ) + p + ( u.hash || "" ); }, convertUrlToDataUrl: function( absUrl ) { var u = path.parseUrl( absUrl ); if ( path.isEmbeddedPage( u ) ) { // For embedded pages, remove the dialog hash key as in getFilePath(), // otherwise the Data Url won't match the id of the embedded Page. return u.hash.split( dialogHashKey )[0].replace( /^#/, "" ); } else if ( path.isSameDomain( u, documentBase ) ) { return u.hrefNoHash.replace( documentBase.domain, "" ).split( dialogHashKey )[0]; } return window.decodeURIComponent(absUrl); }, //get path from current hash, or from a file path get: function( newPath ) { if ( newPath === undefined ) { newPath = path.parseLocation().hash; } return path.stripHash( newPath ).replace( /[^\/]*\.[^\/*]+$/, '' ); }, //return the substring of a filepath before the sub-page key, for making a server request getFilePath: function( path ) { var splitkey = '&' + $.mobile.subPageUrlKey; return path && path.split( splitkey )[0].split( dialogHashKey )[0]; }, //set location hash to path set: function( path ) { location.hash = path; }, //test if a given url (string) is a path //NOTE might be exceptionally naive isPath: function( url ) { return ( /\// ).test( url ); }, //return a url path with the window's location protocol/hostname/pathname removed clean: function( url ) { return url.replace( documentBase.domain, "" ); }, //just return the url without an initial # stripHash: function( url ) { return url.replace( /^#/, "" ); }, //remove the preceding hash, any query params, and dialog notations cleanHash: function( hash ) { return path.stripHash( hash.replace( /\?.*$/, "" ).replace( dialogHashKey, "" ) ); }, isHashValid: function( hash ) { return ( /^#[^#]+$/ ).test( hash ); }, //check whether a url is referencing the same domain, or an external domain or different protocol //could be mailto, etc isExternal: function( url ) { var u = path.parseUrl( url ); return u.protocol && u.domain !== documentUrl.domain ? true : false; }, hasProtocol: function( url ) { return ( /^(:?\w+:)/ ).test( url ); }, //check if the specified url refers to the first page in the main application document. isFirstPageUrl: function( url ) { // We only deal with absolute paths. var u = path.parseUrl( path.makeUrlAbsolute( url, documentBase ) ), // Does the url have the same path as the document? samePath = u.hrefNoHash === documentUrl.hrefNoHash || ( documentBaseDiffers && u.hrefNoHash === documentBase.hrefNoHash ), // Get the first page element. fp = $.mobile.firstPage, // Get the id of the first page element if it has one. fpId = fp && fp[0] ? fp[0].id : undefined; // The url refers to the first page if the path matches the document and // it either has no hash value, or the hash is exactly equal to the id of the // first page element. return samePath && ( !u.hash || u.hash === "#" || ( fpId && u.hash.replace( /^#/, "" ) === fpId ) ); }, isEmbeddedPage: function( url ) { var u = path.parseUrl( url ); //if the path is absolute, then we need to compare the url against //both the documentUrl and the documentBase. The main reason for this //is that links embedded within external documents will refer to the //application document, whereas links embedded within the application //document will be resolved against the document base. if ( u.protocol !== "" ) { return ( u.hash && ( u.hrefNoHash === documentUrl.hrefNoHash || ( documentBaseDiffers && u.hrefNoHash === documentBase.hrefNoHash ) ) ); } return ( /^#/ ).test( u.href ); }, // Some embedded browsers, like the web view in Phone Gap, allow cross-domain XHR // requests if the document doing the request was loaded via the file:// protocol. // This is usually to allow the application to "phone home" and fetch app specific // data. We normally let the browser handle external/cross-domain urls, but if the // allowCrossDomainPages option is true, we will allow cross-domain http/https // requests to go through our page loading logic. isPermittedCrossDomainRequest: function( docUrl, reqUrl ) { return $.mobile.allowCrossDomainPages && docUrl.protocol === "file:" && reqUrl.search( /^https?:/ ) !== -1; } }, //will be defined when a link is clicked and given an active class $activeClickedLink = null, //urlHistory is purely here to make guesses at whether the back or forward button was clicked //and provide an appropriate transition urlHistory = { // Array of pages that are visited during a single page load. // Each has a url and optional transition, title, and pageUrl (which represents the file path, in cases where URL is obscured, such as dialogs) stack: [], //maintain an index number for the active page in the stack activeIndex: 0, //get active getActive: function() { return urlHistory.stack[ urlHistory.activeIndex ]; }, getPrev: function() { return urlHistory.stack[ urlHistory.activeIndex - 1 ]; }, getNext: function() { return urlHistory.stack[ urlHistory.activeIndex + 1 ]; }, // addNew is used whenever a new page is added addNew: function( url, transition, title, pageUrl, role ) { //if there's forward history, wipe it if ( urlHistory.getNext() ) { urlHistory.clearForward(); } urlHistory.stack.push( {url : url, transition: transition, title: title, pageUrl: pageUrl, role: role } ); urlHistory.activeIndex = urlHistory.stack.length - 1; }, //wipe urls ahead of active index clearForward: function() { urlHistory.stack = urlHistory.stack.slice( 0, urlHistory.activeIndex + 1 ); }, directHashChange: function( opts ) { var back , forward, newActiveIndex, prev = this.getActive(); // check if url is in history and if it's ahead or behind current page $.each( urlHistory.stack, function( i, historyEntry ) { //if the url is in the stack, it's a forward or a back if ( decodeURIComponent( opts.currentUrl ) === decodeURIComponent( historyEntry.url ) ) { //define back and forward by whether url is older or newer than current page back = i < urlHistory.activeIndex; forward = !back; newActiveIndex = i; } }); // save new page index, null check to prevent falsey 0 result this.activeIndex = newActiveIndex !== undefined ? newActiveIndex : this.activeIndex; if ( back ) { ( opts.either || opts.isBack )( true ); } else if ( forward ) { ( opts.either || opts.isForward )( false ); } }, //disable hashchange event listener internally to ignore one change //toggled internally when location.hash is updated to match the url of a successful page load ignoreNextHashChange: false }, //define first selector to receive focus when a page is shown focusable = "[tabindex],a,button:visible,select:visible,input", //queue to hold simultanious page transitions pageTransitionQueue = [], //indicates whether or not page is in process of transitioning isPageTransitioning = false, //nonsense hash change key for dialogs, so they create a history entry dialogHashKey = "&ui-state=dialog", //existing base tag? $base = $head.children( "base" ), //tuck away the original document URL minus any fragment. documentUrl = path.parseLocation(), //if the document has an embedded base tag, documentBase is set to its //initial value. If a base tag does not exist, then we default to the documentUrl. documentBase = $base.length ? path.parseUrl( path.makeUrlAbsolute( $base.attr( "href" ), documentUrl.href ) ) : documentUrl, //cache the comparison once. documentBaseDiffers = ( documentUrl.hrefNoHash !== documentBase.hrefNoHash ), getScreenHeight = $.mobile.getScreenHeight; //base element management, defined depending on dynamic base tag support var base = $.support.dynamicBaseTag ? { //define base element, for use in routing asset urls that are referenced in Ajax-requested markup element: ( $base.length ? $base : $( "<base>", { href: documentBase.hrefNoHash } ).prependTo( $head ) ), //set the generated BASE element's href attribute to a new page's base path set: function( href ) { base.element.attr( "href", path.makeUrlAbsolute( href, documentBase ) ); }, //set the generated BASE element's href attribute to a new page's base path reset: function() { base.element.attr( "href", documentBase.hrefNoHash ); } } : undefined; /* internal utility functions */ // NOTE Issue #4950 Android phonegap doesn't navigate back properly // when a full page refresh has taken place. It appears that hashchange // and replacestate history alterations work fine but we need to support // both forms of history traversal in our code that uses backward history // movement $.mobile.back = function() { var nav = window.navigator; // if the setting is on and the navigator object is // available use the phonegap navigation capability if( this.phonegapNavigationEnabled && nav && nav.app && nav.app.backHistory ){ nav.app.backHistory(); } else { window.history.back(); } }; //direct focus to the page title, or otherwise first focusable element $.mobile.focusPage = function ( page ) { var autofocus = page.find( "[autofocus]" ), pageTitle = page.find( ".ui-title:eq(0)" ); if ( autofocus.length ) { autofocus.focus(); return; } if ( pageTitle.length ) { pageTitle.focus(); } else{ page.focus(); } }; //remove active classes after page transition or error function removeActiveLinkClass( forceRemoval ) { if ( !!$activeClickedLink && ( !$activeClickedLink.closest( "." + $.mobile.activePageClass ).length || forceRemoval ) ) { $activeClickedLink.removeClass( $.mobile.activeBtnClass ); } $activeClickedLink = null; } function releasePageTransitionLock() { isPageTransitioning = false; if ( pageTransitionQueue.length > 0 ) { $.mobile.changePage.apply( null, pageTransitionQueue.pop() ); } } // Save the last scroll distance per page, before it is hidden var setLastScrollEnabled = true, setLastScroll, delayedSetLastScroll; setLastScroll = function() { // this barrier prevents setting the scroll value based on the browser // scrolling the window based on a hashchange if ( !setLastScrollEnabled ) { return; } var active = $.mobile.urlHistory.getActive(); if ( active ) { var lastScroll = $window.scrollTop(); // Set active page's lastScroll prop. // If the location we're scrolling to is less than minScrollBack, let it go. active.lastScroll = lastScroll < $.mobile.minScrollBack ? $.mobile.defaultHomeScroll : lastScroll; } }; // bind to scrollstop to gather scroll position. The delay allows for the hashchange // event to fire and disable scroll recording in the case where the browser scrolls // to the hash targets location (sometimes the top of the page). once pagechange fires // getLastScroll is again permitted to operate delayedSetLastScroll = function() { setTimeout( setLastScroll, 100 ); }; // disable an scroll setting when a hashchange has been fired, this only works // because the recording of the scroll position is delayed for 100ms after // the browser might have changed the position because of the hashchange $window.bind( $.support.pushState ? "popstate" : "hashchange", function() { setLastScrollEnabled = false; }); // handle initial hashchange from chrome :( $window.one( $.support.pushState ? "popstate" : "hashchange", function() { setLastScrollEnabled = true; }); // wait until the mobile page container has been determined to bind to pagechange $window.one( "pagecontainercreate", function() { // once the page has changed, re-enable the scroll recording $.mobile.pageContainer.bind( "pagechange", function() { setLastScrollEnabled = true; // remove any binding that previously existed on the get scroll // which may or may not be different than the scroll element determined for // this page previously $window.unbind( "scrollstop", delayedSetLastScroll ); // determine and bind to the current scoll element which may be the window // or in the case of touch overflow the element with touch overflow $window.bind( "scrollstop", delayedSetLastScroll ); }); }); // bind to scrollstop for the first page as "pagechange" won't be fired in that case $window.bind( "scrollstop", delayedSetLastScroll ); // No-op implementation of transition degradation $.mobile._maybeDegradeTransition = $.mobile._maybeDegradeTransition || function( transition ) { return transition; }; //function for transitioning between two existing pages function transitionPages( toPage, fromPage, transition, reverse ) { if ( fromPage ) { //trigger before show/hide events fromPage.data( "page" )._trigger( "beforehide", null, { nextPage: toPage } ); } toPage.data( "page" )._trigger( "beforeshow", null, { prevPage: fromPage || $( "" ) } ); //clear page loader $.mobile.hidePageLoadingMsg(); transition = $.mobile._maybeDegradeTransition( transition ); //find the transition handler for the specified transition. If there //isn't one in our transitionHandlers dictionary, use the default one. //call the handler immediately to kick-off the transition. var th = $.mobile.transitionHandlers[ transition || "default" ] || $.mobile.defaultTransitionHandler, promise = th( transition, reverse, toPage, fromPage ); promise.done(function() { //trigger show/hide events if ( fromPage ) { fromPage.data( "page" )._trigger( "hide", null, { nextPage: toPage } ); } //trigger pageshow, define prevPage as either fromPage or empty jQuery obj toPage.data( "page" )._trigger( "show", null, { prevPage: fromPage || $( "" ) } ); }); return promise; } //simply set the active page's minimum height to screen height, depending on orientation function resetActivePageHeight() { var aPage = $( "." + $.mobile.activePageClass ), aPagePadT = parseFloat( aPage.css( "padding-top" ) ), aPagePadB = parseFloat( aPage.css( "padding-bottom" ) ), aPageBorderT = parseFloat( aPage.css( "border-top-width" ) ), aPageBorderB = parseFloat( aPage.css( "border-bottom-width" ) ); aPage.css( "min-height", getScreenHeight() - aPagePadT - aPagePadB - aPageBorderT - aPageBorderB ); } //shared page enhancements function enhancePage( $page, role ) { // If a role was specified, make sure the data-role attribute // on the page element is in sync. if ( role ) { $page.attr( "data-" + $.mobile.ns + "role", role ); } //run page plugin $page.page(); } /* exposed $.mobile methods */ //animation complete callback $.fn.animationComplete = function( callback ) { if ( $.support.cssTransitions ) { return $( this ).one( 'webkitAnimationEnd animationend', callback ); } else{ // defer execution for consistency between webkit/non webkit setTimeout( callback, 0 ); return $( this ); } }; //expose path object on $.mobile $.mobile.path = path; //expose base object on $.mobile $.mobile.base = base; //history stack $.mobile.urlHistory = urlHistory; $.mobile.dialogHashKey = dialogHashKey; //enable cross-domain page support $.mobile.allowCrossDomainPages = false; //return the original document url $.mobile.getDocumentUrl = function( asParsedObject ) { return asParsedObject ? $.extend( {}, documentUrl ) : documentUrl.href; }; //return the original document base url $.mobile.getDocumentBase = function( asParsedObject ) { return asParsedObject ? $.extend( {}, documentBase ) : documentBase.href; }; $.mobile._bindPageRemove = function() { var page = $( this ); // when dom caching is not enabled or the page is embedded bind to remove the page on hide if ( !page.data( "page" ).options.domCache && page.is( ":jqmData(external-page='true')" ) ) { page.bind( 'pagehide.remove', function() { var $this = $( this ), prEvent = new $.Event( "pageremove" ); $this.trigger( prEvent ); if ( !prEvent.isDefaultPrevented() ) { $this.removeWithDependents(); } }); } }; // Load a page into the DOM. $.mobile.loadPage = function( url, options ) { // This function uses deferred notifications to let callers // know when the page is done loading, or if an error has occurred. var deferred = $.Deferred(), // The default loadPage options with overrides specified by // the caller. settings = $.extend( {}, $.mobile.loadPage.defaults, options ), // The DOM element for the page after it has been loaded. page = null, // If the reloadPage option is true, and the page is already // in the DOM, dupCachedPage will be set to the page element // so that it can be removed after the new version of the // page is loaded off the network. dupCachedPage = null, // determine the current base url findBaseWithDefault = function() { var closestBase = ( $.mobile.activePage && getClosestBaseUrl( $.mobile.activePage ) ); return closestBase || documentBase.hrefNoHash; }, // The absolute version of the URL passed into the function. This // version of the URL may contain dialog/subpage params in it. absUrl = path.makeUrlAbsolute( url, findBaseWithDefault() ); // If the caller provided data, and we're using "get" request, // append the data to the URL. if ( settings.data && settings.type === "get" ) { absUrl = path.addSearchParams( absUrl, settings.data ); settings.data = undefined; } // If the caller is using a "post" request, reloadPage must be true if ( settings.data && settings.type === "post" ) { settings.reloadPage = true; } // The absolute version of the URL minus any dialog/subpage params. // In otherwords the real URL of the page to be loaded. var fileUrl = path.getFilePath( absUrl ), // The version of the Url actually stored in the data-url attribute of // the page. For embedded pages, it is just the id of the page. For pages // within the same domain as the document base, it is the site relative // path. For cross-domain pages (Phone Gap only) the entire absolute Url // used to load the page. dataUrl = path.convertUrlToDataUrl( absUrl ); // Make sure we have a pageContainer to work with. settings.pageContainer = settings.pageContainer || $.mobile.pageContainer; // Check to see if the page already exists in the DOM. // NOTE do _not_ use the :jqmData psuedo selector because parenthesis // are a valid url char and it breaks on the first occurence page = settings.pageContainer.children( "[data-" + $.mobile.ns +"url='" + dataUrl + "']" ); // If we failed to find the page, check to see if the url is a // reference to an embedded page. If so, it may have been dynamically // injected by a developer, in which case it would be lacking a data-url // attribute and in need of enhancement. if ( page.length === 0 && dataUrl && !path.isPath( dataUrl ) ) { page = settings.pageContainer.children( "#" + dataUrl ) .attr( "data-" + $.mobile.ns + "url", dataUrl ) .jqmData( "url", dataUrl ); } // If we failed to find a page in the DOM, check the URL to see if it // refers to the first page in the application. If it isn't a reference // to the first page and refers to non-existent embedded page, error out. if ( page.length === 0 ) { if ( $.mobile.firstPage && path.isFirstPageUrl( fileUrl ) ) { // Check to make sure our cached-first-page is actually // in the DOM. Some user deployed apps are pruning the first // page from the DOM for various reasons, we check for this // case here because we don't want a first-page with an id // falling through to the non-existent embedded page error // case. If the first-page is not in the DOM, then we let // things fall through to the ajax loading code below so // that it gets reloaded. if ( $.mobile.firstPage.parent().length ) { page = $( $.mobile.firstPage ); } } else if ( path.isEmbeddedPage( fileUrl ) ) { deferred.reject( absUrl, options ); return deferred.promise(); } } // If the page we are interested in is already in the DOM, // and the caller did not indicate that we should force a // reload of the file, we are done. Otherwise, track the // existing page as a duplicated. if ( page.length ) { if ( !settings.reloadPage ) { enhancePage( page, settings.role ); deferred.resolve( absUrl, options, page ); return deferred.promise(); } dupCachedPage = page; } var mpc = settings.pageContainer, pblEvent = new $.Event( "pagebeforeload" ), triggerData = { url: url, absUrl: absUrl, dataUrl: dataUrl, deferred: deferred, options: settings }; // Let listeners know we're about to load a page. mpc.trigger( pblEvent, triggerData ); // If the default behavior is prevented, stop here! if ( pblEvent.isDefaultPrevented() ) { return deferred.promise(); } if ( settings.showLoadMsg ) { // This configurable timeout allows cached pages a brief delay to load without showing a message var loadMsgDelay = setTimeout(function() { $.mobile.showPageLoadingMsg(); }, settings.loadMsgDelay ), // Shared logic for clearing timeout and removing message. hideMsg = function() { // Stop message show timer clearTimeout( loadMsgDelay ); // Hide loading message $.mobile.hidePageLoadingMsg(); }; } // Reset base to the default document base. if ( base ) { base.reset(); } if ( !( $.mobile.allowCrossDomainPages || path.isSameDomain( documentUrl, absUrl ) ) ) { deferred.reject( absUrl, options ); } else { // Load the new page. $.ajax({ url: fileUrl, type: settings.type, data: settings.data, dataType: "html", success: function( html, textStatus, xhr ) { //pre-parse html to check for a data-url, //use it as the new fileUrl, base path, etc var all = $( "<div></div>" ), //page title regexp newPageTitle = html.match( /<title[^>]*>([^<]*)/ ) && RegExp.$1, // TODO handle dialogs again pageElemRegex = new RegExp( "(<[^>]+\\bdata-" + $.mobile.ns + "role=[\"']?page[\"']?[^>]*>)" ), dataUrlRegex = new RegExp( "\\bdata-" + $.mobile.ns + "url=[\"']?([^\"'>]*)[\"']?" ); // data-url must be provided for the base tag so resource requests can be directed to the // correct url. loading into a temprorary element makes these requests immediately if ( pageElemRegex.test( html ) && RegExp.$1 && dataUrlRegex.test( RegExp.$1 ) && RegExp.$1 ) { url = fileUrl = path.getFilePath( $( "<div>" + RegExp.$1 + "</div>" ).text() ); } if ( base ) { base.set( fileUrl ); } //workaround to allow scripts to execute when included in page divs all.get( 0 ).innerHTML = html; page = all.find( ":jqmData(role='page'), :jqmData(role='dialog')" ).first(); //if page elem couldn't be found, create one and insert the body element's contents if ( !page.length ) { page = $( "<div data-" + $.mobile.ns + "role='page'>" + html.split( /<\/?body[^>]*>/gmi )[1] + "</div>" ); } if ( newPageTitle && !page.jqmData( "title" ) ) { if ( ~newPageTitle.indexOf( "&" ) ) { newPageTitle = $( "<div>" + newPageTitle + "</div>" ).text(); } page.jqmData( "title", newPageTitle ); } //rewrite src and href attrs to use a base url if ( !$.support.dynamicBaseTag ) { var newPath = path.get( fileUrl ); page.find( "[src], link[href], a[rel='external'], :jqmData(ajax='false'), a[target]" ).each(function() { var thisAttr = $( this ).is( '[href]' ) ? 'href' : $( this ).is( '[src]' ) ? 'src' : 'action', thisUrl = $( this ).attr( thisAttr ); // XXX_jblas: We need to fix this so that it removes the document // base URL, and then prepends with the new page URL. //if full path exists and is same, chop it - helps IE out thisUrl = thisUrl.replace( location.protocol + '//' + location.host + location.pathname, '' ); if ( !/^(\w+:|#|\/)/.test( thisUrl ) ) { $( this ).attr( thisAttr, newPath + thisUrl ); } }); } //append to page and enhance // TODO taging a page with external to make sure that embedded pages aren't removed // by the various page handling code is bad. Having page handling code in many // places is bad. Solutions post 1.0 page .attr( "data-" + $.mobile.ns + "url", path.convertUrlToDataUrl( fileUrl ) ) .attr( "data-" + $.mobile.ns + "external-page", true ) .appendTo( settings.pageContainer ); // wait for page creation to leverage options defined on widget page.one( 'pagecreate', $.mobile._bindPageRemove ); enhancePage( page, settings.role ); // Enhancing the page may result in new dialogs/sub pages being inserted // into the DOM. If the original absUrl refers to a sub-page, that is the // real page we are interested in. if ( absUrl.indexOf( "&" + $.mobile.subPageUrlKey ) > -1 ) { page = settings.pageContainer.children( "[data-" + $.mobile.ns +"url='" + dataUrl + "']" ); } //bind pageHide to removePage after it's hidden, if the page options specify to do so // Remove loading message. if ( settings.showLoadMsg ) { hideMsg(); } // Add the page reference and xhr to our triggerData. triggerData.xhr = xhr; triggerData.textStatus = textStatus; triggerData.page = page; // Let listeners know the page loaded successfully. settings.pageContainer.trigger( "pageload", triggerData ); deferred.resolve( absUrl, options, page, dupCachedPage ); }, error: function( xhr, textStatus, errorThrown ) { //set base back to current path if ( base ) { base.set( path.get() ); } // Add error info to our triggerData. triggerData.xhr = xhr; triggerData.textStatus = textStatus; triggerData.errorThrown = errorThrown; var plfEvent = new $.Event( "pageloadfailed" ); // Let listeners know the page load failed. settings.pageContainer.trigger( plfEvent, triggerData ); // If the default behavior is prevented, stop here! // Note that it is the responsibility of the listener/handler // that called preventDefault(), to resolve/reject the // deferred object within the triggerData. if ( plfEvent.isDefaultPrevented() ) { return; } // Remove loading message. if ( settings.showLoadMsg ) { // Remove loading message. hideMsg(); // show error message $.mobile.showPageLoadingMsg( $.mobile.pageLoadErrorMessageTheme, $.mobile.pageLoadErrorMessage, true ); // hide after delay setTimeout( $.mobile.hidePageLoadingMsg, 1500 ); } deferred.reject( absUrl, options ); } }); } return deferred.promise(); }; $.mobile.loadPage.defaults = { type: "get", data: undefined, reloadPage: false, role: undefined, // By default we rely on the role defined by the @data-role attribute. showLoadMsg: false, pageContainer: undefined, loadMsgDelay: 50 // This delay allows loads that pull from browser cache to occur without showing the loading message. }; // Show a specific page in the page container. $.mobile.changePage = function( toPage, options ) { // If we are in the midst of a transition, queue the current request. // We'll call changePage() once we're done with the current transition to // service the request. if ( isPageTransitioning ) { pageTransitionQueue.unshift( arguments ); return; } var settings = $.extend( {}, $.mobile.changePage.defaults, options ); // Make sure we have a pageContainer to work with. settings.pageContainer = settings.pageContainer || $.mobile.pageContainer; // Make sure we have a fromPage. settings.fromPage = settings.fromPage || $.mobile.activePage; var mpc = settings.pageContainer, pbcEvent = new $.Event( "pagebeforechange" ), triggerData = { toPage: toPage, options: settings }; // Let listeners know we're about to change the current page. mpc.trigger( pbcEvent, triggerData ); // If the default behavior is prevented, stop here! if ( pbcEvent.isDefaultPrevented() ) { return; } // We allow "pagebeforechange" observers to modify the toPage in the trigger // data to allow for redirects. Make sure our toPage is updated. toPage = triggerData.toPage; // Set the isPageTransitioning flag to prevent any requests from // entering this method while we are in the midst of loading a page // or transitioning. isPageTransitioning = true; // If the caller passed us a url, call loadPage() // to make sure it is loaded into the DOM. We'll listen // to the promise object it returns so we know when // it is done loading or if an error ocurred. if ( typeof toPage === "string" ) { $.mobile.loadPage( toPage, settings ) .done(function( url, options, newPage, dupCachedPage ) { isPageTransitioning = false; options.duplicateCachedPage = dupCachedPage; $.mobile.changePage( newPage, options ); }) .fail(function( url, options ) { isPageTransitioning = false; //clear out the active button state removeActiveLinkClass( true ); //release transition lock so navigation is free again releasePageTransitionLock(); settings.pageContainer.trigger( "pagechangefailed", triggerData ); }); return; } // If we are going to the first-page of the application, we need to make // sure settings.dataUrl is set to the application document url. This allows // us to avoid generating a document url with an id hash in the case where the // first-page of the document has an id attribute specified. if ( toPage[ 0 ] === $.mobile.firstPage[ 0 ] && !settings.dataUrl ) { settings.dataUrl = documentUrl.hrefNoHash; } // The caller passed us a real page DOM element. Update our // internal state and then trigger a transition to the page. var fromPage = settings.fromPage, url = ( settings.dataUrl && path.convertUrlToDataUrl( settings.dataUrl ) ) || toPage.jqmData( "url" ), // The pageUrl var is usually the same as url, except when url is obscured as a dialog url. pageUrl always contains the file path pageUrl = url, fileUrl = path.getFilePath( url ), active = urlHistory.getActive(), activeIsInitialPage = urlHistory.activeIndex === 0, historyDir = 0, pageTitle = document.title, isDialog = settings.role === "dialog" || toPage.jqmData( "role" ) === "dialog"; // By default, we prevent changePage requests when the fromPage and toPage // are the same element, but folks that generate content manually/dynamically // and reuse pages want to be able to transition to the same page. To allow // this, they will need to change the default value of allowSamePageTransition // to true, *OR*, pass it in as an option when they manually call changePage(). // It should be noted that our default transition animations assume that the // formPage and toPage are different elements, so they may behave unexpectedly. // It is up to the developer that turns on the allowSamePageTransitiona option // to either turn off transition animations, or make sure that an appropriate // animation transition is used. if ( fromPage && fromPage[0] === toPage[0] && !settings.allowSamePageTransition ) { isPageTransitioning = false; mpc.trigger( "pagechange", triggerData ); // Even if there is no page change to be done, we should keep the urlHistory in sync with the hash changes if ( settings.fromHashChange ) { urlHistory.directHashChange({ currentUrl: url, isBack: function() {}, isForward: function() {} }); } return; } // We need to make sure the page we are given has already been enhanced. enhancePage( toPage, settings.role ); // If the changePage request was sent from a hashChange event, check to see if the // page is already within the urlHistory stack. If so, we'll assume the user hit // the forward/back button and will try to match the transition accordingly. if ( settings.fromHashChange ) { urlHistory.directHashChange({ currentUrl: url, isBack: function() { historyDir = -1; }, isForward: function() { historyDir = 1; } }); } // Kill the keyboard. // XXX_jblas: We need to stop crawling the entire document to kill focus. Instead, // we should be tracking focus with a delegate() handler so we already have // the element in hand at this point. // Wrap this in a try/catch block since IE9 throw "Unspecified error" if document.activeElement // is undefined when we are in an IFrame. try { if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== 'body' ) { $( document.activeElement ).blur(); } else { $( "input:focus, textarea:focus, select:focus" ).blur(); } } catch( e ) {} // Record whether we are at a place in history where a dialog used to be - if so, do not add a new history entry and do not change the hash either var alreadyThere = false; // If we're displaying the page as a dialog, we don't want the url // for the dialog content to be used in the hash. Instead, we want // to append the dialogHashKey to the url of the current page. if ( isDialog && active ) { // on the initial page load active.url is undefined and in that case should // be an empty string. Moving the undefined -> empty string back into // urlHistory.addNew seemed imprudent given undefined better represents // the url state // If we are at a place in history that once belonged to a dialog, reuse // this state without adding to urlHistory and without modifying the hash. // However, if a dialog is already displayed at this point, and we're // about to display another dialog, then we must add another hash and // history entry on top so that one may navigate back to the original dialog if ( active.url.indexOf( dialogHashKey ) > -1 && !$.mobile.activePage.is( ".ui-dialog" ) ) { settings.changeHash = false; alreadyThere = true; } // Normally, we tack on a dialog hash key, but if this is the location of a stale dialog, // we reuse the URL from the entry url = ( active.url || "" ) + ( alreadyThere ? "" : dialogHashKey ); // tack on another dialogHashKey if this is the same as the initial hash // this makes sure that a history entry is created for this dialog if ( urlHistory.activeIndex === 0 && url === urlHistory.initialDst ) { url += dialogHashKey; } } // Set the location hash. if ( settings.changeHash !== false && url ) { //disable hash listening temporarily urlHistory.ignoreNextHashChange = true; //update hash and history path.set( url ); } // if title element wasn't found, try the page div data attr too // If this is a deep-link or a reload ( active === undefined ) then just use pageTitle var newPageTitle = ( !active )? pageTitle : toPage.jqmData( "title" ) || toPage.children( ":jqmData(role='header')" ).find( ".ui-title" ).getEncodedText(); if ( !!newPageTitle && pageTitle === document.title ) { pageTitle = newPageTitle; } if ( !toPage.jqmData( "title" ) ) { toPage.jqmData( "title", pageTitle ); } // Make sure we have a transition defined. settings.transition = settings.transition || ( ( historyDir && !activeIsInitialPage ) ? active.transition : undefined ) || ( isDialog ? $.mobile.defaultDialogTransition : $.mobile.defaultPageTransition ); //add page to history stack if it's not back or forward if ( !historyDir ) { // Overwrite the current entry if it's a leftover from a dialog if ( alreadyThere ) { urlHistory.activeIndex = Math.max( 0, urlHistory.activeIndex - 1 ); } urlHistory.addNew( url, settings.transition, pageTitle, pageUrl, settings.role ); } //set page title document.title = urlHistory.getActive().title; //set "toPage" as activePage $.mobile.activePage = toPage; // If we're navigating back in the URL history, set reverse accordingly. settings.reverse = settings.reverse || historyDir < 0; transitionPages( toPage, fromPage, settings.transition, settings.reverse ) .done(function( name, reverse, $to, $from, alreadyFocused ) { removeActiveLinkClass(); //if there's a duplicateCachedPage, remove it from the DOM now that it's hidden if ( settings.duplicateCachedPage ) { settings.duplicateCachedPage.remove(); } // Send focus to the newly shown page. Moved from promise .done binding in transitionPages // itself to avoid ie bug that reports offsetWidth as > 0 (core check for visibility) // despite visibility: hidden addresses issue #2965 // https://github.com/jquery/jquery-mobile/issues/2965 if ( !alreadyFocused ) { $.mobile.focusPage( toPage ); } releasePageTransitionLock(); // Let listeners know we're all done changing the current page. mpc.trigger( "pagechange", triggerData ); }); }; $.mobile.changePage.defaults = { transition: undefined, reverse: false, changeHash: true, fromHashChange: false, role: undefined, // By default we rely on the role defined by the @data-role attribute. duplicateCachedPage: undefined, pageContainer: undefined, showLoadMsg: true, //loading message shows by default when pages are being fetched during changePage dataUrl: undefined, fromPage: undefined, allowSamePageTransition: false }; /* Event Bindings - hashchange, submit, and click */ function findClosestLink( ele ) { while ( ele ) { // Look for the closest element with a nodeName of "a". // Note that we are checking if we have a valid nodeName // before attempting to access it. This is because the // node we get called with could have originated from within // an embedded SVG document where some symbol instance elements // don't have nodeName defined on them, or strings are of type // SVGAnimatedString. if ( ( typeof ele.nodeName === "string" ) && ele.nodeName.toLowerCase() === "a" ) { break; } ele = ele.parentNode; } return ele; } // The base URL for any given element depends on the page it resides in. function getClosestBaseUrl( ele ) { // Find the closest page and extract out its url. var url = $( ele ).closest( ".ui-page" ).jqmData( "url" ), base = documentBase.hrefNoHash; if ( !url || !path.isPath( url ) ) { url = base; } return path.makeUrlAbsolute( url, base); } //The following event bindings should be bound after mobileinit has been triggered //the following deferred is resolved in the init file $.mobile.navreadyDeferred = $.Deferred(); $.mobile.navreadyDeferred.done(function() { //bind to form submit events, handle with Ajax $( document ).delegate( "form", "submit", function( event ) { var $this = $( this ); if ( !$.mobile.ajaxEnabled || // test that the form is, itself, ajax false $this.is( ":jqmData(ajax='false')" ) || // test that $.mobile.ignoreContentEnabled is set and // the form or one of it's parents is ajax=false !$this.jqmHijackable().length ) { return; } var type = $this.attr( "method" ), target = $this.attr( "target" ), url = $this.attr( "action" ); // If no action is specified, browsers default to using the // URL of the document containing the form. Since we dynamically // pull in pages from external documents, the form should submit // to the URL for the source document of the page containing // the form. if ( !url ) { // Get the @data-url for the page containing the form. url = getClosestBaseUrl( $this ); if ( url === documentBase.hrefNoHash ) { // The url we got back matches the document base, // which means the page must be an internal/embedded page, // so default to using the actual document url as a browser // would. url = documentUrl.hrefNoSearch; } } url = path.makeUrlAbsolute( url, getClosestBaseUrl( $this ) ); if ( ( path.isExternal( url ) && !path.isPermittedCrossDomainRequest( documentUrl, url ) ) || target ) { return; } $.mobile.changePage( url, { type: type && type.length && type.toLowerCase() || "get", data: $this.serialize(), transition: $this.jqmData( "transition" ), reverse: $this.jqmData( "direction" ) === "reverse", reloadPage: true } ); event.preventDefault(); }); //add active state on vclick $( document ).bind( "vclick", function( event ) { // if this isn't a left click we don't care. Its important to note // that when the virtual event is generated it will create the which attr if ( event.which > 1 || !$.mobile.linkBindingEnabled ) { return; } var link = findClosestLink( event.target ); // split from the previous return logic to avoid find closest where possible // TODO teach $.mobile.hijackable to operate on raw dom elements so the link wrapping // can be avoided if ( !$( link ).jqmHijackable().length ) { return; } if ( link ) { if ( path.parseUrl( link.getAttribute( "href" ) || "#" ).hash !== "#" ) { removeActiveLinkClass( true ); $activeClickedLink = $( link ).closest( ".ui-btn" ).not( ".ui-disabled" ); $activeClickedLink.addClass( $.mobile.activeBtnClass ); } } }); // click routing - direct to HTTP or Ajax, accordingly $( document ).bind( "click", function( event ) { if ( !$.mobile.linkBindingEnabled ) { return; } var link = findClosestLink( event.target ), $link = $( link ), httpCleanup; // If there is no link associated with the click or its not a left // click we want to ignore the click // TODO teach $.mobile.hijackable to operate on raw dom elements so the link wrapping // can be avoided if ( !link || event.which > 1 || !$link.jqmHijackable().length ) { return; } //remove active link class if external (then it won't be there if you come back) httpCleanup = function() { window.setTimeout(function() { removeActiveLinkClass( true ); }, 200 ); }; //if there's a data-rel=back attr, go back in history if ( $link.is( ":jqmData(rel='back')" ) ) { $.mobile.back(); return false; } var baseUrl = getClosestBaseUrl( $link ), //get href, if defined, otherwise default to empty hash href = path.makeUrlAbsolute( $link.attr( "href" ) || "#", baseUrl ); //if ajax is disabled, exit early if ( !$.mobile.ajaxEnabled && !path.isEmbeddedPage( href ) ) { httpCleanup(); //use default click handling return; } // XXX_jblas: Ideally links to application pages should be specified as // an url to the application document with a hash that is either // the site relative path or id to the page. But some of the // internal code that dynamically generates sub-pages for nested // lists and select dialogs, just write a hash in the link they // create. This means the actual URL path is based on whatever // the current value of the base tag is at the time this code // is called. For now we are just assuming that any url with a // hash in it is an application page reference. if ( href.search( "#" ) !== -1 ) { href = href.replace( /[^#]*#/, "" ); if ( !href ) { //link was an empty hash meant purely //for interaction, so we ignore it. event.preventDefault(); return; } else if ( path.isPath( href ) ) { //we have apath so make it the href we want to load. href = path.makeUrlAbsolute( href, baseUrl ); } else { //we have a simple id so use the documentUrl as its base. href = path.makeUrlAbsolute( "#" + href, documentUrl.hrefNoHash ); } } // Should we handle this link, or let the browser deal with it? var useDefaultUrlHandling = $link.is( "[rel='external']" ) || $link.is( ":jqmData(ajax='false')" ) || $link.is( "[target]" ), // Some embedded browsers, like the web view in Phone Gap, allow cross-domain XHR // requests if the document doing the request was loaded via the file:// protocol. // This is usually to allow the application to "phone home" and fetch app specific // data. We normally let the browser handle external/cross-domain urls, but if the // allowCrossDomainPages option is true, we will allow cross-domain http/https // requests to go through our page loading logic. //check for protocol or rel and its not an embedded page //TODO overlap in logic from isExternal, rel=external check should be // moved into more comprehensive isExternalLink isExternal = useDefaultUrlHandling || ( path.isExternal( href ) && !path.isPermittedCrossDomainRequest( documentUrl, href ) ); if ( isExternal ) { httpCleanup(); //use default click handling return; } //use ajax var transition = $link.jqmData( "transition" ), reverse = $link.jqmData( "direction" ) === "reverse" || // deprecated - remove by 1.0 $link.jqmData( "back" ), //this may need to be more specific as we use data-rel more role = $link.attr( "data-" + $.mobile.ns + "rel" ) || undefined; $.mobile.changePage( href, { transition: transition, reverse: reverse, role: role, link: $link } ); event.preventDefault(); }); //prefetch pages when anchors with data-prefetch are encountered $( document ).delegate( ".ui-page", "pageshow.prefetch", function() { var urls = []; $( this ).find( "a:jqmData(prefetch)" ).each(function() { var $link = $( this ), url = $link.attr( "href" ); if ( url && $.inArray( url, urls ) === -1 ) { urls.push( url ); $.mobile.loadPage( url, { role: $link.attr( "data-" + $.mobile.ns + "rel" ) } ); } }); }); $.mobile._handleHashChange = function( hash ) { //find first page via hash var to = path.stripHash( hash ), //transition is false if it's the first page, undefined otherwise (and may be overridden by default) transition = $.mobile.urlHistory.stack.length === 0 ? "none" : undefined, // "navigate" event fired to allow others to take advantage of the more robust hashchange handling navEvent = new $.Event( "navigate" ), // default options for the changPage calls made after examining the current state // of the page and the hash changePageOptions = { transition: transition, changeHash: false, fromHashChange: true }; if ( 0 === urlHistory.stack.length ) { urlHistory.initialDst = to; } // We should probably fire the "navigate" event from those places that make calls to _handleHashChange, // and have _handleHashChange hook into the "navigate" event instead of triggering it here $.mobile.pageContainer.trigger( navEvent ); if ( navEvent.isDefaultPrevented() ) { return; } //if listening is disabled (either globally or temporarily), or it's a dialog hash if ( !$.mobile.hashListeningEnabled || urlHistory.ignoreNextHashChange ) { urlHistory.ignoreNextHashChange = false; return; } // special case for dialogs if ( urlHistory.stack.length > 1 && to.indexOf( dialogHashKey ) > -1 && urlHistory.initialDst !== to ) { // If current active page is not a dialog skip the dialog and continue // in the same direction if ( !$.mobile.activePage.is( ".ui-dialog" ) ) { //determine if we're heading forward or backward and continue accordingly past //the current dialog urlHistory.directHashChange({ currentUrl: to, isBack: function() { $.mobile.back(); }, isForward: function() { window.history.forward(); } }); // prevent changePage() return; } else { // if the current active page is a dialog and we're navigating // to a dialog use the dialog objected saved in the stack urlHistory.directHashChange({ currentUrl: to, // regardless of the direction of the history change // do the following either: function( isBack ) { var active = $.mobile.urlHistory.getActive(); to = active.pageUrl; // make sure to set the role, transition and reversal // as most of this is lost by the domCache cleaning $.extend( changePageOptions, { role: active.role, transition: active.transition, reverse: isBack }); } }); } } //if to is defined, load it if ( to ) { // At this point, 'to' can be one of 3 things, a cached page element from // a history stack entry, an id, or site-relative/absolute URL. If 'to' is // an id, we need to resolve it against the documentBase, not the location.href, // since the hashchange could've been the result of a forward/backward navigation // that crosses from an external page/dialog to an internal page/dialog. to = ( typeof to === "string" && !path.isPath( to ) ) ? ( path.makeUrlAbsolute( '#' + to, documentBase ) ) : to; // If we're about to go to an initial URL that contains a reference to a non-existent // internal page, go to the first page instead. We know that the initial hash refers to a // non-existent page, because the initial hash did not end up in the initial urlHistory entry if ( to === path.makeUrlAbsolute( '#' + urlHistory.initialDst, documentBase ) && urlHistory.stack.length && urlHistory.stack[0].url !== urlHistory.initialDst.replace( dialogHashKey, "" ) ) { to = $.mobile.firstPage; } $.mobile.changePage( to, changePageOptions ); } else { //there's no hash, go to the first page in the dom $.mobile.changePage( $.mobile.firstPage, changePageOptions ); } }; //hashchange event handler $window.bind( "hashchange", function( e, triggered ) { // Firefox auto-escapes the location.hash as for v13 but // leaves the href untouched $.mobile._handleHashChange( path.parseLocation().hash ); }); //set page min-heights to be device specific $( document ).bind( "pageshow", resetActivePageHeight ); $( window ).bind( "throttledresize", resetActivePageHeight ); });//navreadyDeferred done callback })( jQuery ); (function( $, window ) { // For now, let's Monkeypatch this onto the end of $.mobile._registerInternalEvents // Scope self to pushStateHandler so we can reference it sanely within the // methods handed off as event handlers var pushStateHandler = {}, self = pushStateHandler, $win = $( window ), url = $.mobile.path.parseLocation(), mobileinitDeferred = $.Deferred(), domreadyDeferred = $.Deferred(); $( document ).ready( $.proxy( domreadyDeferred, "resolve" ) ); $( document ).one( "mobileinit", $.proxy( mobileinitDeferred, "resolve" ) ); $.extend( pushStateHandler, { // TODO move to a path helper, this is rather common functionality initialFilePath: (function() { return url.pathname + url.search; })(), hashChangeTimeout: 200, hashChangeEnableTimer: undefined, initialHref: url.hrefNoHash, state: function() { return { // firefox auto decodes the url when using location.hash but not href hash: $.mobile.path.parseLocation().hash || "#" + self.initialFilePath, title: document.title, // persist across refresh initialHref: self.initialHref }; }, resetUIKeys: function( url ) { var dialog = $.mobile.dialogHashKey, subkey = "&" + $.mobile.subPageUrlKey, dialogIndex = url.indexOf( dialog ); if ( dialogIndex > -1 ) { url = url.slice( 0, dialogIndex ) + "#" + url.slice( dialogIndex ); } else if ( url.indexOf( subkey ) > -1 ) { url = url.split( subkey ).join( "#" + subkey ); } return url; }, // TODO sort out a single barrier to hashchange functionality nextHashChangePrevented: function( value ) { $.mobile.urlHistory.ignoreNextHashChange = value; self.onHashChangeDisabled = value; }, // on hash change we want to clean up the url // NOTE this takes place *after* the vanilla navigation hash change // handling has taken place and set the state of the DOM onHashChange: function( e ) { // disable this hash change if ( self.onHashChangeDisabled ) { return; } var href, state, // firefox auto decodes the url when using location.hash but not href hash = $.mobile.path.parseLocation().hash, isPath = $.mobile.path.isPath( hash ), resolutionUrl = isPath ? $.mobile.path.getLocation() : $.mobile.getDocumentUrl(); hash = isPath ? hash.replace( "#", "" ) : hash; // propulate the hash when its not available state = self.state(); // make the hash abolute with the current href href = $.mobile.path.makeUrlAbsolute( hash, resolutionUrl ); if ( isPath ) { href = self.resetUIKeys( href ); } // replace the current url with the new href and store the state // Note that in some cases we might be replacing an url with the // same url. We do this anyways because we need to make sure that // all of our history entries have a state object associated with // them. This allows us to work around the case where $.mobile.back() // is called to transition from an external page to an embedded page. // In that particular case, a hashchange event is *NOT* generated by the browser. // Ensuring each history entry has a state object means that onPopState() // will always trigger our hashchange callback even when a hashchange event // is not fired. history.replaceState( state, document.title, href ); }, // on popstate (ie back or forward) we need to replace the hash that was there previously // cleaned up by the additional hash handling onPopState: function( e ) { var poppedState = e.originalEvent.state, fromHash, toHash, hashChanged; // if there's no state its not a popstate we care about, eg chrome's initial popstate if ( poppedState ) { // if we get two pop states in under this.hashChangeTimeout // make sure to clear any timer set for the previous change clearTimeout( self.hashChangeEnableTimer ); // make sure to enable hash handling for the the _handleHashChange call self.nextHashChangePrevented( false ); // change the page based on the hash in the popped state $.mobile._handleHashChange( poppedState.hash ); // prevent any hashchange in the next self.hashChangeTimeout self.nextHashChangePrevented( true ); // re-enable hash change handling after swallowing a possible hash // change event that comes on all popstates courtesy of browsers like Android self.hashChangeEnableTimer = setTimeout( function() { self.nextHashChangePrevented( false ); }, self.hashChangeTimeout ); } }, init: function() { $win.bind( "hashchange", self.onHashChange ); // Handle popstate events the occur through history changes $win.bind( "popstate", self.onPopState ); // if there's no hash, we need to replacestate for returning to home if ( location.hash === "" ) { history.replaceState( self.state(), document.title, $.mobile.path.getLocation() ); } } }); // We need to init when "mobileinit", "domready", and "navready" have all happened $.when( domreadyDeferred, mobileinitDeferred, $.mobile.navreadyDeferred ).done(function() { if ( $.mobile.pushStateEnabled && $.support.pushState ) { pushStateHandler.init(); } }); })( jQuery, this ); /* * fallback transition for flip in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { $.mobile.transitionFallbacks.flip = "fade"; })( jQuery, this ); /* * fallback transition for flow in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { $.mobile.transitionFallbacks.flow = "fade"; })( jQuery, this ); /* * fallback transition for pop in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { $.mobile.transitionFallbacks.pop = "fade"; })( jQuery, this ); /* * fallback transition for slide in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { // Use the simultaneous transitions handler for slide transitions $.mobile.transitionHandlers.slide = $.mobile.transitionHandlers.simultaneous; // Set the slide transitions's fallback to "fade" $.mobile.transitionFallbacks.slide = "fade"; })( jQuery, this ); /* * fallback transition for slidedown in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { $.mobile.transitionFallbacks.slidedown = "fade"; })( jQuery, this ); /* * fallback transition for slidefade in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { // Set the slide transitions's fallback to "fade" $.mobile.transitionFallbacks.slidefade = "fade"; })( jQuery, this ); /* * fallback transition for slideup in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { $.mobile.transitionFallbacks.slideup = "fade"; })( jQuery, this ); /* * fallback transition for turn in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { $.mobile.transitionFallbacks.turn = "fade"; })( jQuery, this ); (function( $, undefined ) { $.mobile.page.prototype.options.degradeInputs = { color: false, date: false, datetime: false, "datetime-local": false, email: false, month: false, number: false, range: "number", search: "text", tel: false, time: false, url: false, week: false }; //auto self-init widgets $( document ).bind( "pagecreate create", function( e ) { var page = $.mobile.closestPageData( $( e.target ) ), options; if ( !page ) { return; } options = page.options; // degrade inputs to avoid poorly implemented native functionality $( e.target ).find( "input" ).not( page.keepNativeSelector() ).each(function() { var $this = $( this ), type = this.getAttribute( "type" ), optType = options.degradeInputs[ type ] || "text"; if ( options.degradeInputs[ type ] ) { var html = $( "<div>" ).html( $this.clone() ).html(), // In IE browsers, the type sometimes doesn't exist in the cloned markup, so we replace the closing tag instead hasType = html.indexOf( " type=" ) > -1, findstr = hasType ? /\s+type=["']?\w+['"]?/ : /\/?>/, repstr = " type=\"" + optType + "\" data-" + $.mobile.ns + "type=\"" + type + "\"" + ( hasType ? "" : ">" ); $this.replaceWith( html.replace( findstr, repstr ) ); } }); }); })( jQuery ); (function( $, window, undefined ) { $.widget( "mobile.dialog", $.mobile.widget, { options: { closeBtnText: "Close", overlayTheme: "a", initSelector: ":jqmData(role='dialog')" }, _create: function() { var self = this, $el = this.element, headerCloseButton = $( "<a href='#' data-" + $.mobile.ns + "icon='delete' data-" + $.mobile.ns + "iconpos='notext'>"+ this.options.closeBtnText + "</a>" ), dialogWrap = $( "<div/>", { "role" : "dialog", "class" : "ui-dialog-contain ui-corner-all ui-overlay-shadow" }); $el.addClass( "ui-dialog ui-overlay-" + this.options.overlayTheme ); // Class the markup for dialog styling // Set aria role $el .wrapInner( dialogWrap ) .children() .find( ":jqmData(role='header')" ) .prepend( headerCloseButton ) .end() .children( ':first-child') .addClass( "ui-corner-top" ) .end() .children( ":last-child" ) .addClass( "ui-corner-bottom" ); // this must be an anonymous function so that select menu dialogs can replace // the close method. This is a change from previously just defining data-rel=back // on the button and letting nav handle it // // Use click rather than vclick in order to prevent the possibility of unintentionally // reopening the dialog if the dialog opening item was directly under the close button. headerCloseButton.bind( "click", function() { self.close(); }); /* bind events - clicks and submits should use the closing transition that the dialog opened with unless a data-transition is specified on the link/form - if the click was on the close button, or the link has a data-rel="back" it'll go back in history naturally */ $el.bind( "vclick submit", function( event ) { var $target = $( event.target ).closest( event.type === "vclick" ? "a" : "form" ), active; if ( $target.length && !$target.jqmData( "transition" ) ) { active = $.mobile.urlHistory.getActive() || {}; $target.attr( "data-" + $.mobile.ns + "transition", ( active.transition || $.mobile.defaultDialogTransition ) ) .attr( "data-" + $.mobile.ns + "direction", "reverse" ); } }) .bind( "pagehide", function( e, ui ) { $( this ).find( "." + $.mobile.activeBtnClass ).not( ".ui-slider-bg" ).removeClass( $.mobile.activeBtnClass ); }) // Override the theme set by the page plugin on pageshow .bind( "pagebeforeshow", function() { self._isCloseable = true; if ( self.options.overlayTheme ) { self.element .page( "removeContainerBackground" ) .page( "setContainerBackground", self.options.overlayTheme ); } }); }, // Close method goes back in history close: function() { var dst; if ( this._isCloseable ) { this._isCloseable = false; if ( $.mobile.hashListeningEnabled ) { $.mobile.back(); } else { dst = $.mobile.urlHistory.getPrev().url; if ( !$.mobile.path.isPath( dst ) ) { dst = $.mobile.path.makeUrlAbsolute( "#" + dst ); } $.mobile.changePage( dst, { changeHash: false, fromHashChange: true } ); } } } }); //auto self-init widgets $( document ).delegate( $.mobile.dialog.prototype.options.initSelector, "pagecreate", function() { $.mobile.dialog.prototype.enhance( this ); }); })( jQuery, this ); (function( $, undefined ) { $.mobile.page.prototype.options.backBtnText = "Back"; $.mobile.page.prototype.options.addBackBtn = false; $.mobile.page.prototype.options.backBtnTheme = null; $.mobile.page.prototype.options.headerTheme = "a"; $.mobile.page.prototype.options.footerTheme = "a"; $.mobile.page.prototype.options.contentTheme = null; // NOTE bind used to force this binding to run before the buttonMarkup binding // which expects .ui-footer top be applied in its gigantic selector // TODO remove the buttonMarkup giant selector and move it to the various modules // on which it depends $( document ).bind( "pagecreate", function( e ) { var $page = $( e.target ), o = $page.data( "page" ).options, pageRole = $page.jqmData( "role" ), pageTheme = o.theme; $( ":jqmData(role='header'), :jqmData(role='footer'), :jqmData(role='content')", $page ) .jqmEnhanceable() .each(function() { var $this = $( this ), role = $this.jqmData( "role" ), theme = $this.jqmData( "theme" ), contentTheme = theme || o.contentTheme || ( pageRole === "dialog" && pageTheme ), $headeranchors, leftbtn, rightbtn, backBtn; $this.addClass( "ui-" + role ); //apply theming and markup modifications to page,header,content,footer if ( role === "header" || role === "footer" ) { var thisTheme = theme || ( role === "header" ? o.headerTheme : o.footerTheme ) || pageTheme; $this //add theme class .addClass( "ui-bar-" + thisTheme ) // Add ARIA role .attr( "role", role === "header" ? "banner" : "contentinfo" ); if ( role === "header") { // Right,left buttons $headeranchors = $this.children( "a, button" ); leftbtn = $headeranchors.hasClass( "ui-btn-left" ); rightbtn = $headeranchors.hasClass( "ui-btn-right" ); leftbtn = leftbtn || $headeranchors.eq( 0 ).not( ".ui-btn-right" ).addClass( "ui-btn-left" ).length; rightbtn = rightbtn || $headeranchors.eq( 1 ).addClass( "ui-btn-right" ).length; } // Auto-add back btn on pages beyond first view if ( o.addBackBtn && role === "header" && $( ".ui-page" ).length > 1 && $page.jqmData( "url" ) !== $.mobile.path.stripHash( location.hash ) && !leftbtn ) { backBtn = $( "<a href='javascript:void(0);' class='ui-btn-left' data-"+ $.mobile.ns +"rel='back' data-"+ $.mobile.ns +"icon='arrow-l'>"+ o.backBtnText +"</a>" ) // If theme is provided, override default inheritance .attr( "data-"+ $.mobile.ns +"theme", o.backBtnTheme || thisTheme ) .prependTo( $this ); } // Page title $this.children( "h1, h2, h3, h4, h5, h6" ) .addClass( "ui-title" ) // Regardless of h element number in src, it becomes h1 for the enhanced page .attr({ "role": "heading", "aria-level": "1" }); } else if ( role === "content" ) { if ( contentTheme ) { $this.addClass( "ui-body-" + ( contentTheme ) ); } // Add ARIA role $this.attr( "role", "main" ); } }); }); })( jQuery ); (function( $, undefined ) { // filter function removes whitespace between label and form element so we can use inline-block (nodeType 3 = text) $.fn.fieldcontain = function( options ) { return this .addClass( "ui-field-contain ui-body ui-br" ) .contents().filter( function() { return ( this.nodeType === 3 && !/\S/.test( this.nodeValue ) ); }).remove(); }; //auto self-init widgets $( document ).bind( "pagecreate create", function( e ) { $( ":jqmData(role='fieldcontain')", e.target ).jqmEnhanceable().fieldcontain(); }); })( jQuery ); (function( $, undefined ) { $.fn.grid = function( options ) { return this.each(function() { var $this = $( this ), o = $.extend({ grid: null }, options ), $kids = $this.children(), gridCols = { solo:1, a:2, b:3, c:4, d:5 }, grid = o.grid, iterator; if ( !grid ) { if ( $kids.length <= 5 ) { for ( var letter in gridCols ) { if ( gridCols[ letter ] === $kids.length ) { grid = letter; } } } else { grid = "a"; $this.addClass( "ui-grid-duo" ); } } iterator = gridCols[grid]; $this.addClass( "ui-grid-" + grid ); $kids.filter( ":nth-child(" + iterator + "n+1)" ).addClass( "ui-block-a" ); if ( iterator > 1 ) { $kids.filter( ":nth-child(" + iterator + "n+2)" ).addClass( "ui-block-b" ); } if ( iterator > 2 ) { $kids.filter( ":nth-child(" + iterator + "n+3)" ).addClass( "ui-block-c" ); } if ( iterator > 3 ) { $kids.filter( ":nth-child(" + iterator + "n+4)" ).addClass( "ui-block-d" ); } if ( iterator > 4 ) { $kids.filter( ":nth-child(" + iterator + "n+5)" ).addClass( "ui-block-e" ); } }); }; })( jQuery ); (function( $, undefined ) { $( document ).bind( "pagecreate create", function( e ) { $( ":jqmData(role='nojs')", e.target ).addClass( "ui-nojs" ); }); })( jQuery ); (function( $, undefined ) { $.fn.buttonMarkup = function( options ) { var $workingSet = this, mapToDataAttr = function( key, value ) { e.setAttribute( "data-" + $.mobile.ns + key, value ); el.jqmData( key, value ); }; // Enforce options to be of type string options = ( options && ( $.type( options ) === "object" ) )? options : {}; for ( var i = 0; i < $workingSet.length; i++ ) { var el = $workingSet.eq( i ), e = el[ 0 ], o = $.extend( {}, $.fn.buttonMarkup.defaults, { icon: options.icon !== undefined ? options.icon : el.jqmData( "icon" ), iconpos: options.iconpos !== undefined ? options.iconpos : el.jqmData( "iconpos" ), theme: options.theme !== undefined ? options.theme : el.jqmData( "theme" ) || $.mobile.getInheritedTheme( el, "c" ), inline: options.inline !== undefined ? options.inline : el.jqmData( "inline" ), shadow: options.shadow !== undefined ? options.shadow : el.jqmData( "shadow" ), corners: options.corners !== undefined ? options.corners : el.jqmData( "corners" ), iconshadow: options.iconshadow !== undefined ? options.iconshadow : el.jqmData( "iconshadow" ), mini: options.mini !== undefined ? options.mini : el.jqmData( "mini" ) }, options ), // Classes Defined innerClass = "ui-btn-inner", textClass = "ui-btn-text", buttonClass, iconClass, // Button inner markup buttonInner, buttonText, buttonIcon, buttonElements; $.each( o, mapToDataAttr ); if ( el.jqmData( "rel" ) === "popup" && el.attr( "href" ) ) { e.setAttribute( "aria-haspopup", true ); e.setAttribute( "aria-owns", e.getAttribute( "href" ) ); } // Check if this element is already enhanced buttonElements = $.data( ( ( e.tagName === "INPUT" || e.tagName === "BUTTON" ) ? e.parentNode : e ), "buttonElements" ); if ( buttonElements ) { e = buttonElements.outer; el = $( e ); buttonInner = buttonElements.inner; buttonText = buttonElements.text; // We will recreate this icon below $( buttonElements.icon ).remove(); buttonElements.icon = null; } else { buttonInner = document.createElement( o.wrapperEls ); buttonText = document.createElement( o.wrapperEls ); } buttonIcon = o.icon ? document.createElement( "span" ) : null; if ( attachEvents && !buttonElements ) { attachEvents(); } // if not, try to find closest theme container if ( !o.theme ) { o.theme = $.mobile.getInheritedTheme( el, "c" ); } buttonClass = "ui-btn ui-btn-up-" + o.theme; buttonClass += o.shadow ? " ui-shadow" : ""; buttonClass += o.corners ? " ui-btn-corner-all" : ""; if ( o.mini !== undefined ) { // Used to control styling in headers/footers, where buttons default to `mini` style. buttonClass += o.mini === true ? " ui-mini" : " ui-fullsize"; } if ( o.inline !== undefined ) { // Used to control styling in headers/footers, where buttons default to `inline` style. buttonClass += o.inline === true ? " ui-btn-inline" : " ui-btn-block"; } if ( o.icon ) { o.icon = "ui-icon-" + o.icon; o.iconpos = o.iconpos || "left"; iconClass = "ui-icon " + o.icon; if ( o.iconshadow ) { iconClass += " ui-icon-shadow"; } } if ( o.iconpos ) { buttonClass += " ui-btn-icon-" + o.iconpos; if ( o.iconpos === "notext" && !el.attr( "title" ) ) { el.attr( "title", el.getEncodedText() ); } } innerClass += o.corners ? " ui-btn-corner-all" : ""; if ( o.iconpos && o.iconpos === "notext" && !el.attr( "title" ) ) { el.attr( "title", el.getEncodedText() ); } if ( buttonElements ) { el.removeClass( buttonElements.bcls || "" ); } el.removeClass( "ui-link" ).addClass( buttonClass ); buttonInner.className = innerClass; buttonText.className = textClass; if ( !buttonElements ) { buttonInner.appendChild( buttonText ); } if ( buttonIcon ) { buttonIcon.className = iconClass; if ( !( buttonElements && buttonElements.icon ) ) { buttonIcon.innerHTML = "&#160;"; buttonInner.appendChild( buttonIcon ); } } while ( e.firstChild && !buttonElements ) { buttonText.appendChild( e.firstChild ); } if ( !buttonElements ) { e.appendChild( buttonInner ); } // Assign a structure containing the elements of this button to the elements of this button. This // will allow us to recognize this as an already-enhanced button in future calls to buttonMarkup(). buttonElements = { bcls : buttonClass, outer : e, inner : buttonInner, text : buttonText, icon : buttonIcon }; $.data( e, 'buttonElements', buttonElements ); $.data( buttonInner, 'buttonElements', buttonElements ); $.data( buttonText, 'buttonElements', buttonElements ); if ( buttonIcon ) { $.data( buttonIcon, 'buttonElements', buttonElements ); } } return this; }; $.fn.buttonMarkup.defaults = { corners: true, shadow: true, iconshadow: true, wrapperEls: "span" }; function closestEnabledButton( element ) { var cname; while ( element ) { // Note that we check for typeof className below because the element we // handed could be in an SVG DOM where className on SVG elements is defined to // be of a different type (SVGAnimatedString). We only operate on HTML DOM // elements, so we look for plain "string". cname = ( typeof element.className === 'string' ) && ( element.className + ' ' ); if ( cname && cname.indexOf( "ui-btn " ) > -1 && cname.indexOf( "ui-disabled " ) < 0 ) { break; } element = element.parentNode; } return element; } var attachEvents = function() { var hoverDelay = $.mobile.buttonMarkup.hoverDelay, hov, foc; $( document ).bind( { "vmousedown vmousecancel vmouseup vmouseover vmouseout focus blur scrollstart": function( event ) { var theme, $btn = $( closestEnabledButton( event.target ) ), isTouchEvent = event.originalEvent && /^touch/.test( event.originalEvent.type ), evt = event.type; if ( $btn.length ) { theme = $btn.attr( "data-" + $.mobile.ns + "theme" ); if ( evt === "vmousedown" ) { if ( isTouchEvent ) { // Use a short delay to determine if the user is scrolling before highlighting hov = setTimeout( function() { $btn.removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-down-" + theme ); }, hoverDelay ); } else { $btn.removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-down-" + theme ); } } else if ( evt === "vmousecancel" || evt === "vmouseup" ) { $btn.removeClass( "ui-btn-down-" + theme ).addClass( "ui-btn-up-" + theme ); } else if ( evt === "vmouseover" || evt === "focus" ) { if ( isTouchEvent ) { // Use a short delay to determine if the user is scrolling before highlighting foc = setTimeout( function() { $btn.removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-hover-" + theme ); }, hoverDelay ); } else { $btn.removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-hover-" + theme ); } } else if ( evt === "vmouseout" || evt === "blur" || evt === "scrollstart" ) { $btn.removeClass( "ui-btn-hover-" + theme + " ui-btn-down-" + theme ).addClass( "ui-btn-up-" + theme ); if ( hov ) { clearTimeout( hov ); } if ( foc ) { clearTimeout( foc ); } } } }, "focusin focus": function( event ) { $( closestEnabledButton( event.target ) ).addClass( $.mobile.focusClass ); }, "focusout blur": function( event ) { $( closestEnabledButton( event.target ) ).removeClass( $.mobile.focusClass ); } }); attachEvents = null; }; //links in bars, or those with data-role become buttons //auto self-init widgets $( document ).bind( "pagecreate create", function( e ) { $( ":jqmData(role='button'), .ui-bar > a, .ui-header > a, .ui-footer > a, .ui-bar > :jqmData(role='controlgroup') > a", e.target ) .jqmEnhanceable() .not( "button, input, .ui-btn, :jqmData(role='none'), :jqmData(role='nojs')" ) .buttonMarkup(); }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.collapsible", $.mobile.widget, { options: { expandCueText: " click to expand contents", collapseCueText: " click to collapse contents", collapsed: true, heading: "h1,h2,h3,h4,h5,h6,legend", theme: null, contentTheme: null, inset: true, mini: false, initSelector: ":jqmData(role='collapsible')" }, _create: function() { var $el = this.element, o = this.options, collapsible = $el.addClass( "ui-collapsible" ), collapsibleHeading = $el.children( o.heading ).first(), collapsedIcon = $el.jqmData( "collapsed-icon" ) || o.collapsedIcon, expandedIcon = $el.jqmData( "expanded-icon" ) || o.expandedIcon, collapsibleContent = collapsible.wrapInner( "<div class='ui-collapsible-content'></div>" ).children( ".ui-collapsible-content" ), collapsibleSet = $el.closest( ":jqmData(role='collapsible-set')" ).addClass( "ui-collapsible-set" ); // Replace collapsibleHeading if it's a legend if ( collapsibleHeading.is( "legend" ) ) { collapsibleHeading = $( "<div role='heading'>"+ collapsibleHeading.html() +"</div>" ).insertBefore( collapsibleHeading ); collapsibleHeading.next().remove(); } // If we are in a collapsible set if ( collapsibleSet.length ) { // Inherit the theme from collapsible-set if ( !o.theme ) { o.theme = collapsibleSet.jqmData( "theme" ) || $.mobile.getInheritedTheme( collapsibleSet, "c" ); } // Inherit the content-theme from collapsible-set if ( !o.contentTheme ) { o.contentTheme = collapsibleSet.jqmData( "content-theme" ); } // Get the preference for collapsed icon in the set if ( !o.collapsedIcon ) { o.collapsedIcon = collapsibleSet.jqmData( "collapsed-icon" ); } // Get the preference for expanded icon in the set if ( !o.expandedIcon ) { o.expandedIcon = collapsibleSet.jqmData( "expanded-icon" ); } // Gets the preference icon position in the set if ( !o.iconPos ) { o.iconPos = collapsibleSet.jqmData( "iconpos" ); } // Inherit the preference for inset from collapsible-set or set the default value to ensure equalty within a set if ( collapsibleSet.jqmData( "inset" ) !== undefined ) { o.inset = collapsibleSet.jqmData( "inset" ); } else { o.inset = true; } // Gets the preference for mini in the set if ( !o.mini ) { o.mini = collapsibleSet.jqmData( "mini" ); } } else { // get inherited theme if not a set and no theme has been set if ( !o.theme ) { o.theme = $.mobile.getInheritedTheme( $el, "c" ); } } if ( !!o.inset ) { collapsible.addClass( "ui-collapsible-inset" ); } collapsibleContent.addClass( ( o.contentTheme ) ? ( "ui-body-" + o.contentTheme ) : ""); collapsedIcon = $el.jqmData( "collapsed-icon" ) || o.collapsedIcon || "plus"; expandedIcon = $el.jqmData( "expanded-icon" ) || o.expandedIcon || "minus"; collapsibleHeading //drop heading in before content .insertBefore( collapsibleContent ) //modify markup & attributes .addClass( "ui-collapsible-heading" ) .append( "<span class='ui-collapsible-heading-status'></span>" ) .wrapInner( "<a href='#' class='ui-collapsible-heading-toggle'></a>" ) .find( "a" ) .first() .buttonMarkup({ shadow: false, corners: false, iconpos: $el.jqmData( "iconpos" ) || o.iconPos || "left", icon: collapsedIcon, mini: o.mini, theme: o.theme }); if ( !!o.inset ) { collapsibleHeading .find( "a" ).first().add( ".ui-btn-inner", $el ) .addClass( "ui-corner-top ui-corner-bottom" ); } //events collapsible .bind( "expand collapse", function( event ) { if ( !event.isDefaultPrevented() ) { var $this = $( this ), isCollapse = ( event.type === "collapse" ), contentTheme = o.contentTheme; event.preventDefault(); collapsibleHeading .toggleClass( "ui-collapsible-heading-collapsed", isCollapse ) .find( ".ui-collapsible-heading-status" ) .text( isCollapse ? o.expandCueText : o.collapseCueText ) .end() .find( ".ui-icon" ) .toggleClass( "ui-icon-" + expandedIcon, !isCollapse ) // logic or cause same icon for expanded/collapsed state would remove the ui-icon-class .toggleClass( "ui-icon-" + collapsedIcon, ( isCollapse || expandedIcon === collapsedIcon ) ) .end() .find( "a" ).first().removeClass( $.mobile.activeBtnClass ); $this.toggleClass( "ui-collapsible-collapsed", isCollapse ); collapsibleContent.toggleClass( "ui-collapsible-content-collapsed", isCollapse ).attr( "aria-hidden", isCollapse ); if ( contentTheme && !!o.inset && ( !collapsibleSet.length || collapsible.jqmData( "collapsible-last" ) ) ) { collapsibleHeading .find( "a" ).first().add( collapsibleHeading.find( ".ui-btn-inner" ) ) .toggleClass( "ui-corner-bottom", isCollapse ); collapsibleContent.toggleClass( "ui-corner-bottom", !isCollapse ); } collapsibleContent.trigger( "updatelayout" ); } }) .trigger( o.collapsed ? "collapse" : "expand" ); collapsibleHeading .bind( "tap", function( event ) { collapsibleHeading.find( "a" ).first().addClass( $.mobile.activeBtnClass ); }) .bind( "click", function( event ) { var type = collapsibleHeading.is( ".ui-collapsible-heading-collapsed" ) ? "expand" : "collapse"; collapsible.trigger( type ); event.preventDefault(); event.stopPropagation(); }); } }); //auto self-init widgets $( document ).bind( "pagecreate create", function( e ) { $.mobile.collapsible.prototype.enhanceWithin( e.target ); }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.collapsibleset", $.mobile.widget, { options: { initSelector: ":jqmData(role='collapsible-set')" }, _create: function() { var $el = this.element.addClass( "ui-collapsible-set" ), o = this.options; // Inherit the theme from collapsible-set if ( !o.theme ) { o.theme = $.mobile.getInheritedTheme( $el, "c" ); } // Inherit the content-theme from collapsible-set if ( !o.contentTheme ) { o.contentTheme = $el.jqmData( "content-theme" ); } if ( $el.jqmData( "inset" ) !== undefined ) { o.inset = $el.jqmData( "inset" ); } o.inset = o.inset !== undefined ? o.inset : true; // Initialize the collapsible set if it's not already initialized if ( !$el.jqmData( "collapsiblebound" ) ) { $el .jqmData( "collapsiblebound", true ) .bind( "expand collapse", function( event ) { var isCollapse = ( event.type === "collapse" ), collapsible = $( event.target ).closest( ".ui-collapsible" ), widget = collapsible.data( "collapsible" ); if ( collapsible.jqmData( "collapsible-last" ) && !!o.inset ) { collapsible.find( ".ui-collapsible-heading" ).first() .find( "a" ).first() .toggleClass( "ui-corner-bottom", isCollapse ) .find( ".ui-btn-inner" ) .toggleClass( "ui-corner-bottom", isCollapse ); collapsible.find( ".ui-collapsible-content" ).toggleClass( "ui-corner-bottom", !isCollapse ); } }) .bind( "expand", function( event ) { var closestCollapsible = $( event.target ) .closest( ".ui-collapsible" ); if ( closestCollapsible.parent().is( ":jqmData(role='collapsible-set')" ) ) { closestCollapsible .siblings( ".ui-collapsible" ) .trigger( "collapse" ); } }); } }, _init: function() { var $el = this.element, collapsiblesInSet = $el.children( ":jqmData(role='collapsible')" ), expanded = collapsiblesInSet.filter( ":jqmData(collapsed='false')" ); this.refresh(); // Because the corners are handled by the collapsible itself and the default state is collapsed // That was causing https://github.com/jquery/jquery-mobile/issues/4116 expanded.trigger( "expand" ); }, refresh: function() { var $el = this.element, o = this.options, collapsiblesInSet = $el.children( ":jqmData(role='collapsible')" ); $.mobile.collapsible.prototype.enhance( collapsiblesInSet.not( ".ui-collapsible" ) ); // clean up borders if ( !!o.inset ) { collapsiblesInSet.each(function() { $( this ).jqmRemoveData( "collapsible-last" ) .find( ".ui-collapsible-heading" ) .find( "a" ).first() .removeClass( "ui-corner-top ui-corner-bottom" ) .find( ".ui-btn-inner" ) .removeClass( "ui-corner-top ui-corner-bottom" ); }); collapsiblesInSet.first() .find( "a" ) .first() .addClass( "ui-corner-top" ) .find( ".ui-btn-inner" ) .addClass( "ui-corner-top" ); collapsiblesInSet.last() .jqmData( "collapsible-last", true ) .find( "a" ) .first() .addClass( "ui-corner-bottom" ) .find( ".ui-btn-inner" ) .addClass( "ui-corner-bottom" ); } } }); //auto self-init widgets $( document ).bind( "pagecreate create", function( e ) { $.mobile.collapsibleset.prototype.enhanceWithin( e.target ); }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.navbar", $.mobile.widget, { options: { iconpos: "top", grid: null, initSelector: ":jqmData(role='navbar')" }, _create: function() { var $navbar = this.element, $navbtns = $navbar.find( "a" ), iconpos = $navbtns.filter( ":jqmData(icon)" ).length ? this.options.iconpos : undefined; $navbar.addClass( "ui-navbar ui-mini" ) .attr( "role", "navigation" ) .find( "ul" ) .jqmEnhanceable() .grid({ grid: this.options.grid }); $navbtns.buttonMarkup({ corners: false, shadow: false, inline: true, iconpos: iconpos }); $navbar.delegate( "a", "vclick", function( event ) { if ( !$(event.target).hasClass( "ui-disabled" ) ) { $navbtns.removeClass( $.mobile.activeBtnClass ); $( this ).addClass( $.mobile.activeBtnClass ); } }); // Buttons in the navbar with ui-state-persist class should regain their active state before page show $navbar.closest( ".ui-page" ).bind( "pagebeforeshow", function() { $navbtns.filter( ".ui-state-persist" ).addClass( $.mobile.activeBtnClass ); }); } }); //auto self-init widgets $( document ).bind( "pagecreate create", function( e ) { $.mobile.navbar.prototype.enhanceWithin( e.target ); }); })( jQuery ); (function( $, undefined ) { //Keeps track of the number of lists per page UID //This allows support for multiple nested list in the same page //https://github.com/jquery/jquery-mobile/issues/1617 var listCountPerPage = {}; $.widget( "mobile.listview", $.mobile.widget, { options: { theme: null, countTheme: "c", headerTheme: "b", dividerTheme: "b", splitIcon: "arrow-r", splitTheme: "b", inset: false, initSelector: ":jqmData(role='listview')" }, _create: function() { var t = this, listviewClasses = ""; listviewClasses += t.options.inset ? " ui-listview-inset ui-corner-all ui-shadow " : ""; // create listview markup t.element.addClass(function( i, orig ) { return orig + " ui-listview " + listviewClasses; }); t.refresh( true ); }, _removeCorners: function( li, which ) { var top = "ui-corner-top ui-corner-tr ui-corner-tl", bot = "ui-corner-bottom ui-corner-br ui-corner-bl"; li = li.add( li.find( ".ui-btn-inner, .ui-li-link-alt, .ui-li-thumb" ) ); if ( which === "top" ) { li.removeClass( top ); } else if ( which === "bottom" ) { li.removeClass( bot ); } else { li.removeClass( top + " " + bot ); } }, _refreshCorners: function( create ) { var $li, $visibleli, $topli, $bottomli; $li = this.element.children( "li" ); // At create time and when autodividers calls refresh the li are not visible yet so we need to rely on .ui-screen-hidden $visibleli = create || $li.filter( ":visible" ).length === 0 ? $li.not( ".ui-screen-hidden" ) : $li.filter( ":visible" ); // ui-li-last is used for setting border-bottom on the last li $li.filter( ".ui-li-last" ).removeClass( "ui-li-last" ); if ( this.options.inset ) { this._removeCorners( $li ); // Select the first visible li element $topli = $visibleli.first() .addClass( "ui-corner-top" ); $topli.add( $topli.find( ".ui-btn-inner" ) .not( ".ui-li-link-alt span:first-child" ) ) .addClass( "ui-corner-top" ) .end() .find( ".ui-li-link-alt, .ui-li-link-alt span:first-child" ) .addClass( "ui-corner-tr" ) .end() .find( ".ui-li-thumb" ) .not( ".ui-li-icon" ) .addClass( "ui-corner-tl" ); // Select the last visible li element $bottomli = $visibleli.last() .addClass( "ui-corner-bottom ui-li-last" ); $bottomli.add( $bottomli.find( ".ui-btn-inner" ) ) .find( ".ui-li-link-alt" ) .addClass( "ui-corner-br" ) .end() .find( ".ui-li-thumb" ) .not( ".ui-li-icon" ) .addClass( "ui-corner-bl" ); } else { $visibleli.last().addClass( "ui-li-last" ); } if ( !create ) { this.element.trigger( "updatelayout" ); } }, // This is a generic utility method for finding the first // node with a given nodeName. It uses basic DOM traversal // to be fast and is meant to be a substitute for simple // $.fn.closest() and $.fn.children() calls on a single // element. Note that callers must pass both the lowerCase // and upperCase version of the nodeName they are looking for. // The main reason for this is that this function will be // called many times and we want to avoid having to lowercase // the nodeName from the element every time to ensure we have // a match. Note that this function lives here for now, but may // be moved into $.mobile if other components need a similar method. _findFirstElementByTagName: function( ele, nextProp, lcName, ucName ) { var dict = {}; dict[ lcName ] = dict[ ucName ] = true; while ( ele ) { if ( dict[ ele.nodeName ] ) { return ele; } ele = ele[ nextProp ]; } return null; }, _getChildrenByTagName: function( ele, lcName, ucName ) { var results = [], dict = {}; dict[ lcName ] = dict[ ucName ] = true; ele = ele.firstChild; while ( ele ) { if ( dict[ ele.nodeName ] ) { results.push( ele ); } ele = ele.nextSibling; } return $( results ); }, _addThumbClasses: function( containers ) { var i, img, len = containers.length; for ( i = 0; i < len; i++ ) { img = $( this._findFirstElementByTagName( containers[ i ].firstChild, "nextSibling", "img", "IMG" ) ); if ( img.length ) { img.addClass( "ui-li-thumb" ); $( this._findFirstElementByTagName( img[ 0 ].parentNode, "parentNode", "li", "LI" ) ).addClass( img.is( ".ui-li-icon" ) ? "ui-li-has-icon" : "ui-li-has-thumb" ); } } }, refresh: function( create ) { this.parentPage = this.element.closest( ".ui-page" ); this._createSubPages(); var o = this.options, $list = this.element, self = this, dividertheme = $list.jqmData( "dividertheme" ) || o.dividerTheme, listsplittheme = $list.jqmData( "splittheme" ), listspliticon = $list.jqmData( "spliticon" ), li = this._getChildrenByTagName( $list[ 0 ], "li", "LI" ), ol = !!$.nodeName( $list[ 0 ], "ol" ), jsCount = !$.support.cssPseudoElement, start = $list.attr( "start" ), itemClassDict = {}, item, itemClass, itemTheme, a, last, splittheme, counter, startCount, newStartCount, countParent, icon, imgParents, img, linkIcon; if ( ol && jsCount ) { $list.find( ".ui-li-dec" ).remove(); } if ( ol ) { // Check if a start attribute has been set while taking a value of 0 into account if ( start || start === 0 ) { if ( !jsCount ) { startCount = parseFloat( start ) - 1; $list.css( "counter-reset", "listnumbering " + startCount ); } else { counter = parseFloat( start ); } } else if ( jsCount ) { counter = 1; } } if ( !o.theme ) { o.theme = $.mobile.getInheritedTheme( this.element, "c" ); } for ( var pos = 0, numli = li.length; pos < numli; pos++ ) { item = li.eq( pos ); itemClass = "ui-li"; // If we're creating the element, we update it regardless if ( create || !item.hasClass( "ui-li" ) ) { itemTheme = item.jqmData( "theme" ) || o.theme; a = this._getChildrenByTagName( item[ 0 ], "a", "A" ); var isDivider = ( item.jqmData( "role" ) === "list-divider" ); if ( a.length && !isDivider ) { icon = item.jqmData( "icon" ); item.buttonMarkup({ wrapperEls: "div", shadow: false, corners: false, iconpos: "right", icon: a.length > 1 || icon === false ? false : icon || "arrow-r", theme: itemTheme }); if ( ( icon !== false ) && ( a.length === 1 ) ) { item.addClass( "ui-li-has-arrow" ); } a.first().removeClass( "ui-link" ).addClass( "ui-link-inherit" ); if ( a.length > 1 ) { itemClass += " ui-li-has-alt"; last = a.last(); splittheme = listsplittheme || last.jqmData( "theme" ) || o.splitTheme; linkIcon = last.jqmData( "icon" ); last.appendTo( item ) .attr( "title", last.getEncodedText() ) .addClass( "ui-li-link-alt" ) .empty() .buttonMarkup({ shadow: false, corners: false, theme: itemTheme, icon: false, iconpos: "notext" }) .find( ".ui-btn-inner" ) .append( $( document.createElement( "span" ) ).buttonMarkup({ shadow: true, corners: true, theme: splittheme, iconpos: "notext", // link icon overrides list item icon overrides ul element overrides options icon: linkIcon || icon || listspliticon || o.splitIcon }) ); } } else if ( isDivider ) { itemClass += " ui-li-divider ui-bar-" + dividertheme; item.attr( "role", "heading" ); if ( ol ) { //reset counter when a divider heading is encountered if ( start || start === 0 ) { if ( !jsCount ) { newStartCount = parseFloat( start ) - 1; item.css( "counter-reset", "listnumbering " + newStartCount ); } else { counter = parseFloat( start ); } } else if ( jsCount ) { counter = 1; } } } else { itemClass += " ui-li-static ui-btn-up-" + itemTheme; } } if ( ol && jsCount && itemClass.indexOf( "ui-li-divider" ) < 0 ) { countParent = itemClass.indexOf( "ui-li-static" ) > 0 ? item : item.find( ".ui-link-inherit" ); countParent.addClass( "ui-li-jsnumbering" ) .prepend( "<span class='ui-li-dec'>" + ( counter++ ) + ". </span>" ); } // Instead of setting item class directly on the list item and its // btn-inner at this point in time, push the item into a dictionary // that tells us what class to set on it so we can do this after this // processing loop is finished. if ( !itemClassDict[ itemClass ] ) { itemClassDict[ itemClass ] = []; } itemClassDict[ itemClass ].push( item[ 0 ] ); } // Set the appropriate listview item classes on each list item // and their btn-inner elements. The main reason we didn't do this // in the for-loop above is because we can eliminate per-item function overhead // by calling addClass() and children() once or twice afterwards. This // can give us a significant boost on platforms like WP7.5. for ( itemClass in itemClassDict ) { $( itemClassDict[ itemClass ] ).addClass( itemClass ).children( ".ui-btn-inner" ).addClass( itemClass ); } $list.find( "h1, h2, h3, h4, h5, h6" ).addClass( "ui-li-heading" ) .end() .find( "p, dl" ).addClass( "ui-li-desc" ) .end() .find( ".ui-li-aside" ).each(function() { var $this = $( this ); $this.prependTo( $this.parent() ); //shift aside to front for css float }) .end() .find( ".ui-li-count" ).each(function() { $( this ).closest( "li" ).addClass( "ui-li-has-count" ); }).addClass( "ui-btn-up-" + ( $list.jqmData( "counttheme" ) || this.options.countTheme) + " ui-btn-corner-all" ); // The idea here is to look at the first image in the list item // itself, and any .ui-link-inherit element it may contain, so we // can place the appropriate classes on the image and list item. // Note that we used to use something like: // // li.find(">img:eq(0), .ui-link-inherit>img:eq(0)").each( ... ); // // But executing a find() like that on Windows Phone 7.5 took a // really long time. Walking things manually with the code below // allows the 400 listview item page to load in about 3 seconds as // opposed to 30 seconds. this._addThumbClasses( li ); this._addThumbClasses( $list.find( ".ui-link-inherit" ) ); this._refreshCorners( create ); // autodividers binds to this to redraw dividers after the listview refresh this._trigger( "afterrefresh" ); }, //create a string for ID/subpage url creation _idStringEscape: function( str ) { return str.replace(/[^a-zA-Z0-9]/g, '-'); }, _createSubPages: function() { var parentList = this.element, parentPage = parentList.closest( ".ui-page" ), parentUrl = parentPage.jqmData( "url" ), parentId = parentUrl || parentPage[ 0 ][ $.expando ], parentListId = parentList.attr( "id" ), o = this.options, dns = "data-" + $.mobile.ns, self = this, persistentFooterID = parentPage.find( ":jqmData(role='footer')" ).jqmData( "id" ), hasSubPages; if ( typeof listCountPerPage[ parentId ] === "undefined" ) { listCountPerPage[ parentId ] = -1; } parentListId = parentListId || ++listCountPerPage[ parentId ]; $( parentList.find( "li>ul, li>ol" ).toArray().reverse() ).each(function( i ) { var self = this, list = $( this ), listId = list.attr( "id" ) || parentListId + "-" + i, parent = list.parent(), nodeElsFull = $( list.prevAll().toArray().reverse() ), nodeEls = nodeElsFull.length ? nodeElsFull : $( "<span>" + $.trim(parent.contents()[ 0 ].nodeValue) + "</span>" ), title = nodeEls.first().getEncodedText(),//url limits to first 30 chars of text id = ( parentUrl || "" ) + "&" + $.mobile.subPageUrlKey + "=" + listId, theme = list.jqmData( "theme" ) || o.theme, countTheme = list.jqmData( "counttheme" ) || parentList.jqmData( "counttheme" ) || o.countTheme, newPage, anchor; //define hasSubPages for use in later removal hasSubPages = true; newPage = list.detach() .wrap( "<div " + dns + "role='page' " + dns + "url='" + id + "' " + dns + "theme='" + theme + "' " + dns + "count-theme='" + countTheme + "'><div " + dns + "role='content'></div></div>" ) .parent() .before( "<div " + dns + "role='header' " + dns + "theme='" + o.headerTheme + "'><div class='ui-title'>" + title + "</div></div>" ) .after( persistentFooterID ? $( "<div " + dns + "role='footer' " + dns + "id='"+ persistentFooterID +"'>" ) : "" ) .parent() .appendTo( $.mobile.pageContainer ); newPage.page(); anchor = parent.find( 'a:first' ); if ( !anchor.length ) { anchor = $( "<a/>" ).html( nodeEls || title ).prependTo( parent.empty() ); } anchor.attr( "href", "#" + id ); }).listview(); // on pagehide, remove any nested pages along with the parent page, as long as they aren't active // and aren't embedded if ( hasSubPages && parentPage.is( ":jqmData(external-page='true')" ) && parentPage.data( "page" ).options.domCache === false ) { var newRemove = function( e, ui ) { var nextPage = ui.nextPage, npURL, prEvent = new $.Event( "pageremove" ); if ( ui.nextPage ) { npURL = nextPage.jqmData( "url" ); if ( npURL.indexOf( parentUrl + "&" + $.mobile.subPageUrlKey ) !== 0 ) { self.childPages().remove(); parentPage.trigger( prEvent ); if ( !prEvent.isDefaultPrevented() ) { parentPage.removeWithDependents(); } } } }; // unbind the original page remove and replace with our specialized version parentPage .unbind( "pagehide.remove" ) .bind( "pagehide.remove", newRemove); } }, // TODO sort out a better way to track sub pages of the listview this is brittle childPages: function() { var parentUrl = this.parentPage.jqmData( "url" ); return $( ":jqmData(url^='"+ parentUrl + "&" + $.mobile.subPageUrlKey + "')" ); } }); //auto self-init widgets $( document ).bind( "pagecreate create", function( e ) { $.mobile.listview.prototype.enhanceWithin( e.target ); }); })( jQuery ); (function( $, undefined ) { $.mobile.listview.prototype.options.autodividers = false; $.mobile.listview.prototype.options.autodividersSelector = function( elt ) { // look for the text in the given element var text = elt.text() || null; if ( !text ) { return null; } // create the text for the divider (first uppercased letter) text = text.slice( 0, 1 ).toUpperCase(); return text; }; $( document ).delegate( "ul,ol", "listviewcreate", function() { var list = $( this ), listview = list.data( "listview" ); if ( !listview || !listview.options.autodividers ) { return; } var replaceDividers = function () { list.find( "li:jqmData(role='list-divider')" ).remove(); var lis = list.find( 'li' ), lastDividerText = null, li, dividerText; for ( var i = 0; i < lis.length ; i++ ) { li = lis[i]; dividerText = listview.options.autodividersSelector( $( li ) ); if ( dividerText && lastDividerText !== dividerText ) { var divider = document.createElement( 'li' ); divider.appendChild( document.createTextNode( dividerText ) ); divider.setAttribute( 'data-' + $.mobile.ns + 'role', 'list-divider' ); li.parentNode.insertBefore( divider, li ); } lastDividerText = dividerText; } }; var afterListviewRefresh = function () { list.unbind( 'listviewafterrefresh', afterListviewRefresh ); replaceDividers(); listview.refresh(); list.bind( 'listviewafterrefresh', afterListviewRefresh ); }; afterListviewRefresh(); }); })( jQuery ); /* * "checkboxradio" plugin */ (function( $, undefined ) { $.widget( "mobile.checkboxradio", $.mobile.widget, { options: { theme: null, initSelector: "input[type='checkbox'],input[type='radio']" }, _create: function() { var self = this, input = this.element, inheritAttr = function( input, dataAttr ) { return input.jqmData( dataAttr ) || input.closest( "form, fieldset" ).jqmData( dataAttr ); }, // NOTE: Windows Phone could not find the label through a selector // filter works though. parentLabel = $( input ).closest( "label" ), label = parentLabel.length ? parentLabel : $( input ).closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')" ).find( "label" ).filter( "[for='" + input[0].id + "']" ).first(), inputtype = input[0].type, mini = inheritAttr( input, "mini" ), checkedState = inputtype + "-on", uncheckedState = inputtype + "-off", icon = input.parents( ":jqmData(type='horizontal')" ).length ? undefined : uncheckedState, iconpos = inheritAttr( input, "iconpos" ), activeBtn = icon ? "" : " " + $.mobile.activeBtnClass, checkedClass = "ui-" + checkedState + activeBtn, uncheckedClass = "ui-" + uncheckedState, checkedicon = "ui-icon-" + checkedState, uncheckedicon = "ui-icon-" + uncheckedState; if ( inputtype !== "checkbox" && inputtype !== "radio" ) { return; } // Expose for other methods $.extend( this, { label: label, inputtype: inputtype, checkedClass: checkedClass, uncheckedClass: uncheckedClass, checkedicon: checkedicon, uncheckedicon: uncheckedicon }); // If there's no selected theme check the data attr if ( !this.options.theme ) { this.options.theme = $.mobile.getInheritedTheme( this.element, "c" ); } label.buttonMarkup({ theme: this.options.theme, icon: icon, shadow: false, mini: mini, iconpos: iconpos }); // Wrap the input + label in a div var wrapper = document.createElement('div'); wrapper.className = 'ui-' + inputtype; input.add( label ).wrapAll( wrapper ); label.bind({ vmouseover: function( event ) { if ( $( this ).parent().is( ".ui-disabled" ) ) { event.stopPropagation(); } }, vclick: function( event ) { if ( input.is( ":disabled" ) ) { event.preventDefault(); return; } self._cacheVals(); input.prop( "checked", inputtype === "radio" && true || !input.prop( "checked" ) ); // trigger click handler's bound directly to the input as a substitute for // how label clicks behave normally in the browsers // TODO: it would be nice to let the browser's handle the clicks and pass them // through to the associate input. we can swallow that click at the parent // wrapper element level input.triggerHandler( 'click' ); // Input set for common radio buttons will contain all the radio // buttons, but will not for checkboxes. clearing the checked status // of other radios ensures the active button state is applied properly self._getInputSet().not( input ).prop( "checked", false ); self._updateAll(); return false; } }); input .bind({ vmousedown: function() { self._cacheVals(); }, vclick: function() { var $this = $( this ); // Adds checked attribute to checked input when keyboard is used if ( $this.is( ":checked" ) ) { $this.prop( "checked", true); self._getInputSet().not( $this ).prop( "checked", false ); } else { $this.prop( "checked", false ); } self._updateAll(); }, focus: function() { label.addClass( $.mobile.focusClass ); }, blur: function() { label.removeClass( $.mobile.focusClass ); } }); this.refresh(); }, _cacheVals: function() { this._getInputSet().each(function() { $( this ).jqmData( "cacheVal", this.checked ); }); }, //returns either a set of radios with the same name attribute, or a single checkbox _getInputSet: function() { if ( this.inputtype === "checkbox" ) { return this.element; } return this.element.closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')" ) .find( "input[name='" + this.element[0].name + "'][type='" + this.inputtype + "']" ); }, _updateAll: function() { var self = this; this._getInputSet().each(function() { var $this = $( this ); if ( this.checked || self.inputtype === "checkbox" ) { $this.trigger( "change" ); } }) .checkboxradio( "refresh" ); }, refresh: function() { var input = this.element[0], label = this.label, icon = label.find( ".ui-icon" ); if ( input.checked ) { label.addClass( this.checkedClass ).removeClass( this.uncheckedClass ); icon.addClass( this.checkedicon ).removeClass( this.uncheckedicon ); } else { label.removeClass( this.checkedClass ).addClass( this.uncheckedClass ); icon.removeClass( this.checkedicon ).addClass( this.uncheckedicon ); } if ( input.disabled ) { this.disable(); } else { this.enable(); } }, disable: function() { this.element.prop( "disabled", true ).parent().addClass( "ui-disabled" ); }, enable: function() { this.element.prop( "disabled", false ).parent().removeClass( "ui-disabled" ); } }); //auto self-init widgets $( document ).bind( "pagecreate create", function( e ) { $.mobile.checkboxradio.prototype.enhanceWithin( e.target, true ); }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.button", $.mobile.widget, { options: { theme: null, icon: null, iconpos: null, corners: true, shadow: true, iconshadow: true, initSelector: "button, [type='button'], [type='submit'], [type='reset']" }, _create: function() { var $el = this.element, $button, o = this.options, type, name, inline = o.inline || $el.jqmData( "inline" ), mini = o.mini || $el.jqmData( "mini" ), classes = "", $buttonPlaceholder; // if this is a link, check if it's been enhanced and, if not, use the right function if ( $el[ 0 ].tagName === "A" ) { if ( !$el.hasClass( "ui-btn" ) ) { $el.buttonMarkup(); } return; } // get the inherited theme // TODO centralize for all widgets if ( !this.options.theme ) { this.options.theme = $.mobile.getInheritedTheme( this.element, "c" ); } // TODO: Post 1.1--once we have time to test thoroughly--any classes manually applied to the original element should be carried over to the enhanced element, with an `-enhanced` suffix. See https://github.com/jquery/jquery-mobile/issues/3577 /* if ( $el[0].className.length ) { classes = $el[0].className; } */ if ( !!~$el[0].className.indexOf( "ui-btn-left" ) ) { classes = "ui-btn-left"; } if ( !!~$el[0].className.indexOf( "ui-btn-right" ) ) { classes = "ui-btn-right"; } if ( $el.attr( "type" ) === "submit" || $el.attr( "type" ) === "reset" ) { classes ? classes += " ui-submit" : classes = "ui-submit"; } $( "label[for='" + $el.attr( "id" ) + "']" ).addClass( "ui-submit" ); // Add ARIA role this.button = $( "<div></div>" ) [ $el.html() ? "html" : "text" ]( $el.html() || $el.val() ) .insertBefore( $el ) .buttonMarkup({ theme: o.theme, icon: o.icon, iconpos: o.iconpos, inline: inline, corners: o.corners, shadow: o.shadow, iconshadow: o.iconshadow, mini: mini }) .addClass( classes ) .append( $el.addClass( "ui-btn-hidden" ) ); $button = this.button; type = $el.attr( "type" ); name = $el.attr( "name" ); // Add hidden input during submit if input type="submit" has a name. if ( type !== "button" && type !== "reset" && name ) { $el.bind( "vclick", function() { // Add hidden input if it doesn't already exist. if ( $buttonPlaceholder === undefined ) { $buttonPlaceholder = $( "<input>", { type: "hidden", name: $el.attr( "name" ), value: $el.attr( "value" ) }).insertBefore( $el ); // Bind to doc to remove after submit handling $( document ).one( "submit", function() { $buttonPlaceholder.remove(); // reset the local var so that the hidden input // will be re-added on subsequent clicks $buttonPlaceholder = undefined; }); } }); } $el.bind({ focus: function() { $button.addClass( $.mobile.focusClass ); }, blur: function() { $button.removeClass( $.mobile.focusClass ); } }); this.refresh(); }, enable: function() { this.element.attr( "disabled", false ); this.button.removeClass( "ui-disabled" ).attr( "aria-disabled", false ); return this._setOption( "disabled", false ); }, disable: function() { this.element.attr( "disabled", true ); this.button.addClass( "ui-disabled" ).attr( "aria-disabled", true ); return this._setOption( "disabled", true ); }, refresh: function() { var $el = this.element; if ( $el.prop("disabled") ) { this.disable(); } else { this.enable(); } // Grab the button's text element from its implementation-independent data item $( this.button.data( 'buttonElements' ).text )[ $el.html() ? "html" : "text" ]( $el.html() || $el.val() ); } }); //auto self-init widgets $( document ).bind( "pagecreate create", function( e ) { $.mobile.button.prototype.enhanceWithin( e.target, true ); }); })( jQuery ); (function( $, undefined ) { $.fn.controlgroup = function( options ) { function flipClasses( els, flCorners ) { els.removeClass( "ui-btn-corner-all ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-controlgroup-last ui-shadow" ) .eq( 0 ).addClass( flCorners[ 0 ] ) .end() .last().addClass( flCorners[ 1 ] ).addClass( "ui-controlgroup-last" ); } return this.each(function() { var $el = $( this ), o = $.extend({ direction: $el.jqmData( "type" ) || "vertical", shadow: false, excludeInvisible: true, mini: $el.jqmData( "mini" ) }, options ), grouplegend = $el.children( "legend" ), groupheading = $el.children( ".ui-controlgroup-label" ), groupcontrols = $el.children( ".ui-controlgroup-controls" ), flCorners = o.direction === "horizontal" ? [ "ui-corner-left", "ui-corner-right" ] : [ "ui-corner-top", "ui-corner-bottom" ], type = $el.find( "input" ).first().attr( "type" ); // First unwrap the controls if the controlgroup was already enhanced if ( groupcontrols.length ) { groupcontrols.contents().unwrap(); } $el.wrapInner( "<div class='ui-controlgroup-controls'></div>" ); if ( grouplegend.length ) { // Replace legend with more stylable replacement div $( "<div role='heading' class='ui-controlgroup-label'>" + grouplegend.html() + "</div>" ).insertBefore( $el.children( 0 ) ); grouplegend.remove(); } else if ( groupheading.length ) { // Just move the heading if the controlgroup was already enhanced $el.prepend( groupheading ); } $el.addClass( "ui-corner-all ui-controlgroup ui-controlgroup-" + o.direction ); flipClasses( $el.find( ".ui-btn" + ( o.excludeInvisible ? ":visible" : "" ) ).not( '.ui-slider-handle' ), flCorners ); flipClasses( $el.find( ".ui-btn-inner" ), flCorners ); if ( o.shadow ) { $el.addClass( "ui-shadow" ); } if ( o.mini ) { $el.addClass( "ui-mini" ); } }); }; // The pagecreate handler for controlgroup is in jquery.mobile.init because of the soft-dependency on the wrapped widgets })(jQuery); (function( $, undefined ) { $( document ).bind( "pagecreate create", function( e ) { //links within content areas, tests included with page $( e.target ) .find( "a" ) .jqmEnhanceable() .not( ".ui-btn, .ui-link-inherit, :jqmData(role='none'), :jqmData(role='nojs')" ) .addClass( "ui-link" ); }); })( jQuery ); (function( $, undefined ) { function fitSegmentInsideSegment( winSize, segSize, offset, desired ) { var ret = desired; if ( winSize < segSize ) { // Center segment if it's bigger than the window ret = offset + ( winSize - segSize ) / 2; } else { // Otherwise center it at the desired coordinate while keeping it completely inside the window ret = Math.min( Math.max( offset, desired - segSize / 2 ), offset + winSize - segSize ); } return ret; } function windowCoords() { var $win = $( window ); return { x: $win.scrollLeft(), y: $win.scrollTop(), cx: ( window.innerWidth || $win.width() ), cy: ( window.innerHeight || $win.height() ) }; } $.widget( "mobile.popup", $.mobile.widget, { options: { theme: null, overlayTheme: null, shadow: true, corners: true, transition: "none", positionTo: "origin", tolerance: null, initSelector: ":jqmData(role='popup')", closeLinkSelector: "a:jqmData(rel='back')", closeLinkEvents: "click.popup", navigateEvents: "navigate.popup", closeEvents: "navigate.popup pagebeforechange.popup", // NOTE Windows Phone 7 has a scroll position caching issue that // requires us to disable popup history management by default // https://github.com/jquery/jquery-mobile/issues/4784 // // NOTE this option is modified in _create! history: !$.mobile.browser.ie }, _eatEventAndClose: function( e ) { e.preventDefault(); e.stopImmediatePropagation(); this.close(); return false; }, // Make sure the screen size is increased beyond the page height if the popup's causes the document to increase in height _resizeScreen: function() { var popupHeight = this._ui.container.outerHeight( true ); this._ui.screen.removeAttr( "style" ); if ( popupHeight > this._ui.screen.height() ) { this._ui.screen.height( popupHeight ); } }, _handleWindowKeyUp: function( e ) { if ( this._isOpen && e.keyCode === $.mobile.keyCode.ESCAPE ) { return this._eatEventAndClose( e ); } }, _maybeRefreshTimeout: function() { var winCoords = windowCoords(); if ( this._resizeData ) { if ( winCoords.x === this._resizeData.winCoords.x && winCoords.y === this._resizeData.winCoords.y && winCoords.cx === this._resizeData.winCoords.cx && winCoords.cy === this._resizeData.winCoords.cy ) { // timeout not refreshed return false; } else { // clear existing timeout - it will be refreshed below clearTimeout( this._resizeData.timeoutId ); } } this._resizeData = { timeoutId: setTimeout( $.proxy( this, "_resizeTimeout" ), 200 ), winCoords: winCoords }; return true; }, _resizeTimeout: function() { if ( !this._maybeRefreshTimeout() ) { // effectively rapid-open the popup while leaving the screen intact this._trigger( "beforeposition" ); this._ui.container .removeClass( "ui-selectmenu-hidden" ) .offset( this._placementCoords( this._desiredCoords( undefined, undefined, "window" ) ) ); this._resizeScreen(); this._resizeData = null; this._orientationchangeInProgress = false; } }, _handleWindowResize: function( e ) { if ( this._isOpen ) { this._maybeRefreshTimeout(); } }, _handleWindowOrientationchange: function( e ) { if ( !this._orientationchangeInProgress ) { // effectively rapid-close the popup while leaving the screen intact this._ui.container .addClass( "ui-selectmenu-hidden" ) .removeAttr( "style" ); this._orientationchangeInProgress = true; } }, _create: function() { var ui = { screen: $( "<div class='ui-screen-hidden ui-popup-screen'></div>" ), placeholder: $( "<div style='display: none;'><!-- placeholder --></div>" ), container: $( "<div class='ui-popup-container ui-selectmenu-hidden'></div>" ) }, thisPage = this.element.closest( ".ui-page" ), myId = this.element.attr( "id" ), self = this; // We need to adjust the history option to be false if there's no AJAX nav. // We can't do it in the option declarations because those are run before // it is determined whether there shall be AJAX nav. this.options.history = this.options.history && $.mobile.ajaxEnabled && $.mobile.hashListeningEnabled; if ( thisPage.length === 0 ) { thisPage = $( "body" ); } // define the container for navigation event bindings // TODO this would be nice at the the mobile widget level this.options.container = this.options.container || $.mobile.pageContainer; // Apply the proto thisPage.append( ui.screen ); ui.container.insertAfter( ui.screen ); // Leave a placeholder where the element used to be ui.placeholder.insertAfter( this.element ); if ( myId ) { ui.screen.attr( "id", myId + "-screen" ); ui.container.attr( "id", myId + "-popup" ); ui.placeholder.html( "<!-- placeholder for " + myId + " -->" ); } ui.container.append( this.element ); // Add class to popup element this.element.addClass( "ui-popup" ); // Define instance variables $.extend( this, { _page: thisPage, _ui: ui, _fallbackTransition: "", _currentTransition: false, _prereqs: null, _isOpen: false, _tolerance: null, _resizeData: null, _orientationchangeInProgress: false, _globalHandlers: [ { src: $( window ), handler: { orientationchange: $.proxy( this, "_handleWindowOrientationchange" ), resize: $.proxy( this, "_handleWindowResize" ), keyup: $.proxy( this, "_handleWindowKeyUp" ) } } ] }); $.each( this.options, function( key, value ) { // Cause initial options to be applied by their handler by temporarily setting the option to undefined // - the handler then sets it to the initial value self.options[ key ] = undefined; self._setOption( key, value, true ); }); ui.screen.bind( "vclick", $.proxy( this, "_eatEventAndClose" ) ); $.each( this._globalHandlers, function( idx, value ) { value.src.bind( value.handler ); }); }, _applyTheme: function( dst, theme, prefix ) { var classes = ( dst.attr( "class" ) || "").split( " " ), alreadyAdded = true, currentTheme = null, matches, themeStr = String( theme ); while ( classes.length > 0 ) { currentTheme = classes.pop(); matches = ( new RegExp( "^ui-" + prefix + "-([a-z])$" ) ).exec( currentTheme ); if ( matches && matches.length > 1 ) { currentTheme = matches[ 1 ]; break; } else { currentTheme = null; } } if ( theme !== currentTheme ) { dst.removeClass( "ui-" + prefix + "-" + currentTheme ); if ( ! ( theme === null || theme === "none" ) ) { dst.addClass( "ui-" + prefix + "-" + themeStr ); } } }, _setTheme: function( value ) { this._applyTheme( this.element, value, "body" ); }, _setOverlayTheme: function( value ) { this._applyTheme( this._ui.screen, value, "overlay" ); if ( this._isOpen ) { this._ui.screen.addClass( "in" ); } }, _setShadow: function( value ) { this.element.toggleClass( "ui-overlay-shadow", value ); }, _setCorners: function( value ) { this.element.toggleClass( "ui-corner-all", value ); }, _applyTransition: function( value ) { this._ui.container.removeClass( this._fallbackTransition ); if ( value && value !== "none" ) { this._fallbackTransition = $.mobile._maybeDegradeTransition( value ); this._ui.container.addClass( this._fallbackTransition ); } }, _setTransition: function( value ) { if ( !this._currentTransition ) { this._applyTransition( value ); } }, _setTolerance: function( value ) { var tol = { t: 30, r: 15, b: 30, l: 15 }; if ( value ) { var ar = String( value ).split( "," ); $.each( ar, function( idx, val ) { ar[ idx ] = parseInt( val, 10 ); } ); switch( ar.length ) { // All values are to be the same case 1: if ( !isNaN( ar[ 0 ] ) ) { tol.t = tol.r = tol.b = tol.l = ar[ 0 ]; } break; // The first value denotes top/bottom tolerance, and the second value denotes left/right tolerance case 2: if ( !isNaN( ar[ 0 ] ) ) { tol.t = tol.b = ar[ 0 ]; } if ( !isNaN( ar[ 1 ] ) ) { tol.l = tol.r = ar[ 1 ]; } break; // The array contains values in the order top, right, bottom, left case 4: if ( !isNaN( ar[ 0 ] ) ) { tol.t = ar[ 0 ]; } if ( !isNaN( ar[ 1 ] ) ) { tol.r = ar[ 1 ]; } if ( !isNaN( ar[ 2 ] ) ) { tol.b = ar[ 2 ]; } if ( !isNaN( ar[ 3 ] ) ) { tol.l = ar[ 3 ]; } break; default: break; } } this._tolerance = tol; }, _setOption: function( key, value ) { var exclusions, setter = "_set" + key.charAt( 0 ).toUpperCase() + key.slice( 1 ); if ( this[ setter ] !== undefined ) { this[ setter ]( value ); } // TODO REMOVE FOR 1.2.1 by moving them out to a default options object exclusions = [ "initSelector", "closeLinkSelector", "closeLinkEvents", "navigateEvents", "closeEvents", "history", "container" ]; $.mobile.widget.prototype._setOption.apply( this, arguments ); if ( $.inArray( key, exclusions ) === -1 ) { // Record the option change in the options and in the DOM data-* attributes this.element.attr( "data-" + ( $.mobile.ns || "" ) + ( key.replace( /([A-Z])/, "-$1" ).toLowerCase() ), value ); } }, // Try and center the overlay over the given coordinates _placementCoords: function( desired ) { // rectangle within which the popup must fit var winCoords = windowCoords(), rc = { x: this._tolerance.l, y: winCoords.y + this._tolerance.t, cx: winCoords.cx - this._tolerance.l - this._tolerance.r, cy: winCoords.cy - this._tolerance.t - this._tolerance.b }, menuSize, ret; // Clamp the width of the menu before grabbing its size this._ui.container.css( "max-width", rc.cx ); menuSize = { cx: this._ui.container.outerWidth( true ), cy: this._ui.container.outerHeight( true ) }; // Center the menu over the desired coordinates, while not going outside // the window tolerances. This will center wrt. the window if the popup is too large. ret = { x: fitSegmentInsideSegment( rc.cx, menuSize.cx, rc.x, desired.x ), y: fitSegmentInsideSegment( rc.cy, menuSize.cy, rc.y, desired.y ) }; // Make sure the top of the menu is visible ret.y = Math.max( 0, ret.y ); // If the height of the menu is smaller than the height of the document // align the bottom with the bottom of the document // fix for $( document ).height() bug in core 1.7.2. var docEl = document.documentElement, docBody = document.body, docHeight = Math.max( docEl.clientHeight, docBody.scrollHeight, docBody.offsetHeight, docEl.scrollHeight, docEl.offsetHeight ); ret.y -= Math.min( ret.y, Math.max( 0, ret.y + menuSize.cy - docHeight ) ); return { left: ret.x, top: ret.y }; }, _createPrereqs: function( screenPrereq, containerPrereq, whenDone ) { var self = this, prereqs; // It is important to maintain both the local variable prereqs and self._prereqs. The local variable remains in // the closure of the functions which call the callbacks passed in. The comparison between the local variable and // self._prereqs is necessary, because once a function has been passed to .animationComplete() it will be called // next time an animation completes, even if that's not the animation whose end the function was supposed to catch // (for example, if an abort happens during the opening animation, the .animationComplete handler is not called for // that animation anymore, but the handler remains attached, so it is called the next time the popup is opened // - making it stale. Comparing the local variable prereqs to the widget-level variable self._prereqs ensures that // callbacks triggered by a stale .animationComplete will be ignored. prereqs = { screen: $.Deferred(), container: $.Deferred() }; prereqs.screen.then( function() { if ( prereqs === self._prereqs ) { screenPrereq(); } }); prereqs.container.then( function() { if ( prereqs === self._prereqs ) { containerPrereq(); } }); $.when( prereqs.screen, prereqs.container ).done( function() { if ( prereqs === self._prereqs ) { self._prereqs = null; whenDone(); } }); self._prereqs = prereqs; }, _animate: function( args ) { // NOTE before removing the default animation of the screen // this had an animate callback that would relove the deferred // now the deferred is resolved immediately // TODO remove the dependency on the screen deferred this._ui.screen .removeClass( args.classToRemove ) .addClass( args.screenClassToAdd ); args.prereqs.screen.resolve(); if ( args.transition && args.transition !== "none" ) { if ( args.applyTransition ) { this._applyTransition( args.transition ); } this._ui.container .animationComplete( $.proxy( args.prereqs.container, "resolve" ) ) .addClass( args.containerClassToAdd ) .removeClass( args.classToRemove ); } else { args.prereqs.container.resolve(); } }, // The desired coordinates passed in will be returned untouched if no reference element can be identified via // desiredPosition.positionTo. Nevertheless, this function ensures that its return value always contains valid // x and y coordinates by specifying the center middle of the window if the coordinates are absent. _desiredCoords: function( x, y, positionTo ) { var dst = null, offset, winCoords = windowCoords(); // Establish which element will serve as the reference if ( positionTo && positionTo !== "origin" ) { if ( positionTo === "window" ) { x = winCoords.cx / 2 + winCoords.x; y = winCoords.cy / 2 + winCoords.y; } else { try { dst = $( positionTo ); } catch( e ) { dst = null; } if ( dst ) { dst.filter( ":visible" ); if ( dst.length === 0 ) { dst = null; } } } } // If an element was found, center over it if ( dst ) { offset = dst.offset(); x = offset.left + dst.outerWidth() / 2; y = offset.top + dst.outerHeight() / 2; } // Make sure x and y are valid numbers - center over the window if ( $.type( x ) !== "number" || isNaN( x ) ) { x = winCoords.cx / 2 + winCoords.x; } if ( $.type( y ) !== "number" || isNaN( y ) ) { y = winCoords.cy / 2 + winCoords.y; } return { x: x, y: y }; }, _openPrereqsComplete: function() { var self = this; self._ui.container.addClass( "ui-popup-active" ); self._isOpen = true; self._resizeScreen(); // Android appears to trigger the animation complete before the popup // is visible. Allowing the stack to unwind before applying focus prevents // the "blue flash" of element focus in android 4.0 setTimeout(function(){ self._ui.container.attr( "tabindex", "0" ).focus(); self._trigger( "afteropen" ); }); }, _open: function( options ) { var coords, transition, androidBlacklist = ( function() { var w = window, ua = navigator.userAgent, // Rendering engine is Webkit, and capture major version wkmatch = ua.match( /AppleWebKit\/([0-9\.]+)/ ), wkversion = !!wkmatch && wkmatch[ 1 ], androidmatch = ua.match( /Android (\d+(?:\.\d+))/ ), andversion = !!androidmatch && androidmatch[ 1 ], chromematch = ua.indexOf( "Chrome" ) > -1; // Platform is Android, WebKit version is greater than 534.13 ( Android 3.2.1 ) and not Chrome. if( androidmatch !== null && andversion === "4.0" && wkversion && wkversion > 534.13 && !chromematch ) { return true; } return false; }()); // Make sure options is defined options = ( options || {} ); // Copy out the transition, because we may be overwriting it later and we don't want to pass that change back to the caller transition = options.transition || this.options.transition; // Give applications a chance to modify the contents of the container before it appears this._trigger( "beforeposition" ); coords = this._placementCoords( this._desiredCoords( options.x, options.y, options.positionTo || this.options.positionTo || "origin" ) ); // Count down to triggering "popupafteropen" - we have two prerequisites: // 1. The popup window animation completes (container()) // 2. The screen opacity animation completes (screen()) this._createPrereqs( $.noop, $.noop, $.proxy( this, "_openPrereqsComplete" ) ); if ( transition ) { this._currentTransition = transition; this._applyTransition( transition ); } else { transition = this.options.transition; } if ( !this.options.theme ) { this._setTheme( this._page.jqmData( "theme" ) || $.mobile.getInheritedTheme( this._page, "c" ) ); } this._ui.screen.removeClass( "ui-screen-hidden" ); this._ui.container .removeClass( "ui-selectmenu-hidden" ) .offset( coords ); if ( this.options.overlayTheme && androidBlacklist ) { /* TODO: The native browser on Android 4.0.X ("Ice Cream Sandwich") suffers from an issue where the popup overlay appears to be z-indexed above the popup itself when certain other styles exist on the same page -- namely, any element set to `position: fixed` and certain types of input. These issues are reminiscent of previously uncovered bugs in older versions of Android's native browser: https://github.com/scottjehl/Device-Bugs/issues/3 This fix closes the following bugs ( I use "closes" with reluctance, and stress that this issue should be revisited as soon as possible ): https://github.com/jquery/jquery-mobile/issues/4816 https://github.com/jquery/jquery-mobile/issues/4844 https://github.com/jquery/jquery-mobile/issues/4874 */ // TODO sort out why this._page isn't working this.element.closest( ".ui-page" ).addClass( "ui-popup-open" ); } this._animate({ additionalCondition: true, transition: transition, classToRemove: "", screenClassToAdd: "in", containerClassToAdd: "in", applyTransition: false, prereqs: this._prereqs }); }, _closePrereqScreen: function() { this._ui.screen .removeClass( "out" ) .addClass( "ui-screen-hidden" ); }, _closePrereqContainer: function() { this._ui.container .removeClass( "reverse out" ) .addClass( "ui-selectmenu-hidden" ) .removeAttr( "style" ); }, _closePrereqsDone: function() { var self = this, opts = self.options; self._ui.container.removeAttr( "tabindex" ); // remove nav bindings if they are still present opts.container.unbind( opts.closeEvents ); // unbind click handlers added when history is disabled self.element.undelegate( opts.closeLinkSelector, opts.closeLinkEvents ); // remove the global mutex for popups $.mobile.popup.active = undefined; // alert users that the popup is closed self._trigger( "afterclose" ); }, _close: function() { this._ui.container.removeClass( "ui-popup-active" ); this._page.removeClass( "ui-popup-open" ); this._isOpen = false; // Count down to triggering "popupafterclose" - we have two prerequisites: // 1. The popup window reverse animation completes (container()) // 2. The screen opacity animation completes (screen()) this._createPrereqs( $.proxy( this, "_closePrereqScreen" ), $.proxy( this, "_closePrereqContainer" ), $.proxy( this, "_closePrereqsDone" ) ); this._animate( { additionalCondition: this._ui.screen.hasClass( "in" ), transition: ( this._currentTransition || this.options.transition ), classToRemove: "in", screenClassToAdd: "out", containerClassToAdd: "reverse out", applyTransition: true, prereqs: this._prereqs }); }, _destroy: function() { var self = this; // hide and remove bindings self._close(); // Put the element back to where the placeholder was and remove the "ui-popup" class self._setTheme( "none" ); self.element .insertAfter( self._ui.placeholder ) .removeClass( "ui-popup ui-overlay-shadow ui-corner-all" ); self._ui.screen.remove(); self._ui.container.remove(); self._ui.placeholder.remove(); // Unbind handlers that were bound to elements outside self.element (the window, in self case) $.each( self._globalHandlers, function( idx, oneSrc ) { $.each( oneSrc.handler, function( eventType, handler ) { oneSrc.src.unbind( eventType, handler ); }); }); }, // any navigation event after a popup is opened should close the popup // NOTE the pagebeforechange is bound to catch navigation events that don't // alter the url (eg, dialogs from popups) _bindContainerClose: function() { var self = this; self.options.container .one( self.options.closeEvents, $.proxy( self._close, self )); }, // TODO no clear deliniation of what should be here and // what should be in _open. Seems to be "visual" vs "history" for now open: function( options ) { var self = this, opts = this.options, url, hashkey, activePage, currentIsDialog, hasHash, urlHistory; // make sure open is idempotent if( $.mobile.popup.active ) { return; } // set the global popup mutex $.mobile.popup.active = this; // if history alteration is disabled close on navigate events // and leave the url as is if( !( opts.history ) ) { self._open( options ); self._bindContainerClose(); // When histoy is disabled we have to grab the data-rel // back link clicks so we can close the popup instead of // relying on history to do it for us self.element .delegate( opts.closeLinkSelector, opts.closeLinkEvents, function( e ) { self._close(); // NOTE prevent the browser and navigation handlers from // working with the link's rel=back. This may cause // issues for developers expecting the event to bubble return false; }); return; } // cache some values for min/readability hashkey = $.mobile.dialogHashKey; activePage = $.mobile.activePage; currentIsDialog = activePage.is( ".ui-dialog" ); url = $.mobile.urlHistory.getActive().url; hasHash = ( url.indexOf( hashkey ) > -1 ) && !currentIsDialog; urlHistory = $.mobile.urlHistory; if ( hasHash ) { self._open( options ); self._bindContainerClose(); return; } // if the current url has no dialog hash key proceed as normal // otherwise, if the page is a dialog simply tack on the hash key if ( url.indexOf( hashkey ) === -1 && !currentIsDialog ){ url = url + hashkey; } else { url = $.mobile.path.parseLocation().hash + hashkey; } // Tack on an extra hashkey if this is the first page and we've just reconstructed the initial hash if ( urlHistory.activeIndex === 0 && url === urlHistory.initialDst ) { url += hashkey; } // swallow the the initial navigation event, and bind for the next opts.container.one( opts.navigateEvents, function( e ) { e.preventDefault(); self._open( options ); self._bindContainerClose(); }); urlHistory.ignoreNextHashChange = currentIsDialog; // Gotta love methods with 1mm args :( urlHistory.addNew( url, undefined, undefined, undefined, "dialog" ); // set the new url with (or without) the new dialog hash key $.mobile.path.set( url ); }, close: function() { // make sure close is idempotent if( !$.mobile.popup.active ){ return; } if( this.options.history ) { $.mobile.back(); } else { this._close(); } } }); // TODO this can be moved inside the widget $.mobile.popup.handleLink = function( $link ) { var closestPage = $link.closest( ":jqmData(role='page')" ), scope = ( ( closestPage.length === 0 ) ? $( "body" ) : closestPage ), // NOTE make sure to get only the hash, ie7 (wp7) return the absolute href // in this case ruining the element selection popup = $( $.mobile.path.parseUrl($link.attr( "href" )).hash, scope[0] ), offset; if ( popup.data( "popup" ) ) { offset = $link.offset(); popup.popup( "open", { x: offset.left + $link.outerWidth() / 2, y: offset.top + $link.outerHeight() / 2, transition: $link.jqmData( "transition" ), positionTo: $link.jqmData( "position-to" ), link: $link }); } //remove after delay setTimeout( function() { $link.removeClass( $.mobile.activeBtnClass ); }, 300 ); }; // TODO move inside _create $( document ).bind( "pagebeforechange", function( e, data ) { if ( data.options.role === "popup" ) { $.mobile.popup.handleLink( data.options.link ); e.preventDefault(); } }); $( document ).bind( "pagecreate create", function( e ) { $.mobile.popup.prototype.enhanceWithin( e.target, true ); }); })( jQuery ); (function( $ ) { var meta = $( "meta[name=viewport]" ), initialContent = meta.attr( "content" ), disabledZoom = initialContent + ",maximum-scale=1, user-scalable=no", enabledZoom = initialContent + ",maximum-scale=10, user-scalable=yes", disabledInitially = /(user-scalable[\s]*=[\s]*no)|(maximum-scale[\s]*=[\s]*1)[$,\s]/.test( initialContent ); $.mobile.zoom = $.extend( {}, { enabled: !disabledInitially, locked: false, disable: function( lock ) { if ( !disabledInitially && !$.mobile.zoom.locked ) { meta.attr( "content", disabledZoom ); $.mobile.zoom.enabled = false; $.mobile.zoom.locked = lock || false; } }, enable: function( unlock ) { if ( !disabledInitially && ( !$.mobile.zoom.locked || unlock === true ) ) { meta.attr( "content", enabledZoom ); $.mobile.zoom.enabled = true; $.mobile.zoom.locked = false; } }, restore: function() { if ( !disabledInitially ) { meta.attr( "content", initialContent ); $.mobile.zoom.enabled = true; } } }); }( jQuery )); (function( $, undefined ) { $.widget( "mobile.textinput", $.mobile.widget, { options: { theme: null, // This option defaults to true on iOS devices. preventFocusZoom: /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1, initSelector: "input[type='text'], input[type='search'], :jqmData(type='search'), input[type='number'], :jqmData(type='number'), input[type='password'], input[type='email'], input[type='url'], input[type='tel'], textarea, input[type='time'], input[type='date'], input[type='month'], input[type='week'], input[type='datetime'], input[type='datetime-local'], input[type='color'], input:not([type])", clearSearchButtonText: "clear text", disabled: false }, _create: function() { var self = this, input = this.element, o = this.options, theme = o.theme || $.mobile.getInheritedTheme( this.element, "c" ), themeclass = " ui-body-" + theme, mini = input.jqmData( "mini" ) === true, miniclass = mini ? " ui-mini" : "", focusedEl, clearbtn; function toggleClear() { setTimeout( function() { clearbtn.toggleClass( "ui-input-clear-hidden", !input.val() ); }, 0 ); } $( "label[for='" + input.attr( "id" ) + "']" ).addClass( "ui-input-text" ); focusedEl = input.addClass("ui-input-text ui-body-"+ theme ); // XXX: Temporary workaround for issue 785 (Apple bug 8910589). // Turn off autocorrect and autocomplete on non-iOS 5 devices // since the popup they use can't be dismissed by the user. Note // that we test for the presence of the feature by looking for // the autocorrect property on the input element. We currently // have no test for iOS 5 or newer so we're temporarily using // the touchOverflow support flag for jQM 1.0. Yes, I feel dirty. - jblas if ( typeof input[0].autocorrect !== "undefined" && !$.support.touchOverflow ) { // Set the attribute instead of the property just in case there // is code that attempts to make modifications via HTML. input[0].setAttribute( "autocorrect", "off" ); input[0].setAttribute( "autocomplete", "off" ); } //"search" input widget if ( input.is( "[type='search'],:jqmData(type='search')" ) ) { focusedEl = input.wrap( "<div class='ui-input-search ui-shadow-inset ui-btn-corner-all ui-btn-shadow ui-icon-searchfield" + themeclass + miniclass + "'></div>" ).parent(); clearbtn = $( "<a href='#' class='ui-input-clear' title='" + o.clearSearchButtonText + "'>" + o.clearSearchButtonText + "</a>" ) .bind('click', function( event ) { input .val( "" ) .focus() .trigger( "change" ); clearbtn.addClass( "ui-input-clear-hidden" ); event.preventDefault(); }) .appendTo( focusedEl ) .buttonMarkup({ icon: "delete", iconpos: "notext", corners: true, shadow: true, mini: mini }); toggleClear(); input.bind( 'paste cut keyup focus change blur', toggleClear ); } else { input.addClass( "ui-corner-all ui-shadow-inset" + themeclass + miniclass ); } input.focus(function() { focusedEl.addClass( $.mobile.focusClass ); }) .blur(function() { focusedEl.removeClass( $.mobile.focusClass ); }) // In many situations, iOS will zoom into the select upon tap, this prevents that from happening .bind( "focus", function() { if ( o.preventFocusZoom ) { $.mobile.zoom.disable( true ); } }) .bind( "blur", function() { if ( o.preventFocusZoom ) { $.mobile.zoom.enable( true ); } }); // Autogrow if ( input.is( "textarea" ) ) { var extraLineHeight = 15, keyupTimeoutBuffer = 100, keyupTimeout; this._keyup = function() { var scrollHeight = input[ 0 ].scrollHeight, clientHeight = input[ 0 ].clientHeight; if ( clientHeight < scrollHeight ) { input.height(scrollHeight + extraLineHeight); } }; input.keyup(function() { clearTimeout( keyupTimeout ); keyupTimeout = setTimeout( self._keyup, keyupTimeoutBuffer ); }); // binding to pagechange here ensures that for pages loaded via // ajax the height is recalculated without user input this._on( $(document), {"pagechange": "_keyup" }); // Issue 509: the browser is not providing scrollHeight properly until the styles load if ( $.trim( input.val() ) ) { // bind to the window load to make sure the height is calculated based on BOTH // the DOM and CSS this._on( $(window), {"load": "_keyup"}); } } if ( input.attr( "disabled" ) ) { this.disable(); } }, disable: function() { var $el; if ( this.element.attr( "disabled", true ).is( "[type='search'], :jqmData(type='search')" ) ) { $el = this.element.parent(); } else { $el = this.element; } $el.addClass( "ui-disabled" ); return this._setOption( "disabled", true ); }, enable: function() { var $el; // TODO using more than one line of code is acceptable ;) if ( this.element.attr( "disabled", false ).is( "[type='search'], :jqmData(type='search')" ) ) { $el = this.element.parent(); } else { $el = this.element; } $el.removeClass( "ui-disabled" ); return this._setOption( "disabled", false ); } }); //auto self-init widgets $( document ).bind( "pagecreate create", function( e ) { $.mobile.textinput.prototype.enhanceWithin( e.target, true ); }); })( jQuery ); (function( $, undefined ) { $.mobile.listview.prototype.options.filter = false; $.mobile.listview.prototype.options.filterPlaceholder = "Filter items..."; $.mobile.listview.prototype.options.filterTheme = "c"; // TODO rename callback/deprecate and default to the item itself as the first argument var defaultFilterCallback = function( text, searchValue, item ) { return text.toString().toLowerCase().indexOf( searchValue ) === -1; }; $.mobile.listview.prototype.options.filterCallback = defaultFilterCallback; $( document ).delegate( ":jqmData(role='listview')", "listviewcreate", function() { var list = $( this ), listview = list.data( "listview" ); if ( !listview.options.filter ) { return; } var wrapper = $( "<form>", { "class": "ui-listview-filter ui-bar-" + listview.options.filterTheme, "role": "search" }), search = $( "<input>", { placeholder: listview.options.filterPlaceholder }) .attr( "data-" + $.mobile.ns + "type", "search" ) .jqmData( "lastval", "" ) .bind( "keyup change", function() { var $this = $( this ), val = this.value.toLowerCase(), listItems = null, lastval = $this.jqmData( "lastval" ) + "", childItems = false, itemtext = "", item, // Check if a custom filter callback applies isCustomFilterCallback = listview.options.filterCallback !== defaultFilterCallback; listview._trigger( "beforefilter", "beforefilter", { input: this } ); // Change val as lastval for next execution $this.jqmData( "lastval" , val ); if ( isCustomFilterCallback || val.length < lastval.length || val.indexOf( lastval ) !== 0 ) { // Custom filter callback applies or removed chars or pasted something totally different, check all items listItems = list.children(); } else { // Only chars added, not removed, only use visible subset listItems = list.children( ":not(.ui-screen-hidden)" ); } if ( val ) { // This handles hiding regular rows without the text we search for // and any list dividers without regular rows shown under it for ( var i = listItems.length - 1; i >= 0; i-- ) { item = $( listItems[ i ] ); itemtext = item.jqmData( "filtertext" ) || item.text(); if ( item.is( "li:jqmData(role=list-divider)" ) ) { item.toggleClass( "ui-filter-hidequeue" , !childItems ); // New bucket! childItems = false; } else if ( listview.options.filterCallback( itemtext, val, item ) ) { //mark to be hidden item.toggleClass( "ui-filter-hidequeue" , true ); } else { // There's a shown item in the bucket childItems = true; } } // Show items, not marked to be hidden listItems .filter( ":not(.ui-filter-hidequeue)" ) .toggleClass( "ui-screen-hidden", false ); // Hide items, marked to be hidden listItems .filter( ".ui-filter-hidequeue" ) .toggleClass( "ui-screen-hidden", true ) .toggleClass( "ui-filter-hidequeue", false ); } else { //filtervalue is empty => show all listItems.toggleClass( "ui-screen-hidden", false ); } listview._refreshCorners(); }) .appendTo( wrapper ) .textinput(); if ( listview.options.inset ) { wrapper.addClass( "ui-listview-filter-inset" ); } wrapper.bind( "submit", function() { return false; }) .insertBefore( list ); }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.slider", $.mobile.widget, { widgetEventPrefix: "slide", options: { theme: null, trackTheme: null, disabled: false, initSelector: "input[type='range'], :jqmData(type='range'), :jqmData(role='slider')", mini: false }, _create: function() { // TODO: Each of these should have comments explain what they're for var self = this, control = this.element, parentTheme = $.mobile.getInheritedTheme( control, "c" ), theme = this.options.theme || parentTheme, trackTheme = this.options.trackTheme || parentTheme, cType = control[ 0 ].nodeName.toLowerCase(), selectClass = ( cType === "select" ) ? "ui-slider-switch" : "", controlID = control.attr( "id" ), $label = $( "[for='" + controlID + "']" ), labelID = $label.attr( "id" ) || controlID + "-label", label = $label.attr( "id", labelID ), val = function() { return cType === "input" ? parseFloat( control.val() ) : control[0].selectedIndex; }, min = cType === "input" ? parseFloat( control.attr( "min" ) ) : 0, max = cType === "input" ? parseFloat( control.attr( "max" ) ) : control.find( "option" ).length-1, step = window.parseFloat( control.attr( "step" ) || 1 ), inlineClass = ( this.options.inline || control.jqmData( "inline" ) === true ) ? " ui-slider-inline" : "", miniClass = ( this.options.mini || control.jqmData( "mini" ) ) ? " ui-slider-mini" : "", domHandle = document.createElement( 'a' ), handle = $( domHandle ), domSlider = document.createElement( 'div' ), slider = $( domSlider ), valuebg = control.jqmData( "highlight" ) && cType !== "select" ? (function() { var bg = document.createElement('div'); bg.className = 'ui-slider-bg ' + $.mobile.activeBtnClass + ' ui-btn-corner-all'; return $( bg ).prependTo( slider ); })() : false, options; this._type = cType; domHandle.setAttribute( 'href', "#" ); domSlider.setAttribute('role','application'); domSlider.className = ['ui-slider ',selectClass," ui-btn-down-",trackTheme,' ui-btn-corner-all', inlineClass, miniClass].join( "" ); domHandle.className = 'ui-slider-handle'; domSlider.appendChild( domHandle ); handle.buttonMarkup({ corners: true, theme: theme, shadow: true }) .attr({ "role": "slider", "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": val(), "aria-valuetext": val(), "title": val(), "aria-labelledby": labelID }); $.extend( this, { slider: slider, handle: handle, valuebg: valuebg, dragging: false, beforeStart: null, userModified: false, mouseMoved: false }); if ( cType === "select" ) { var wrapper = document.createElement('div'); wrapper.className = 'ui-slider-inneroffset'; for ( var j = 0,length = domSlider.childNodes.length;j < length;j++ ) { wrapper.appendChild( domSlider.childNodes[j] ); } domSlider.appendChild( wrapper ); // slider.wrapInner( "<div class='ui-slider-inneroffset'></div>" ); // make the handle move with a smooth transition handle.addClass( "ui-slider-handle-snapping" ); options = control.find( "option" ); for ( var i = 0, optionsCount = options.length; i < optionsCount; i++ ) { var side = !i ? "b" : "a", sliderTheme = !i ? " ui-btn-down-" + trackTheme : ( " " + $.mobile.activeBtnClass ), sliderLabel = document.createElement( 'div' ), sliderImg = document.createElement( 'span' ); sliderImg.className = ['ui-slider-label ui-slider-label-',side,sliderTheme," ui-btn-corner-all"].join( "" ); sliderImg.setAttribute('role','img'); sliderImg.appendChild( document.createTextNode( options[i].innerHTML ) ); $(sliderImg).prependTo( slider ); } self._labels = $( ".ui-slider-label", slider ); } label.addClass( "ui-slider" ); // monitor the input for updated values control.addClass( cType === "input" ? "ui-slider-input" : "ui-slider-switch" ) .change(function() { // if the user dragged the handle, the "change" event was triggered from inside refresh(); don't call refresh() again if ( !self.mouseMoved ) { self.refresh( val(), true ); } }) .keyup(function() { // necessary? self.refresh( val(), true, true ); }) .blur(function() { self.refresh( val(), true ); }); this._preventDocumentDrag = function( event ) { // NOTE: we don't do this in refresh because we still want to // support programmatic alteration of disabled inputs if ( self.dragging && !self.options.disabled ) { // self.mouseMoved must be updated before refresh() because it will be used in the control "change" event self.mouseMoved = true; if ( cType === "select" ) { // make the handle move in sync with the mouse handle.removeClass( "ui-slider-handle-snapping" ); } self.refresh( event ); // only after refresh() you can calculate self.userModified self.userModified = self.beforeStart !== control[0].selectedIndex; return false; } } this._on( $( document ), { "vmousemove": this._preventDocumentDrag }); // it appears the clicking the up and down buttons in chrome on // range/number inputs doesn't trigger a change until the field is // blurred. Here we check thif the value has changed and refresh control.bind( "vmouseup", $.proxy( self._checkedRefresh, self)); slider.bind( "vmousedown", function( event ) { // NOTE: we don't do this in refresh because we still want to // support programmatic alteration of disabled inputs if ( self.options.disabled ) { return false; } self.dragging = true; self.userModified = false; self.mouseMoved = false; if ( cType === "select" ) { self.beforeStart = control[0].selectedIndex; } self.refresh( event ); self._trigger( "start" ); return false; }) .bind( "vclick", false ); this._sliderMouseUp = function() { if ( self.dragging ) { self.dragging = false; if ( cType === "select") { // make the handle move with a smooth transition handle.addClass( "ui-slider-handle-snapping" ); if ( self.mouseMoved ) { // this is a drag, change the value only if user dragged enough if ( self.userModified ) { self.refresh( self.beforeStart === 0 ? 1 : 0 ); } else { self.refresh( self.beforeStart ); } } else { // this is just a click, change the value self.refresh( self.beforeStart === 0 ? 1 : 0 ); } } self.mouseMoved = false; self._trigger( "stop" ); return false; } }; this._on( slider.add( document ), { "vmouseup": this._sliderMouseUp }); slider.insertAfter( control ); // Only add focus class to toggle switch, sliders get it automatically from ui-btn if ( cType === 'select' ) { this.handle.bind({ focus: function() { slider.addClass( $.mobile.focusClass ); }, blur: function() { slider.removeClass( $.mobile.focusClass ); } }); } this.handle.bind({ // NOTE force focus on handle vmousedown: function() { $( this ).focus(); }, vclick: false, keydown: function( event ) { var index = val(); if ( self.options.disabled ) { return; } // In all cases prevent the default and mark the handle as active switch ( event.keyCode ) { case $.mobile.keyCode.HOME: case $.mobile.keyCode.END: case $.mobile.keyCode.PAGE_UP: case $.mobile.keyCode.PAGE_DOWN: case $.mobile.keyCode.UP: case $.mobile.keyCode.RIGHT: case $.mobile.keyCode.DOWN: case $.mobile.keyCode.LEFT: event.preventDefault(); if ( !self._keySliding ) { self._keySliding = true; $( this ).addClass( "ui-state-active" ); } break; } // move the slider according to the keypress switch ( event.keyCode ) { case $.mobile.keyCode.HOME: self.refresh( min ); break; case $.mobile.keyCode.END: self.refresh( max ); break; case $.mobile.keyCode.PAGE_UP: case $.mobile.keyCode.UP: case $.mobile.keyCode.RIGHT: self.refresh( index + step ); break; case $.mobile.keyCode.PAGE_DOWN: case $.mobile.keyCode.DOWN: case $.mobile.keyCode.LEFT: self.refresh( index - step ); break; } }, // remove active mark keyup: function( event ) { if ( self._keySliding ) { self._keySliding = false; $( this ).removeClass( "ui-state-active" ); } } }); this.refresh( undefined, undefined, true ); }, _checkedRefresh: function() { if( this.value != this._value() ){ this.refresh( this._value() ); } }, _value: function() { return this._type === "input" ? parseFloat( this.element.val() ) : this.element[0].selectedIndex; }, refresh: function( val, isfromControl, preventInputUpdate ) { // NOTE: we don't return here because we want to support programmatic // alteration of the input value, which should still update the slider if ( this.options.disabled || this.element.attr('disabled')) { this.disable(); } // set the stored value for comparison later this.value = this._value(); var control = this.element, percent, cType = control[0].nodeName.toLowerCase(), min = cType === "input" ? parseFloat( control.attr( "min" ) ) : 0, max = cType === "input" ? parseFloat( control.attr( "max" ) ) : control.find( "option" ).length - 1, step = ( cType === "input" && parseFloat( control.attr( "step" ) ) > 0 ) ? parseFloat( control.attr( "step" ) ) : 1; if ( typeof val === "object" ) { var data = val, // a slight tolerance helped get to the ends of the slider tol = 8; if ( !this.dragging || data.pageX < this.slider.offset().left - tol || data.pageX > this.slider.offset().left + this.slider.width() + tol ) { return; } percent = Math.round( ( ( data.pageX - this.slider.offset().left ) / this.slider.width() ) * 100 ); } else { if ( val == null ) { val = cType === "input" ? parseFloat( control.val() || 0 ) : control[0].selectedIndex; } percent = ( parseFloat( val ) - min ) / ( max - min ) * 100; } if ( isNaN( percent ) ) { return; } if ( percent < 0 ) { percent = 0; } if ( percent > 100 ) { percent = 100; } var newval = ( percent / 100 ) * ( max - min ) + min; //from jQuery UI slider, the following source will round to the nearest step var valModStep = ( newval - min ) % step; var alignValue = newval - valModStep; if ( Math.abs( valModStep ) * 2 >= step ) { alignValue += ( valModStep > 0 ) ? step : ( -step ); } // Since JavaScript has problems with large floats, round // the final value to 5 digits after the decimal point (see jQueryUI: #4124) newval = parseFloat( alignValue.toFixed(5) ); if ( newval < min ) { newval = min; } if ( newval > max ) { newval = max; } this.handle.css( "left", percent + "%" ); this.handle.attr( { "aria-valuenow": cType === "input" ? newval : control.find( "option" ).eq( newval ).attr( "value" ), "aria-valuetext": cType === "input" ? newval : control.find( "option" ).eq( newval ).getEncodedText(), title: cType === "input" ? newval : control.find( "option" ).eq( newval ).getEncodedText() }); if ( this.valuebg ) { this.valuebg.css( "width", percent + "%" ); } // drag the label widths if ( this._labels ) { var handlePercent = this.handle.width() / this.slider.width() * 100, aPercent = percent && handlePercent + ( 100 - handlePercent ) * percent / 100, bPercent = percent === 100 ? 0 : Math.min( handlePercent + 100 - aPercent, 100 ); this._labels.each(function() { var ab = $( this ).is( ".ui-slider-label-a" ); $( this ).width( ( ab ? aPercent : bPercent ) + "%" ); }); } if ( !preventInputUpdate ) { var valueChanged = false; // update control"s value if ( cType === "input" ) { valueChanged = control.val() !== newval; control.val( newval ); } else { valueChanged = control[ 0 ].selectedIndex !== newval; control[ 0 ].selectedIndex = newval; } if ( !isfromControl && valueChanged ) { control.trigger( "change" ); } } }, enable: function() { this.element.attr( "disabled", false ); this.slider.removeClass( "ui-disabled" ).attr( "aria-disabled", false ); return this._setOption( "disabled", false ); }, disable: function() { this.element.attr( "disabled", true ); this.slider.addClass( "ui-disabled" ).attr( "aria-disabled", true ); return this._setOption( "disabled", true ); } }); //auto self-init widgets $( document ).bind( "pagecreate create", function( e ) { $.mobile.slider.prototype.enhanceWithin( e.target, true ); }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.selectmenu", $.mobile.widget, { options: { theme: null, disabled: false, icon: "arrow-d", iconpos: "right", inline: false, corners: true, shadow: true, iconshadow: true, overlayTheme: "a", hidePlaceholderMenuItems: true, closeText: "Close", nativeMenu: true, // This option defaults to true on iOS devices. preventFocusZoom: /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1, initSelector: "select:not( :jqmData(role='slider') )", mini: false }, _button: function() { return $( "<div/>" ); }, _setDisabled: function( value ) { this.element.attr( "disabled", value ); this.button.attr( "aria-disabled", value ); return this._setOption( "disabled", value ); }, _focusButton : function() { var self = this; setTimeout( function() { self.button.focus(); }, 40); }, _selectOptions: function() { return this.select.find( "option" ); }, // setup items that are generally necessary for select menu extension _preExtension: function() { var classes = ""; // TODO: Post 1.1--once we have time to test thoroughly--any classes manually applied to the original element should be carried over to the enhanced element, with an `-enhanced` suffix. See https://github.com/jquery/jquery-mobile/issues/3577 /* if ( $el[0].className.length ) { classes = $el[0].className; } */ if ( !!~this.element[0].className.indexOf( "ui-btn-left" ) ) { classes = " ui-btn-left"; } if ( !!~this.element[0].className.indexOf( "ui-btn-right" ) ) { classes = " ui-btn-right"; } this.select = this.element.wrap( "<div class='ui-select" + classes + "'>" ); this.selectID = this.select.attr( "id" ); this.label = $( "label[for='"+ this.selectID +"']" ).addClass( "ui-select" ); this.isMultiple = this.select[ 0 ].multiple; if ( !this.options.theme ) { this.options.theme = $.mobile.getInheritedTheme( this.select, "c" ); } }, _create: function() { this._preExtension(); // Allows for extension of the native select for custom selects and other plugins // see select.custom for example extension // TODO explore plugin registration this._trigger( "beforeCreate" ); this.button = this._button(); var self = this, options = this.options, inline = options.inline || this.select.jqmData( "inline" ), mini = options.mini || this.select.jqmData( "mini" ), iconpos = options.icon ? ( options.iconpos || this.select.jqmData( "iconpos" ) ) : false, // IE throws an exception at options.item() function when // there is no selected item // select first in this case selectedIndex = this.select[ 0 ].selectedIndex === -1 ? 0 : this.select[ 0 ].selectedIndex, // TODO values buttonId and menuId are undefined here button = this.button .insertBefore( this.select ) .buttonMarkup( { theme: options.theme, icon: options.icon, iconpos: iconpos, inline: inline, corners: options.corners, shadow: options.shadow, iconshadow: options.iconshadow, mini: mini }); this.setButtonText(); // Opera does not properly support opacity on select elements // In Mini, it hides the element, but not its text // On the desktop,it seems to do the opposite // for these reasons, using the nativeMenu option results in a full native select in Opera if ( options.nativeMenu && window.opera && window.opera.version ) { button.addClass( "ui-select-nativeonly" ); } // Add counter for multi selects if ( this.isMultiple ) { this.buttonCount = $( "<span>" ) .addClass( "ui-li-count ui-btn-up-c ui-btn-corner-all" ) .hide() .appendTo( button.addClass('ui-li-has-count') ); } // Disable if specified if ( options.disabled || this.element.attr('disabled')) { this.disable(); } // Events on native select this.select.change(function() { self.refresh(); }); this.build(); }, build: function() { var self = this; this.select .appendTo( self.button ) .bind( "vmousedown", function() { // Add active class to button self.button.addClass( $.mobile.activeBtnClass ); }) .bind( "focus", function() { self.button.addClass( $.mobile.focusClass ); }) .bind( "blur", function() { self.button.removeClass( $.mobile.focusClass ); }) .bind( "focus vmouseover", function() { self.button.trigger( "vmouseover" ); }) .bind( "vmousemove", function() { // Remove active class on scroll/touchmove self.button.removeClass( $.mobile.activeBtnClass ); }) .bind( "change blur vmouseout", function() { self.button.trigger( "vmouseout" ) .removeClass( $.mobile.activeBtnClass ); }) .bind( "change blur", function() { self.button.removeClass( "ui-btn-down-" + self.options.theme ); }); // In many situations, iOS will zoom into the select upon tap, this prevents that from happening self.button.bind( "vmousedown", function() { if ( self.options.preventFocusZoom ) { $.mobile.zoom.disable( true ); } }).bind( "mouseup", function() { if ( self.options.preventFocusZoom ) { setTimeout(function() { $.mobile.zoom.enable( true ); }, 0); } }); }, selected: function() { return this._selectOptions().filter( ":selected" ); }, selectedIndices: function() { var self = this; return this.selected().map(function() { return self._selectOptions().index( this ); }).get(); }, setButtonText: function() { var self = this, selected = this.selected(), text = this.placeholder, span = $( document.createElement( "span" ) ); this.button.find( ".ui-btn-text" ).html(function() { if ( selected.length ) { text = selected.map(function() { return $( this ).text(); }).get().join( ", " ); } else { text = self.placeholder; } // TODO possibly aggregate multiple select option classes return span.text( text ) .addClass( self.select.attr( "class" ) ) .addClass( selected.attr( "class" ) ); }); }, setButtonCount: function() { var selected = this.selected(); // multiple count inside button if ( this.isMultiple ) { this.buttonCount[ selected.length > 1 ? "show" : "hide" ]().text( selected.length ); } }, refresh: function() { this.setButtonText(); this.setButtonCount(); }, // open and close preserved in native selects // to simplify users code when looping over selects open: $.noop, close: $.noop, disable: function() { this._setDisabled( true ); this.button.addClass( "ui-disabled" ); }, enable: function() { this._setDisabled( false ); this.button.removeClass( "ui-disabled" ); } }); //auto self-init widgets $( document ).bind( "pagecreate create", function( e ) { $.mobile.selectmenu.prototype.enhanceWithin( e.target, true ); }); })( jQuery ); /* * custom "selectmenu" plugin */ (function( $, undefined ) { var extendSelect = function( widget ) { var select = widget.select, selectID = widget.selectID, label = widget.label, thisPage = widget.select.closest( ".ui-page" ), selectOptions = widget._selectOptions(), isMultiple = widget.isMultiple = widget.select[ 0 ].multiple, buttonId = selectID + "-button", menuId = selectID + "-menu", menuPage = $( "<div data-" + $.mobile.ns + "role='dialog' data-" +$.mobile.ns + "theme='"+ widget.options.theme +"' data-" +$.mobile.ns + "overlay-theme='"+ widget.options.overlayTheme +"'>" + "<div data-" + $.mobile.ns + "role='header'>" + "<div class='ui-title'>" + label.getEncodedText() + "</div>"+ "</div>"+ "<div data-" + $.mobile.ns + "role='content'></div>"+ "</div>" ), listbox = $( "<div>", { "class": "ui-selectmenu" } ).insertAfter( widget.select ).popup( { theme: "a" } ), list = $( "<ul>", { "class": "ui-selectmenu-list", "id": menuId, "role": "listbox", "aria-labelledby": buttonId }).attr( "data-" + $.mobile.ns + "theme", widget.options.theme ).appendTo( listbox ), header = $( "<div>", { "class": "ui-header ui-bar-" + widget.options.theme }).prependTo( listbox ), headerTitle = $( "<h1>", { "class": "ui-title" }).appendTo( header ), menuPageContent, menuPageClose, headerClose; if ( widget.isMultiple ) { headerClose = $( "<a>", { "text": widget.options.closeText, "href": "#", "class": "ui-btn-left" }).attr( "data-" + $.mobile.ns + "iconpos", "notext" ).attr( "data-" + $.mobile.ns + "icon", "delete" ).appendTo( header ).buttonMarkup(); } $.extend( widget, { select: widget.select, selectID: selectID, buttonId: buttonId, menuId: menuId, thisPage: thisPage, menuPage: menuPage, label: label, selectOptions: selectOptions, isMultiple: isMultiple, theme: widget.options.theme, listbox: listbox, list: list, header: header, headerTitle: headerTitle, headerClose: headerClose, menuPageContent: menuPageContent, menuPageClose: menuPageClose, placeholder: "", build: function() { var self = this; // Create list from select, update state self.refresh(); self.select.attr( "tabindex", "-1" ).focus(function() { $( this ).blur(); self.button.focus(); }); // Button events self.button.bind( "vclick keydown" , function( event ) { if (event.type === "vclick" || event.keyCode && (event.keyCode === $.mobile.keyCode.ENTER || event.keyCode === $.mobile.keyCode.SPACE)) { self.open(); event.preventDefault(); } }); // Events for list items self.list.attr( "role", "listbox" ) .bind( "focusin", function( e ) { $( e.target ) .attr( "tabindex", "0" ) .trigger( "vmouseover" ); }) .bind( "focusout", function( e ) { $( e.target ) .attr( "tabindex", "-1" ) .trigger( "vmouseout" ); }) .delegate( "li:not(.ui-disabled, .ui-li-divider)", "click", function( event ) { // index of option tag to be selected var oldIndex = self.select[ 0 ].selectedIndex, newIndex = self.list.find( "li:not(.ui-li-divider)" ).index( this ), option = self._selectOptions().eq( newIndex )[ 0 ]; // toggle selected status on the tag for multi selects option.selected = self.isMultiple ? !option.selected : true; // toggle checkbox class for multiple selects if ( self.isMultiple ) { $( this ).find( ".ui-icon" ) .toggleClass( "ui-icon-checkbox-on", option.selected ) .toggleClass( "ui-icon-checkbox-off", !option.selected ); } // trigger change if value changed if ( self.isMultiple || oldIndex !== newIndex ) { self.select.trigger( "change" ); } // hide custom select for single selects only - otherwise focus clicked item // We need to grab the clicked item the hard way, because the list may have been rebuilt if ( self.isMultiple ) { self.list.find( "li:not(.ui-li-divider)" ).eq( newIndex ) .addClass( "ui-btn-down-" + widget.options.theme ).find( "a" ).first().focus(); } else { self.close(); } event.preventDefault(); }) .keydown(function( event ) { //keyboard events for menu items var target = $( event.target ), li = target.closest( "li" ), prev, next; // switch logic based on which key was pressed switch ( event.keyCode ) { // up or left arrow keys case 38: prev = li.prev().not( ".ui-selectmenu-placeholder" ); if ( prev.is( ".ui-li-divider" ) ) { prev = prev.prev(); } // if there's a previous option, focus it if ( prev.length ) { target .blur() .attr( "tabindex", "-1" ); prev.addClass( "ui-btn-down-" + widget.options.theme ).find( "a" ).first().focus(); } return false; // down or right arrow keys case 40: next = li.next(); if ( next.is( ".ui-li-divider" ) ) { next = next.next(); } // if there's a next option, focus it if ( next.length ) { target .blur() .attr( "tabindex", "-1" ); next.addClass( "ui-btn-down-" + widget.options.theme ).find( "a" ).first().focus(); } return false; // If enter or space is pressed, trigger click case 13: case 32: target.trigger( "click" ); return false; } }); // button refocus ensures proper height calculation // by removing the inline style and ensuring page inclusion self.menuPage.bind( "pagehide", function() { self.list.appendTo( self.listbox ); self._focusButton(); // TODO centralize page removal binding / handling in the page plugin. // Suggestion from @jblas to do refcounting // // TODO extremely confusing dependency on the open method where the pagehide.remove // bindings are stripped to prevent the parent page from disappearing. The way // we're keeping pages in the DOM right now sucks // // rebind the page remove that was unbound in the open function // to allow for the parent page removal from actions other than the use // of a dialog sized custom select // // doing this here provides for the back button on the custom select dialog $.mobile._bindPageRemove.call( self.thisPage ); }); // Events on the popup self.listbox.bind( "popupafterclose", function( event ) { self.close(); }); // Close button on small overlays if ( self.isMultiple ) { self.headerClose.click(function() { if ( self.menuType === "overlay" ) { self.close(); return false; } }); } // track this dependency so that when the parent page // is removed on pagehide it will also remove the menupage self.thisPage.addDependents( this.menuPage ); }, _isRebuildRequired: function() { var list = this.list.find( "li" ), options = this._selectOptions(); // TODO exceedingly naive method to determine difference // ignores value changes etc in favor of a forcedRebuild // from the user in the refresh method return options.text() !== list.text(); }, selected: function() { return this._selectOptions().filter( ":selected:not( :jqmData(placeholder='true') )" ); }, refresh: function( forceRebuild , foo ) { var self = this, select = this.element, isMultiple = this.isMultiple, indicies; if ( forceRebuild || this._isRebuildRequired() ) { self._buildList(); } indicies = this.selectedIndices(); self.setButtonText(); self.setButtonCount(); self.list.find( "li:not(.ui-li-divider)" ) .removeClass( $.mobile.activeBtnClass ) .attr( "aria-selected", false ) .each(function( i ) { if ( $.inArray( i, indicies ) > -1 ) { var item = $( this ); // Aria selected attr item.attr( "aria-selected", true ); // Multiple selects: add the "on" checkbox state to the icon if ( self.isMultiple ) { item.find( ".ui-icon" ).removeClass( "ui-icon-checkbox-off" ).addClass( "ui-icon-checkbox-on" ); } else { if ( item.is( ".ui-selectmenu-placeholder" ) ) { item.next().addClass( $.mobile.activeBtnClass ); } else { item.addClass( $.mobile.activeBtnClass ); } } } }); }, close: function() { if ( this.options.disabled || !this.isOpen ) { return; } var self = this; if ( self.menuType === "page" ) { // doesn't solve the possible issue with calling change page // where the objects don't define data urls which prevents dialog key // stripping - changePage has incoming refactor $.mobile.back(); } else { self.listbox.popup( "close" ); self.list.appendTo( self.listbox ); self._focusButton(); } // allow the dialog to be closed again self.isOpen = false; }, open: function() { if ( this.options.disabled ) { return; } var self = this, $window = $( window ), selfListParent = self.list.parent(), menuHeight = selfListParent.outerHeight(), menuWidth = selfListParent.outerWidth(), activePage = $( "." + $.mobile.activePageClass ), scrollTop = $window.scrollTop(), btnOffset = self.button.offset().top, screenHeight = $window.height(), screenWidth = $window.width(); //add active class to button self.button.addClass( $.mobile.activeBtnClass ); //remove after delay setTimeout( function() { self.button.removeClass( $.mobile.activeBtnClass ); }, 300); function focusMenuItem() { var selector = self.list.find( "." + $.mobile.activeBtnClass + " a" ); if ( selector.length === 0 ) { selector = self.list.find( "li.ui-btn:not( :jqmData(placeholder='true') ) a" ); } selector.first().focus().closest( "li" ).addClass( "ui-btn-down-" + widget.options.theme ); } if ( menuHeight > screenHeight - 80 || !$.support.scrollTop ) { self.menuPage.appendTo( $.mobile.pageContainer ).page(); self.menuPageContent = menuPage.find( ".ui-content" ); self.menuPageClose = menuPage.find( ".ui-header a" ); // prevent the parent page from being removed from the DOM, // otherwise the results of selecting a list item in the dialog // fall into a black hole self.thisPage.unbind( "pagehide.remove" ); //for WebOS/Opera Mini (set lastscroll using button offset) if ( scrollTop === 0 && btnOffset > screenHeight ) { self.thisPage.one( "pagehide", function() { $( this ).jqmData( "lastScroll", btnOffset ); }); } self.menuPage.one( "pageshow", function() { focusMenuItem(); self.isOpen = true; }); self.menuType = "page"; self.menuPageContent.append( self.list ); self.menuPage.find("div .ui-title").text(self.label.text()); $.mobile.changePage( self.menuPage, { transition: $.mobile.defaultDialogTransition }); } else { self.menuType = "overlay"; self.listbox .one( "popupafteropen", focusMenuItem ) .popup( "open", { x: self.button.offset().left + self.button.outerWidth() / 2, y: self.button.offset().top + self.button.outerHeight() / 2 }); // duplicate with value set in page show for dialog sized selects self.isOpen = true; } }, _buildList: function() { var self = this, o = this.options, placeholder = this.placeholder, needPlaceholder = true, optgroups = [], lis = [], dataIcon = self.isMultiple ? "checkbox-off" : "false"; self.list.empty().filter( ".ui-listview" ).listview( "destroy" ); var $options = self.select.find( "option" ), numOptions = $options.length, select = this.select[ 0 ], dataPrefix = 'data-' + $.mobile.ns, dataIndexAttr = dataPrefix + 'option-index', dataIconAttr = dataPrefix + 'icon', dataRoleAttr = dataPrefix + 'role', dataPlaceholderAttr = dataPrefix + 'placeholder', fragment = document.createDocumentFragment(), isPlaceholderItem = false, optGroup; for (var i = 0; i < numOptions;i++, isPlaceholderItem = false) { var option = $options[i], $option = $( option ), parent = option.parentNode, text = $option.text(), anchor = document.createElement( 'a' ), classes = []; anchor.setAttribute( 'href', '#' ); anchor.appendChild( document.createTextNode( text ) ); // Are we inside an optgroup? if ( parent !== select && parent.nodeName.toLowerCase() === "optgroup" ) { var optLabel = parent.getAttribute( 'label' ); if ( optLabel !== optGroup ) { var divider = document.createElement( 'li' ); divider.setAttribute( dataRoleAttr, 'list-divider' ); divider.setAttribute( 'role', 'option' ); divider.setAttribute( 'tabindex', '-1' ); divider.appendChild( document.createTextNode( optLabel ) ); fragment.appendChild( divider ); optGroup = optLabel; } } if ( needPlaceholder && ( !option.getAttribute( "value" ) || text.length === 0 || $option.jqmData( "placeholder" ) ) ) { needPlaceholder = false; isPlaceholderItem = true; // If we have identified a placeholder, mark it retroactively in the select as well option.setAttribute( dataPlaceholderAttr, true ); if ( o.hidePlaceholderMenuItems ) { classes.push( "ui-selectmenu-placeholder" ); } if (!placeholder) { placeholder = self.placeholder = text; } } var item = document.createElement('li'); if ( option.disabled ) { classes.push( "ui-disabled" ); item.setAttribute('aria-disabled',true); } item.setAttribute( dataIndexAttr,i ); item.setAttribute( dataIconAttr, dataIcon ); if ( isPlaceholderItem ) { item.setAttribute( dataPlaceholderAttr, true ); } item.className = classes.join( " " ); item.setAttribute( 'role', 'option' ); anchor.setAttribute( 'tabindex', '-1' ); item.appendChild( anchor ); fragment.appendChild( item ); } self.list[0].appendChild( fragment ); // Hide header if it's not a multiselect and there's no placeholder if ( !this.isMultiple && !placeholder.length ) { this.header.hide(); } else { this.headerTitle.text( this.placeholder ); } // Now populated, create listview self.list.listview(); }, _button: function() { return $( "<a>", { "href": "#", "role": "button", // TODO value is undefined at creation "id": this.buttonId, "aria-haspopup": "true", // TODO value is undefined at creation "aria-owns": this.menuId }); } }); }; // issue #3894 - core doesn't trigger events on disabled delegates $( document ).bind( "selectmenubeforecreate", function( event ) { var selectmenuWidget = $( event.target ).data( "selectmenu" ); if ( !selectmenuWidget.options.nativeMenu && selectmenuWidget.element.parents( ":jqmData(role='popup')" ).length === 0 ) { extendSelect( selectmenuWidget ); } }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.fixedtoolbar", $.mobile.widget, { options: { visibleOnPageShow: true, disablePageZoom: true, transition: "slide", //can be none, fade, slide (slide maps to slideup or slidedown) fullscreen: false, tapToggle: true, tapToggleBlacklist: "a, button, input, select, textarea, .ui-header-fixed, .ui-footer-fixed, .ui-popup", hideDuringFocus: "input, textarea, select", updatePagePadding: true, trackPersistentToolbars: true, // Browser detection! Weeee, here we go... // Unfortunately, position:fixed is costly, not to mention probably impossible, to feature-detect accurately. // Some tests exist, but they currently return false results in critical devices and browsers, which could lead to a broken experience. // Testing fixed positioning is also pretty obtrusive to page load, requiring injected elements and scrolling the window // The following function serves to rule out some popular browsers with known fixed-positioning issues // This is a plugin option like any other, so feel free to improve or overwrite it supportBlacklist: function() { var w = window, ua = navigator.userAgent, platform = navigator.platform, // Rendering engine is Webkit, and capture major version wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ ), wkversion = !!wkmatch && wkmatch[ 1 ], ffmatch = ua.match( /Fennec\/([0-9]+)/ ), ffversion = !!ffmatch && ffmatch[ 1 ], operammobilematch = ua.match( /Opera Mobi\/([0-9]+)/ ), omversion = !!operammobilematch && operammobilematch[ 1 ]; if( // iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5) ( ( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf( "iPod" ) > -1 ) && wkversion && wkversion < 534 ) || // Opera Mini ( w.operamini && ({}).toString.call( w.operamini ) === "[object OperaMini]" ) || ( operammobilematch && omversion < 7458 ) || //Android lte 2.1: Platform is Android and Webkit version is less than 533 (Android 2.2) ( ua.indexOf( "Android" ) > -1 && wkversion && wkversion < 533 ) || // Firefox Mobile before 6.0 - ( ffversion && ffversion < 6 ) || // WebOS less than 3 ( "palmGetResource" in window && wkversion && wkversion < 534 ) || // MeeGo ( ua.indexOf( "MeeGo" ) > -1 && ua.indexOf( "NokiaBrowser/8.5.0" ) > -1 ) ) { return true; } return false; }, initSelector: ":jqmData(position='fixed')" }, _create: function() { var self = this, o = self.options, $el = self.element, tbtype = $el.is( ":jqmData(role='header')" ) ? "header" : "footer", $page = $el.closest( ".ui-page" ); // Feature detecting support for if ( o.supportBlacklist() ) { self.destroy(); return; } $el.addClass( "ui-"+ tbtype +"-fixed" ); // "fullscreen" overlay positioning if ( o.fullscreen ) { $el.addClass( "ui-"+ tbtype +"-fullscreen" ); $page.addClass( "ui-page-" + tbtype + "-fullscreen" ); } // If not fullscreen, add class to page to set top or bottom padding else{ $page.addClass( "ui-page-" + tbtype + "-fixed" ); } self._addTransitionClass(); self._bindPageEvents(); self._bindToggleHandlers(); }, _addTransitionClass: function() { var tclass = this.options.transition; if ( tclass && tclass !== "none" ) { // use appropriate slide for header or footer if ( tclass === "slide" ) { tclass = this.element.is( ".ui-header" ) ? "slidedown" : "slideup"; } this.element.addClass( tclass ); } }, _bindPageEvents: function() { var self = this, o = self.options, $el = self.element; //page event bindings // Fixed toolbars require page zoom to be disabled, otherwise usability issues crop up // This method is meant to disable zoom while a fixed-positioned toolbar page is visible $el.closest( ".ui-page" ) .bind( "pagebeforeshow", function() { if ( o.disablePageZoom ) { $.mobile.zoom.disable( true ); } if ( !o.visibleOnPageShow ) { self.hide( true ); } } ) .bind( "webkitAnimationStart animationstart updatelayout", function() { var thisPage = this; if ( o.updatePagePadding ) { self.updatePagePadding( thisPage ); } }) .bind( "pageshow", function() { var thisPage = this; self.updatePagePadding( thisPage ); if ( o.updatePagePadding ) { $( window ).bind( "throttledresize." + self.widgetName, function() { self.updatePagePadding( thisPage ); }); } }) .bind( "pagebeforehide", function( e, ui ) { if ( o.disablePageZoom ) { $.mobile.zoom.enable( true ); } if ( o.updatePagePadding ) { $( window ).unbind( "throttledresize." + self.widgetName ); } if ( o.trackPersistentToolbars ) { var thisFooter = $( ".ui-footer-fixed:jqmData(id)", this ), thisHeader = $( ".ui-header-fixed:jqmData(id)", this ), nextFooter = thisFooter.length && ui.nextPage && $( ".ui-footer-fixed:jqmData(id='" + thisFooter.jqmData( "id" ) + "')", ui.nextPage ) || $(), nextHeader = thisHeader.length && ui.nextPage && $( ".ui-header-fixed:jqmData(id='" + thisHeader.jqmData( "id" ) + "')", ui.nextPage ) || $(); if ( nextFooter.length || nextHeader.length ) { nextFooter.add( nextHeader ).appendTo( $.mobile.pageContainer ); ui.nextPage.one( "pageshow", function() { nextFooter.add( nextHeader ).appendTo( this ); }); } } }); }, _visible: true, // This will set the content element's top or bottom padding equal to the toolbar's height updatePagePadding: function( tbPage ) { var $el = this.element, header = $el.is( ".ui-header" ); // This behavior only applies to "fixed", not "fullscreen" if ( this.options.fullscreen ) { return; } tbPage = tbPage || $el.closest( ".ui-page" ); $( tbPage ).css( "padding-" + ( header ? "top" : "bottom" ), $el.outerHeight() ); }, _useTransition: function( notransition ) { var $win = $( window ), $el = this.element, scroll = $win.scrollTop(), elHeight = $el.height(), pHeight = $el.closest( ".ui-page" ).height(), viewportHeight = $.mobile.getScreenHeight(), tbtype = $el.is( ":jqmData(role='header')" ) ? "header" : "footer"; return !notransition && ( this.options.transition && this.options.transition !== "none" && ( ( tbtype === "header" && !this.options.fullscreen && scroll > elHeight ) || ( tbtype === "footer" && !this.options.fullscreen && scroll + viewportHeight < pHeight - elHeight ) ) || this.options.fullscreen ); }, show: function( notransition ) { var hideClass = "ui-fixed-hidden", $el = this.element; if ( this._useTransition( notransition ) ) { $el .removeClass( "out " + hideClass ) .addClass( "in" ); } else { $el.removeClass( hideClass ); } this._visible = true; }, hide: function( notransition ) { var hideClass = "ui-fixed-hidden", $el = this.element, // if it's a slide transition, our new transitions need the reverse class as well to slide outward outclass = "out" + ( this.options.transition === "slide" ? " reverse" : "" ); if( this._useTransition( notransition ) ) { $el .addClass( outclass ) .removeClass( "in" ) .animationComplete(function() { $el.addClass( hideClass ).removeClass( outclass ); }); } else { $el.addClass( hideClass ).removeClass( outclass ); } this._visible = false; }, toggle: function() { this[ this._visible ? "hide" : "show" ](); }, _bindToggleHandlers: function() { var self = this, o = self.options, $el = self.element; // tap toggle $el.closest( ".ui-page" ) .bind( "vclick", function( e ) { if ( o.tapToggle && !$( e.target ).closest( o.tapToggleBlacklist ).length ) { self.toggle(); } }) .bind( "focusin focusout", function( e ) { if ( screen.width < 500 && $( e.target ).is( o.hideDuringFocus ) && !$( e.target ).closest( ".ui-header-fixed, .ui-footer-fixed" ).length ) { self[ ( e.type === "focusin" && self._visible ) ? "hide" : "show" ](); } }); }, destroy: function() { this.element.removeClass( "ui-header-fixed ui-footer-fixed ui-header-fullscreen ui-footer-fullscreen in out fade slidedown slideup ui-fixed-hidden" ); this.element.closest( ".ui-page" ).removeClass( "ui-page-header-fixed ui-page-footer-fixed ui-page-header-fullscreen ui-page-footer-fullscreen" ); } }); //auto self-init widgets $( document ) .bind( "pagecreate create", function( e ) { // DEPRECATED in 1.1: support for data-fullscreen=true|false on the page element. // This line ensures it still works, but we recommend moving the attribute to the toolbars themselves. if ( $( e.target ).jqmData( "fullscreen" ) ) { $( $.mobile.fixedtoolbar.prototype.options.initSelector, e.target ).not( ":jqmData(fullscreen)" ).jqmData( "fullscreen", true ); } $.mobile.fixedtoolbar.prototype.enhanceWithin( e.target ); }); })( jQuery ); (function( $, window ) { // This fix addresses an iOS bug, so return early if the UA claims it's something else. if ( !(/iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1 ) ) { return; } var zoom = $.mobile.zoom, evt, x, y, z, aig; function checkTilt( e ) { evt = e.originalEvent; aig = evt.accelerationIncludingGravity; x = Math.abs( aig.x ); y = Math.abs( aig.y ); z = Math.abs( aig.z ); // If portrait orientation and in one of the danger zones if ( !window.orientation && ( x > 7 || ( ( z > 6 && y < 8 || z < 8 && y > 6 ) && x > 5 ) ) ) { if ( zoom.enabled ) { zoom.disable(); } } else if ( !zoom.enabled ) { zoom.enable(); } } $( window ) .bind( "orientationchange.iosorientationfix", zoom.enable ) .bind( "devicemotion.iosorientationfix", checkTilt ); }( jQuery, this )); (function( $, window, undefined ) { var $html = $( "html" ), $head = $( "head" ), $window = $( window ); //remove initial build class (only present on first pageshow) function hideRenderingClass() { $html.removeClass( "ui-mobile-rendering" ); } // trigger mobileinit event - useful hook for configuring $.mobile settings before they're used $( window.document ).trigger( "mobileinit" ); // support conditions // if device support condition(s) aren't met, leave things as they are -> a basic, usable experience, // otherwise, proceed with the enhancements if ( !$.mobile.gradeA() ) { return; } // override ajaxEnabled on platforms that have known conflicts with hash history updates // or generally work better browsing in regular http for full page refreshes (BB5, Opera Mini) if ( $.mobile.ajaxBlacklist ) { $.mobile.ajaxEnabled = false; } // Add mobile, initial load "rendering" classes to docEl $html.addClass( "ui-mobile ui-mobile-rendering" ); // This is a fallback. If anything goes wrong (JS errors, etc), or events don't fire, // this ensures the rendering class is removed after 5 seconds, so content is visible and accessible setTimeout( hideRenderingClass, 5000 ); $.extend( $.mobile, { // find and enhance the pages in the dom and transition to the first page. initializePage: function() { // find present pages var $pages = $( ":jqmData(role='page'), :jqmData(role='dialog')" ), hash = $.mobile.path.parseLocation().hash.replace("#", ""), hashPage = document.getElementById( hash ); // if no pages are found, create one with body's inner html if ( !$pages.length ) { $pages = $( "body" ).wrapInner( "<div data-" + $.mobile.ns + "role='page'></div>" ).children( 0 ); } // add dialogs, set data-url attrs $pages.each(function() { var $this = $( this ); // unless the data url is already set set it to the pathname if ( !$this.jqmData( "url" ) ) { $this.attr( "data-" + $.mobile.ns + "url", $this.attr( "id" ) || location.pathname + location.search ); } }); // define first page in dom case one backs out to the directory root (not always the first page visited, but defined as fallback) $.mobile.firstPage = $pages.first(); // define page container $.mobile.pageContainer = $pages.first().parent().addClass( "ui-mobile-viewport" ); // alert listeners that the pagecontainer has been determined for binding // to events triggered on it $window.trigger( "pagecontainercreate" ); // cue page loading message $.mobile.showPageLoadingMsg(); //remove initial build class (only present on first pageshow) hideRenderingClass(); // if hashchange listening is disabled, there's no hash deeplink, // the hash is not valid (contains more than one # or does not start with #) // or there is no page with that hash, change to the first page in the DOM // Remember, however, that the hash can also be a path! if ( ! ( $.mobile.hashListeningEnabled && $.mobile.path.isHashValid( location.hash ) && ( $( hashPage ).is( ':jqmData(role="page")' ) || $.mobile.path.isPath( hash ) || hash === $.mobile.dialogHashKey ) ) ) { // Store the initial destination if ( $.mobile.path.isHashValid( location.hash ) ) { $.mobile.urlHistory.initialDst = hash.replace( "#", "" ); } $.mobile.changePage( $.mobile.firstPage, { transition: "none", reverse: true, changeHash: false, fromHashChange: true } ); } // otherwise, trigger a hashchange to load a deeplink else { $window.trigger( "hashchange", [ true ] ); } } }); // initialize events now, after mobileinit has occurred $.mobile.navreadyDeferred.resolve(); // check which scrollTop value should be used by scrolling to 1 immediately at domready // then check what the scroll top is. Android will report 0... others 1 // note that this initial scroll won't hide the address bar. It's just for the check. $(function() { window.scrollTo( 0, 1 ); // if defaultHomeScroll hasn't been set yet, see if scrollTop is 1 // it should be 1 in most browsers, but android treats 1 as 0 (for hiding addr bar) // so if it's 1, use 0 from now on $.mobile.defaultHomeScroll = ( !$.support.scrollTop || $( window ).scrollTop() === 1 ) ? 0 : 1; // TODO: Implement a proper registration mechanism with dependency handling in order to not have exceptions like the one below //auto self-init widgets for those widgets that have a soft dependency on others if ( $.fn.controlgroup ) { $( document ).bind( "pagecreate create", function( e ) { $( ":jqmData(role='controlgroup')", e.target ) .jqmEnhanceable() .controlgroup({ excludeInvisible: false }); }); } //dom-ready inits if ( $.mobile.autoInitializePage ) { $.mobile.initializePage(); } // window load event // hide iOS browser chrome on load $window.load( $.mobile.silentScroll ); if ( !$.support.cssPointerEvents ) { // IE and Opera don't support CSS pointer-events: none that we use to disable link-based buttons // by adding the 'ui-disabled' class to them. Using a JavaScript workaround for those browser. // https://github.com/jquery/jquery-mobile/issues/3558 $( document ).delegate( ".ui-disabled", "vclick", function( e ) { e.preventDefault(); e.stopImmediatePropagation(); } ); } }); }( jQuery, this )); }));
jaydata/cdnjs
ajax/libs/jquery-mobile/1.2.0/jquery.mobile.js
JavaScript
mit
293,534
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Config\Tests\Definition\Builder; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Processor; use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition; use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; class ArrayNodeDefinitionTest extends \PHPUnit_Framework_TestCase { public function testAppendingSomeNode() { $parent = new ArrayNodeDefinition('root'); $child = new ScalarNodeDefinition('child'); $parent ->children() ->scalarNode('foo')->end() ->scalarNode('bar')->end() ->end() ->append($child); $this->assertCount(3, $this->getField($parent, 'children')); $this->assertTrue(in_array($child, $this->getField($parent, 'children'))); } /** * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException * @dataProvider providePrototypeNodeSpecificCalls */ public function testPrototypeNodeSpecificOption($method, $args) { $node = new ArrayNodeDefinition('root'); call_user_func_array(array($node, $method), $args); $node->getNode(); } public function providePrototypeNodeSpecificCalls() { return array( array('defaultValue', array(array())), array('addDefaultChildrenIfNoneSet', array()), array('requiresAtLeastOneElement', array()), array('useAttributeAsKey', array('foo')) ); } /** * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException */ public function testConcreteNodeSpecificOption() { $node = new ArrayNodeDefinition('root'); $node ->addDefaultsIfNotSet() ->prototype('array') ; $node->getNode(); } /** * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException */ public function testPrototypeNodesCantHaveADefaultValueWhenUsingDefaultChildren() { $node = new ArrayNodeDefinition('root'); $node ->defaultValue(array()) ->addDefaultChildrenIfNoneSet('foo') ->prototype('array') ; $node->getNode(); } public function testPrototypedArrayNodeDefaultWhenUsingDefaultChildren() { $node = new ArrayNodeDefinition('root'); $node ->addDefaultChildrenIfNoneSet() ->prototype('array') ; $tree = $node->getNode(); $this->assertEquals(array(array()), $tree->getDefaultValue()); } /** * @dataProvider providePrototypedArrayNodeDefaults */ public function testPrototypedArrayNodeDefault($args, $shouldThrowWhenUsingAttrAsKey, $shouldThrowWhenNotUsingAttrAsKey, $defaults) { $node = new ArrayNodeDefinition('root'); $node ->addDefaultChildrenIfNoneSet($args) ->prototype('array') ; try { $tree = $node->getNode(); $this->assertFalse($shouldThrowWhenNotUsingAttrAsKey); $this->assertEquals($defaults, $tree->getDefaultValue()); } catch (InvalidDefinitionException $e) { $this->assertTrue($shouldThrowWhenNotUsingAttrAsKey); } $node = new ArrayNodeDefinition('root'); $node ->useAttributeAsKey('attr') ->addDefaultChildrenIfNoneSet($args) ->prototype('array') ; try { $tree = $node->getNode(); $this->assertFalse($shouldThrowWhenUsingAttrAsKey); $this->assertEquals($defaults, $tree->getDefaultValue()); } catch (InvalidDefinitionException $e) { $this->assertTrue($shouldThrowWhenUsingAttrAsKey); } } public function providePrototypedArrayNodeDefaults() { return array( array(null, true, false, array(array())), array(2, true, false, array(array(), array())), array('2', false, true, array('2' => array())), array('foo', false, true, array('foo' => array())), array(array('foo'), false, true, array('foo' => array())), array(array('foo', 'bar'), false, true, array('foo' => array(), 'bar' => array())), ); } public function testNestedPrototypedArrayNodes() { $node = new ArrayNodeDefinition('root'); $node ->addDefaultChildrenIfNoneSet() ->prototype('array') ->prototype('array') ; $node->getNode(); } public function testEnabledNodeDefaults() { $node = new ArrayNodeDefinition('root'); $node ->canBeEnabled() ->children() ->scalarNode('foo')->defaultValue('bar')->end() ; $this->assertEquals(array('enabled' => false, 'foo' => 'bar'), $node->getNode()->getDefaultValue()); } /** * @dataProvider getEnableableNodeFixtures */ public function testTrueEnableEnabledNode($expected, $config, $message) { $processor = new Processor(); $node = new ArrayNodeDefinition('root'); $node ->canBeEnabled() ->children() ->scalarNode('foo')->defaultValue('bar')->end() ; $this->assertEquals( $expected, $processor->process($node->getNode(), $config), $message ); } public function getEnableableNodeFixtures() { return array( array(array('enabled' => true, 'foo' => 'bar'), array(true), 'true enables an enableable node'), array(array('enabled' => true, 'foo' => 'bar'), array(null), 'null enables an enableable node'), array(array('enabled' => true, 'foo' => 'bar'), array(array('enabled' => true)), 'An enableable node can be enabled'), array(array('enabled' => true, 'foo' => 'baz'), array(array('foo' => 'baz')), 'any configuration enables an enableable node'), array(array('enabled' => false, 'foo' => 'baz'), array(array('foo' => 'baz', 'enabled' => false)), 'An enableable node can be disabled'), array(array('enabled' => false, 'foo' => 'bar'), array(false), 'false disables an enableable node'), ); } protected function getField($object, $field) { $reflection = new \ReflectionProperty($object, $field); $reflection->setAccessible(true); return $reflection->getValue($object); } }
gagesalas/SymfonyCursoHydras
vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php
PHP
mit
6,901
!function(a){if(webshims.support.texttrackapi&&document.addEventListener){var b=webshims.cfg.track,c=function(b){a(b.target).filter("track").each(e)},d=webshims.bugs.track,e=function(){return d||!b.override&&3==a.prop(this,"readyState")?(b.override=!0,webshims.reTest("track"),document.removeEventListener("error",c,!0),this&&a.nodeName(this,"track")?webshims.error("track support was overwritten. Please check your vtt including your vtt mime-type"):webshims.info("track support was overwritten. due to bad browser support"),!1):void 0},f=function(){document.addEventListener("error",c,!0),d?e():a("track").each(e),d||b.override||webshims.defineProperty(TextTrack.prototype,"shimActiveCues",{get:function(){return this._shimActiveCues||this.activeCues}})};b.override||a(f)}}(webshims.$),webshims.register("track-ui",function(a,b){"use strict";function c(a,b){var c=!0,d=0,e=a.length;if(e!=b.length)c=!1;else for(;e>d;d++)if(a[d]!=b[d]){c=!1;break}return c}var d=b.cfg.track,e=b.support,f={subtitles:1,captions:1,descriptions:1},g=b.mediaelement,h=function(){return!d.override&&e.texttrackapi},i={update:function(d,e){d.activeCues.length?c(d.displayedActiveCues,d.activeCues)||(d.displayedActiveCues=d.activeCues,d.trackDisplay||(d.trackDisplay=a('<div class="cue-display '+b.shadowClass+'"><span class="description-cues" aria-live="assertive" /></div>').insertAfter(e),this.addEvents(d,e),b.docObserve()),d.hasDirtyTrackDisplay&&e.triggerHandler("forceupdatetrackdisplay"),this.showCues(d)):this.hide(d)},showCues:function(b){var c=a('<span class="cue-wrapper" />');a.each(b.displayedActiveCues,function(d,e){var f=e.id?'id="cue-id-'+e.id+'"':"",g=a('<span class="cue-line"><span '+f+' class="cue" /></span>').find("span").html(e.getCueAsHTML()).end();"descriptions"==e.track.kind?setTimeout(function(){a("span.description-cues",b.trackDisplay).html(g)},0):c.prepend(g)}),a("span.cue-wrapper",b.trackDisplay).remove(),b.trackDisplay.append(c)},addEvents:function(a,b){if(d.positionDisplay){var c,e=function(c){if(a.displayedActiveCues.length||c===!0){a.trackDisplay.css({display:"none"});var d=b.getShadowElement(),e=d.innerHeight(),f=d.innerWidth(),g=d.position();a.trackDisplay.css({left:g.left,width:f,height:e-45,top:g.top,display:"block"}),a.trackDisplay.css("fontSize",Math.max(Math.round(e/30),7)),a.hasDirtyTrackDisplay=!1}else a.hasDirtyTrackDisplay=!0},f=function(){clearTimeout(c),c=setTimeout(e,0)},g=function(){e(!0)};b.on("playerdimensionchange mediaelementapichange updatetrackdisplay updatemediaelementdimensions swfstageresize",f),b.on("forceupdatetrackdisplay",g).onWSOff("updateshadowdom",f),g()}},hide:function(b){b.trackDisplay&&b.displayedActiveCues.length&&(b.displayedActiveCues=[],a("span.cue-wrapper",b.trackDisplay).remove(),a("span.description-cues",b.trackDisplay).empty())}};if(g.trackDisplay=i,!g.createCueList){var j={getCueById:function(a){for(var b=null,c=0,d=this.length;d>c;c++)if(this[c].id===a){b=this[c];break}return b}};g.createCueList=function(){return a.extend([],j)}}g.getActiveCue=function(b,c,h,i){b._lastFoundCue||(b._lastFoundCue={index:0,time:0}),!e.texttrackapi||d.override||b._shimActiveCues||(b._shimActiveCues=g.createCueList());for(var j,k,l=0;l<b.shimActiveCues.length;l++)k=b.shimActiveCues[l],k.startTime>h||k.endTime<h?(b.shimActiveCues.splice(l,1),l--,k.pauseOnExit&&a(c).pause(),a(b).triggerHandler("cuechange"),a(k).triggerHandler("exit")):"showing"==b.mode&&f[b.kind]&&-1==a.inArray(k,i.activeCues)&&i.activeCues.push(k);for(j=b.cues.length,l=b._lastFoundCue.time<h?b._lastFoundCue.index:0;j>l&&(k=b.cues[l],k.startTime<=h&&k.endTime>=h&&-1==a.inArray(k,b.shimActiveCues)&&(b.shimActiveCues.push(k),"showing"==b.mode&&f[b.kind]&&i.activeCues.push(k),a(b).triggerHandler("cuechange"),a(k).triggerHandler("enter"),b._lastFoundCue.time=h,b._lastFoundCue.index=l),!(k.startTime>h));l++);},h()&&(!function(){var c,d=function(b){c=!0,setTimeout(function(){a(b).triggerHandler("updatetrackdisplay"),c=!1},9)},e=function(e,f,g){var i,j="_sup"+g,k={prop:{}};k.prop[g]=function(){return!c&&h()&&d(a(this).closest("audio, video")),i.prop[j].apply(this,arguments)},i=b.defineNodeNameProperty(e,f,k)};e("track","track","get"),["audio","video"].forEach(function(a){e(a,"textTracks","get"),e("nodeName","addTextTrack","value")})}(),a.propHooks.activeCues={get:function(a){return a._shimActiveCues||a.activeCues}}),b.addReady(function(c,d){a("video, audio",c).add(d.filter("video, audio")).filter(function(){return b.implement(this,"trackui")}).each(function(){var c,d,e,f,j=a(this),k=function(){var a,e;if(d&&c||(d=j.prop("textTracks"),c=b.data(j[0],"mediaelementBase")||b.data(j[0],"mediaelementBase",{}),c.displayedActiveCues||(c.displayedActiveCues=[])),d&&(e=j.prop("currentTime"),e||0===e)){c.activeCues=[];for(var f=0,h=d.length;h>f;f++)a=d[f],"disabled"!=a.mode&&a.cues&&a.cues.length&&g.getActiveCue(a,j,e,c);i.update(c,j)}},l=function(a){clearTimeout(e),a?("timeupdate"==a.type&&k(),f=setTimeout(l,90)):e=setTimeout(k,9)},m=function(){d||(d=j.prop("textTracks")),a([d]).on("change",l),j.off(".trackview").on("play.trackview timeupdate.trackview updatetrackdisplay.trackview",l)};j.on("remove",function(a){!a.originalEvent&&c&&c.trackDisplay&&setTimeout(function(){c.trackDisplay.remove()},4)}),h()?(j.is(".nonnative-api-active")&&m(),j.on("mediaelementapichange trackapichange",function(){!h()||j.is(".nonnative-api-active")?m():(clearTimeout(e),clearTimeout(f),d=j.prop("textTracks"),c=b.data(j[0],"mediaelementBase")||b.data(j[0],"mediaelementBase",{}),a.each(d,function(a,b){b._shimActiveCues&&delete b._shimActiveCues}),i.hide(c),j.off(".trackview"))})):m()})})});
contolini/cdnjs
ajax/libs/webshim/1.14.4-RC4/minified/shims/track-ui.js
JavaScript
mit
5,624
define("dojo/dom", ["./sniff", "./_base/window"], function(has, win){ // module: // dojo/dom // FIXME: need to add unit tests for all the semi-public methods if(has("ie") <= 7){ try{ document.execCommand("BackgroundImageCache", false, true); }catch(e){ // sane browsers don't have cache "issues" } } // ============================= // DOM Functions // ============================= // the result object var dom = { // summary: // This module defines the core dojo DOM API. }; if(has("ie")){ dom.byId = function(id, doc){ if(typeof id != "string"){ return id; } var _d = doc || win.doc, te = id && _d.getElementById(id); // attributes.id.value is better than just id in case the // user has a name=id inside a form if(te && (te.attributes.id.value == id || te.id == id)){ return te; }else{ var eles = _d.all[id]; if(!eles || eles.nodeName){ eles = [eles]; } // if more than 1, choose first with the correct id var i = 0; while((te = eles[i++])){ if((te.attributes && te.attributes.id && te.attributes.id.value == id) || te.id == id){ return te; } } } }; }else{ dom.byId = function(id, doc){ // inline'd type check. // be sure to return null per documentation, to match IE branch. return ((typeof id == "string") ? (doc || win.doc).getElementById(id) : id) || null; // DOMNode }; } /*===== dom.byId = function(id, doc){ // summary: // Returns DOM node with matching `id` attribute or falsy value (ex: null or undefined) // if not found. If `id` is a DomNode, this function is a no-op. // // id: String|DOMNode // A string to match an HTML id attribute or a reference to a DOM Node // // doc: Document? // Document to work in. Defaults to the current value of // dojo/_base/window.doc. Can be used to retrieve // node references from other documents. // // example: // Look up a node by ID: // | require(["dojo/dom"], function(dom){ // | var n = dom.byId("foo"); // | }); // // example: // Check if a node exists, and use it. // | require(["dojo/dom"], function(dom){ // | var n = dom.byId("bar"); // | if(n){ doStuff() ... } // | }); // // example: // Allow string or DomNode references to be passed to a custom function: // | require(["dojo/dom"], function(dom){ // | var foo = function(nodeOrId){ // | nodeOrId = dom.byId(nodeOrId); // | // ... more stuff // | } // | }); }; =====*/ dom.isDescendant = function(/*DOMNode|String*/ node, /*DOMNode|String*/ ancestor){ // summary: // Returns true if node is a descendant of ancestor // node: DOMNode|String // string id or node reference to test // ancestor: DOMNode|String // string id or node reference of potential parent to test against // // example: // Test is node id="bar" is a descendant of node id="foo" // | require(["dojo/dom"], function(dom){ // | if(dom.isDescendant("bar", "foo")){ ... } // | }); try{ node = dom.byId(node); ancestor = dom.byId(ancestor); while(node){ if(node == ancestor){ return true; // Boolean } node = node.parentNode; } }catch(e){ /* squelch, return false */ } return false; // Boolean }; // TODO: do we need setSelectable in the base? // Add feature test for user-select CSS property // (currently known to work in all but IE < 10 and Opera) // TODO: The user-select CSS property as of May 2014 is no longer part of // any CSS specification. In IE, -ms-user-select does not do the same thing // as the unselectable attribute on elements; namely, dijit Editor buttons // do not properly prevent the content of the editable content frame from // unblurring. As a result, the -ms- prefixed version is omitted here. has.add("css-user-select", function(global, doc, element){ // Avoid exception when dom.js is loaded in non-browser environments if(!element){ return false; } var style = element.style; var prefixes = ["Khtml", "O", "Moz", "Webkit"], i = prefixes.length, name = "userSelect", prefix; // Iterate prefixes from most to least likely do{ if(typeof style[name] !== "undefined"){ // Supported; return property name return name; } }while(i-- && (name = prefixes[i] + "UserSelect")); // Not supported if we didn't return before now return false; }); /*===== dom.setSelectable = function(node, selectable){ // summary: // Enable or disable selection on a node // node: DOMNode|String // id or reference to node // selectable: Boolean // state to put the node in. false indicates unselectable, true // allows selection. // example: // Make the node id="bar" unselectable // | require(["dojo/dom"], function(dom){ // | dom.setSelectable("bar"); // | }); // example: // Make the node id="bar" selectable // | require(["dojo/dom"], function(dom){ // | dom.setSelectable("bar", true); // | }); }; =====*/ var cssUserSelect = has("css-user-select"); dom.setSelectable = cssUserSelect ? function(node, selectable){ // css-user-select returns a (possibly vendor-prefixed) CSS property name dom.byId(node).style[cssUserSelect] = selectable ? "" : "none"; } : function(node, selectable){ node = dom.byId(node); // (IE < 10 / Opera) Fall back to setting/removing the // unselectable attribute on the element and all its children var nodes = node.getElementsByTagName("*"), i = nodes.length; if(selectable){ node.removeAttribute("unselectable"); while(i--){ nodes[i].removeAttribute("unselectable"); } }else{ node.setAttribute("unselectable", "on"); while(i--){ nodes[i].setAttribute("unselectable", "on"); } } }; return dom; });
hibrahimsafak/cdnjs
ajax/libs/dojo/1.10.4/dom.js.uncompressed.js
JavaScript
mit
5,767
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico"> <meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0"> <link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css"> <link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css"> <script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script> <script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script> <title>Responsive examples - Responsive DataTables</title> </head> <body class="dt-example"> <div class="container"> <section> <h1>Responsive example <span>Responsive DataTables</span></h1> <div class="info"></div> </section> </div> <section> <div class="footer"> <div class="gradient"></div> <div class="liner"> <div class="toc"> <div class="toc-group"> <h3><a href="./initialisation/index.html">Basic initialisation</a></h3> <ul class="toc"> <li><a href="./initialisation/className.html">Class name</a></li> <li><a href="./initialisation/option.html">Configuration option</a></li> <li><a href="./initialisation/new.html">`new` constructor</a></li> <li><a href="./initialisation/ajax.html">Ajax data</a></li> <li><a href="./initialisation/default.html">Default initialisation</a></li> </ul> </div> <div class="toc-group"> <h3><a href="./styling/index.html">Styling</a></h3> <ul class="toc"> <li><a href="./styling/bootstrap.html">Bootstrap styling</a></li> <li><a href="./styling/foundation.html">Foundation styling</a></li> <li><a href="./styling/scrolling.html">Vertical scrolling</a></li> <li><a href="./styling/compact.html">Compact styling</a></li> </ul> </div> <div class="toc-group"> <h3><a href="./display-control/index.html">Display control</a></h3> <ul class="toc"> <li><a href="./display-control/auto.html">Automatic column hiding</a></li> <li><a href="./display-control/classes.html">Class control</a></li> <li><a href="./display-control/init-classes.html">Assigned class control</a></li> <li><a href="./display-control/fixedHeader.html">With FixedHeader</a></li> <li><a href="./display-control/complexHeader.html">Complex headers (rowspan / colspan)</a></li> </ul> </div> <div class="toc-group"> <h3><a href="./child-rows/index.html">Child rows</a></h3> <ul class="toc"> <li><a href="./child-rows/disable-child-rows.html">Disable child rows</a></li> <li><a href="./child-rows/column-control.html">Column controlled child rows</a></li> <li><a href="./child-rows/right-column.html">Column control - right</a></li> <li><a href="./child-rows/whole-row-control.html">Whole row child row control</a></li> <li><a href="./child-rows/custom-renderer.html">Custom child row renderer</a></li> </ul> </div> </div> <div class="epilogue"> <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br> Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and <a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of DataTables.</p> <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2015<br> DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p> </div> </div> </div> </section> </body> </html>
clubahorrojm/club_bitcoin
static/plugins/datatables/extensions/Responsive/examples/index.html
HTML
mit
3,807
!function(){function t(t){test.mode(t,a,Array.prototype.slice.call(arguments,1),e)}var a=CodeMirror.getMode({indentUnit:2},"xml"),e="xml";t("matching","[tag&bracket <][tag top][tag&bracket >]"," text"," [tag&bracket <][tag inner][tag&bracket />]","[tag&bracket </][tag top][tag&bracket >]"),t("nonmatching","[tag&bracket <][tag top][tag&bracket >]"," [tag&bracket <][tag inner][tag&bracket />]"," [tag&bracket </][tag&error tip][tag&bracket&error >]"),t("doctype","[meta <!doctype foobar>]","[tag&bracket <][tag top][tag&bracket />]"),t("cdata","[tag&bracket <][tag top][tag&bracket >]"," [atom <![CDATA[foo]","[atom barbazguh]]]]>]","[tag&bracket </][tag top][tag&bracket >]"),a=CodeMirror.getMode({indentUnit:2},"text/html"),t("selfclose","[tag&bracket <][tag html][tag&bracket >]",' [tag&bracket <][tag link] [attribute rel]=[string stylesheet] [attribute href]=[string "/foobar"][tag&bracket >]',"[tag&bracket </][tag html][tag&bracket >]"),t("list","[tag&bracket <][tag ol][tag&bracket >]"," [tag&bracket <][tag li][tag&bracket >]one"," [tag&bracket <][tag li][tag&bracket >]two","[tag&bracket </][tag ol][tag&bracket >]"),t("valueless","[tag&bracket <][tag input] [attribute type]=[string checkbox] [attribute checked][tag&bracket />]"),t("pThenArticle","[tag&bracket <][tag p][tag&bracket >]"," foo","[tag&bracket <][tag article][tag&bracket >]bar")}();
jacoborus/cdnjs
ajax/libs/codemirror/4.7.0/mode/xml/test.min.js
JavaScript
mit
1,369
var assert = require('assert'), path = require('path'), Completion = require('./lib/completion'), Parser = require('./lib/parser'), Usage = require('./lib/usage'), Validation = require('./lib/validation') Argv(process.argv.slice(2)) var exports = module.exports = Argv function Argv (processArgs, cwd) { processArgs = processArgs || [] // handle calling yargs(). var self = {} var completion = null var usage = null var validation = null if (!cwd) cwd = process.cwd() self.$0 = process.argv .slice(0, 2) .map(function (x, i) { // ignore the node bin, specify this in your // bin file with #!/usr/bin/env node if (i === 0 && /\b(node|iojs)$/.test(x)) return var b = rebase(cwd, x) return x.match(/^\//) && b.length < x.length ? b : x }) .join(' ').trim() if (process.env._ !== undefined && process.argv[1] === process.env._) { self.$0 = process.env._.replace( path.dirname(process.execPath) + '/', '' ) } var options self.resetOptions = self.reset = function () { // put yargs back into its initial // state, this is useful for creating a // nested CLI. options = { array: [], boolean: [], string: [], narg: {}, key: {}, alias: {}, default: {}, defaultDescription: {}, requiresArg: [], count: [], normalize: [], config: [] } usage = Usage(self) // handle usage output. validation = Validation(self, usage) // handle arg validation. completion = Completion(self, usage) demanded = {} exitProcess = true strict = false helpOpt = null versionOpt = null completionOpt = null commandHandlers = {} self.parsed = false return self } self.resetOptions() self.boolean = function (bools) { options.boolean.push.apply(options.boolean, [].concat(bools)) return self } self.array = function (arrays) { options.array.push.apply(options.array, [].concat(arrays)) return self } self.nargs = function (key, n) { if (typeof key === 'object') { Object.keys(key).forEach(function (k) { self.nargs(k, key[k]) }) } else { options.narg[key] = n } return self } self.normalize = function (strings) { options.normalize.push.apply(options.normalize, [].concat(strings)) return self } self.config = function (configs) { options.config.push.apply(options.config, [].concat(configs)) return self } self.example = function (cmd, description) { usage.example(cmd, description) return self } self.command = function (cmd, description, fn) { usage.command(cmd, description) if (fn) commandHandlers[cmd] = fn return self } var commandHandlers = {} self.getCommandHandlers = function () { return commandHandlers } self.string = function (strings) { options.string.push.apply(options.string, [].concat(strings)) return self } self.default = function (key, value, defaultDescription) { if (typeof key === 'object') { Object.keys(key).forEach(function (k) { self.default(k, key[k]) }) } else { if (typeof value === 'function') { defaultDescription = usage.functionDescription(value, defaultDescription) value = value.call() } options.defaultDescription[key] = defaultDescription options.default[key] = value } return self } self.alias = function (x, y) { if (typeof x === 'object') { Object.keys(x).forEach(function (key) { self.alias(key, x[key]) }) } else { options.alias[x] = (options.alias[x] || []).concat(y) } return self } self.count = function (counts) { options.count.push.apply(options.count, [].concat(counts)) return self } var demanded = {} self.demand = self.required = self.require = function (keys, msg) { if (typeof keys === 'number') { if (!demanded._) demanded._ = { count: 0, msg: null } demanded._.count += keys demanded._.msg = msg } else if (Array.isArray(keys)) { keys.forEach(function (key) { self.demand(key, msg) }) } else { if (typeof msg === 'string') { demanded[keys] = { msg: msg } } else if (msg === true || typeof msg === 'undefined') { demanded[keys] = { msg: undefined } } } return self } self.getDemanded = function () { return demanded } self.requiresArg = function (requiresArgs) { options.requiresArg.push.apply(options.requiresArg, [].concat(requiresArgs)) return self } self.implies = function (key, value) { validation.implies(key, value) return self } self.usage = function (msg, opts) { if (!opts && typeof msg === 'object') { opts = msg msg = null } usage.usage(msg) if (opts) self.options(opts) return self } self.epilogue = self.epilog = function (msg) { usage.epilog(msg) return self } self.fail = function (f) { usage.failFn(f) return self } self.check = function (f) { validation.check(f) return self } self.defaults = self.default self.describe = function (key, desc) { options.key[key] = true usage.describe(key, desc) return self } self.parse = function (args) { return parseArgs(args) } self.option = self.options = function (key, opt) { if (typeof key === 'object') { Object.keys(key).forEach(function (k) { self.options(k, key[k]) }) } else { assert(typeof opt === 'object', 'second argument to option must be an object') options.key[key] = true // track manually set keys. if (opt.alias) self.alias(key, opt.alias) var demand = opt.demand || opt.required || opt.require if (demand) { self.demand(key, demand) } if ('default' in opt) { self.default(key, opt.default) } if ('nargs' in opt) { self.nargs(key, opt.nargs) } if (opt.boolean || opt.type === 'boolean') { self.boolean(key) if (opt.alias) self.boolean(opt.alias) } if (opt.array || opt.type === 'array') { self.array(key) if (opt.alias) self.array(opt.alias) } if (opt.string || opt.type === 'string') { self.string(key) if (opt.alias) self.string(opt.alias) } if (opt.count || opt.type === 'count') { self.count(key) } var desc = opt.describe || opt.description || opt.desc if (desc) { self.describe(key, desc) } if (opt.requiresArg) { self.requiresArg(key) } } return self } self.getOptions = function () { return options } self.wrap = function (cols) { usage.wrap(cols) return self } var strict = false self.strict = function () { strict = true return self } self.getStrict = function () { return strict } self.showHelp = function (level) { if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed. usage.showHelp(level) return self } var versionOpt = null self.version = function (ver, opt, msg) { versionOpt = opt || 'version' usage.version(ver) self.boolean(versionOpt) self.describe(versionOpt, msg || 'Show version number') return self } var helpOpt = null self.addHelpOpt = function (opt, msg) { helpOpt = opt self.boolean(opt) self.describe(opt, msg || 'Show help') return self } self.showHelpOnFail = function (enabled, message) { usage.showHelpOnFail(enabled, message) return self } var exitProcess = true self.exitProcess = function (enabled) { if (typeof enabled !== 'boolean') { enabled = true } exitProcess = enabled return self } self.getExitProcess = function () { return exitProcess } self.help = function () { if (arguments.length > 0) return self.addHelpOpt.apply(self, arguments) if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed. return usage.help() } var completionOpt = null, completionCommand = null self.completion = function (cmd, desc, fn) { // a function to execute when generating // completions can be provided as the second // or third argument to completion. if (typeof desc === 'function') { fn = desc desc = null } // register the completion command. completionCommand = cmd completionOpt = completion.completionKey self.command(completionCommand, desc || 'generate bash completion script') // a function can be provided if (fn) completion.registerFunction(fn) return self } self.showCompletionScript = function ($0) { $0 = $0 || self.$0 console.log(completion.generateCompletionScript($0)) return self } self.getUsageInstance = function () { return usage } self.getValidationInstance = function () { return validation } self.terminalWidth = function () { return require('window-size').width } Object.defineProperty(self, 'argv', { get: function () { var args = null try { args = parseArgs(processArgs) } catch (err) { usage.fail(err.message) } return args }, enumerable: true }) function parseArgs (args) { var parsed = Parser(args, options), argv = parsed.argv, aliases = parsed.aliases argv.$0 = self.$0 self.parsed = parsed // generate a completion script for adding to ~/.bashrc. if (completionCommand && ~argv._.indexOf(completionCommand)) { self.showCompletionScript() if (exitProcess) { process.exit(0) } } // if there's a handler associated with a // command defer processing to it. var handlerKeys = Object.keys(self.getCommandHandlers()) for (var i = 0, command; (command = handlerKeys[i]) !== undefined; i++) { if (~argv._.indexOf(command)) { self.getCommandHandlers()[command](self.reset()) return self.argv } } Object.keys(argv).forEach(function (key) { if (key === helpOpt && argv[key]) { self.showHelp('log') if (exitProcess) { process.exit(0) } } else if (key === versionOpt && argv[key]) { usage.showVersion() if (exitProcess) { process.exit(0) } } else if (key === completionOpt) { // we allow for asynchronous completions, // e.g., loading in a list of commands from an API. completion.getCompletion(function (completions) { ;(completions || []).forEach(function (completion) { console.log(completion) }) if (exitProcess) { process.exit(0) } }) return } }) validation.nonOptionCount(argv) validation.missingArgumentValue(argv) validation.requiredArguments(argv) if (strict) { validation.unknownArguments(argv, aliases) } validation.customChecks(argv, aliases) validation.implications(argv) setPlaceholderKeys(argv) return argv } function setPlaceholderKeys (argv) { Object.keys(options.key).forEach(function (key) { if (typeof argv[key] === 'undefined') argv[key] = undefined }) } sigletonify(self) return self } // rebase an absolute path to a relative one with respect to a base directory // exported for tests exports.rebase = rebase function rebase (base, dir) { return path.relative(base, dir) } /* Hack an instance of Argv with process.argv into Argv so people can do require('yargs')(['--beeble=1','-z','zizzle']).argv to parse a list of args and require('yargs').argv to get a parsed version of process.argv. */ function sigletonify (inst) { Object.keys(inst).forEach(function (key) { if (key === 'argv') { Argv.__defineGetter__(key, inst.__lookupGetter__(key)) } else { Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key] } }) }
KhanovaSkola/khanovaskola-v3
node_modules/bower/lib/node_modules/yargs/index.js
JavaScript
mit
12,130
/*! * Bootstrap v3.3.5 (http://getbootstrap.com) * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */.btn-danger,.btn-default,.btn-info,.btn-primary,.btn-success,.btn-warning{text-shadow:0 -1px 0 rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.btn-danger.active,.btn-danger:active,.btn-default.active,.btn-default:active,.btn-info.active,.btn-info:active,.btn-primary.active,.btn-primary:active,.btn-success.active,.btn-success:active,.btn-warning.active,.btn-warning:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-danger.disabled,.btn-danger[disabled],.btn-default.disabled,.btn-default[disabled],.btn-info.disabled,.btn-info[disabled],.btn-primary.disabled,.btn-primary[disabled],.btn-success.disabled,.btn-success[disabled],.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-danger,fieldset[disabled] .btn-default,fieldset[disabled] .btn-info,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-success,fieldset[disabled] .btn-warning{-webkit-box-shadow:none;box-shadow:none}.btn-danger .badge,.btn-default .badge,.btn-info .badge,.btn-primary .badge,.btn-success .badge,.btn-warning .badge{text-shadow:none}.btn.active,.btn:active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-o-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e0e0e0));background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc}.btn-default:focus,.btn-default:hover{background-color:#e0e0e0;background-position:0 -15px}.btn-default.active,.btn-default:active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled.focus,.btn-default.disabled:active,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled].focus,.btn-default[disabled]:active,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default.active,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#e0e0e0;background-image:none}.btn-primary{background-image:-webkit-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-o-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#265a88));background-image:linear-gradient(to bottom,#337ab7 0,#265a88 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#245580}.btn-primary:focus,.btn-primary:hover{background-color:#265a88;background-position:0 -15px}.btn-primary.active,.btn-primary:active{background-color:#265a88;border-color:#245580}.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled.focus,.btn-primary.disabled:active,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled].focus,.btn-primary[disabled]:active,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary.active,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#265a88;background-image:none}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#419641));background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#3e8f3e}.btn-success:focus,.btn-success:hover{background-color:#419641;background-position:0 -15px}.btn-success.active,.btn-success:active{background-color:#419641;border-color:#3e8f3e}.btn-success.disabled,.btn-success.disabled.active,.btn-success.disabled.focus,.btn-success.disabled:active,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled],.btn-success[disabled].active,.btn-success[disabled].focus,.btn-success[disabled]:active,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success,fieldset[disabled] .btn-success.active,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:active,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#419641;background-image:none}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#2aabd2));background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#28a4c9}.btn-info:focus,.btn-info:hover{background-color:#2aabd2;background-position:0 -15px}.btn-info.active,.btn-info:active{background-color:#2aabd2;border-color:#28a4c9}.btn-info.disabled,.btn-info.disabled.active,.btn-info.disabled.focus,.btn-info.disabled:active,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled],.btn-info[disabled].active,.btn-info[disabled].focus,.btn-info[disabled]:active,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info,fieldset[disabled] .btn-info.active,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:active,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#2aabd2;background-image:none}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#eb9316));background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#e38d13}.btn-warning:focus,.btn-warning:hover{background-color:#eb9316;background-position:0 -15px}.btn-warning.active,.btn-warning:active{background-color:#eb9316;border-color:#e38d13}.btn-warning.disabled,.btn-warning.disabled.active,.btn-warning.disabled.focus,.btn-warning.disabled:active,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled],.btn-warning[disabled].active,.btn-warning[disabled].focus,.btn-warning[disabled]:active,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning,fieldset[disabled] .btn-warning.active,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:active,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#eb9316;background-image:none}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c12e2a));background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#b92c28}.btn-danger:focus,.btn-danger:hover{background-color:#c12e2a;background-position:0 -15px}.btn-danger.active,.btn-danger:active{background-color:#c12e2a;border-color:#b92c28}.btn-danger.disabled,.btn-danger.disabled.active,.btn-danger.disabled.focus,.btn-danger.disabled:active,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled],.btn-danger[disabled].active,.btn-danger[disabled].focus,.btn-danger[disabled]:active,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger,fieldset[disabled] .btn-danger.active,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:active,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#c12e2a;background-image:none}.img-thumbnail,.thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{background-color:#2e6da4;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-o-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f8f8f8));background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-o-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dbdbdb),to(#e2e2e2));background-image:linear-gradient(to bottom,#dbdbdb 0,#e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-o-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#222));background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-o-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#080808),to(#0f0f0f));background-image:linear-gradient(to bottom,#080808 0,#0f0f0f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-fixed-bottom,.navbar-fixed-top,.navbar-static-top{border-radius:0}@media (max-width:767px){.navbar .navbar-nav .open .dropdown-menu>.active>a,.navbar .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#c8e5bc));background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);background-repeat:repeat-x;border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#b9def0));background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);background-repeat:repeat-x;border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#f8efc0));background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);background-repeat:repeat-x;border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-o-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#e7c3c3));background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);background-repeat:repeat-x;border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f5f5f5));background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x}.progress-bar{background-image:-webkit-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-o-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#286090));background-image:linear-gradient(to bottom,#337ab7 0,#286090 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);background-repeat:repeat-x}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#449d44));background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);background-repeat:repeat-x}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#31b0d5));background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);background-repeat:repeat-x}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#ec971f));background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);background-repeat:repeat-x}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c9302c));background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);background-repeat:repeat-x}.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{text-shadow:0 -1px 0 #286090;background-image:-webkit-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2b669a));background-image:linear-gradient(to bottom,#337ab7 0,#2b669a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);background-repeat:repeat-x;border-color:#2b669a}.list-group-item.active .badge,.list-group-item.active:focus .badge,.list-group-item.active:hover .badge{text-shadow:none}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#d0e9c6));background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);background-repeat:repeat-x}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#c4e3f3));background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);background-repeat:repeat-x}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#faf2cc));background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);background-repeat:repeat-x}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-o-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#ebcccc));background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);background-repeat:repeat-x}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#e8e8e8),to(#f5f5f5));background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x;border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)}
fuxue/huixie
css/bootstrap-theme.min.css
CSS
mit
23,357
/** * Module exports. */ module.exports = deprecate; /** * Mark that a method should not be used. * Returns a modified function which warns once by default. * * If `localStorage.noDeprecation = true` is set, then it is a no-op. * * If `localStorage.throwDeprecation = true` is set, then deprecated functions * will throw an Error when invoked. * * If `localStorage.traceDeprecation = true` is set, then deprecated functions * will invoke `console.trace()` instead of `console.error()`. * * @param {Function} fn - the function to deprecate * @param {String} msg - the string to print to the console when `fn` is invoked * @returns {Function} a new "deprecated" version of `fn` * @api public */ function deprecate (fn, msg) { if (config('noDeprecation')) { return fn; } var warned = false; function deprecated() { if (!warned) { if (config('throwDeprecation')) { throw new Error(msg); } else if (config('traceDeprecation')) { console.trace(msg); } else { console.warn(msg); } warned = true; } return fn.apply(this, arguments); } return deprecated; } /** * Checks `localStorage` for boolean values for the given `name`. * * @param {String} name * @returns {Boolean} * @api private */ function config (name) { // accessing global.localStorage can trigger a DOMException in sandboxed iframes try { if (!global.localStorage) return false; } catch (_) { return false; } var val = global.localStorage[name]; if (null == val) return false; return String(val).toLowerCase() === 'true'; }
impromptuartist/impromptuartist.github.io
node_modules/html-to-text/node_modules/underscore.string/node_modules/util-deprecate/browser.js
JavaScript
mit
1,614
// Test file for Google Maps JavaScript API Definition file componentHandler.upgradeDom(); componentHandler.upgradeDom('MaterialButton'); componentHandler.upgradeDom('MaterialButton', 'mdl-button'); componentHandler.upgradeElement(document.createElement('div')); componentHandler.upgradeElement(document.getElementById('id')); componentHandler.upgradeElement(document.getElementsByTagName('button')[0], 'MaterialButton'); componentHandler.upgradeElements(document.getElementsByTagName('div')); componentHandler.upgradeElements([document.createElement('div')]); componentHandler.upgradeElements(document.querySelectorAll('div.mdl-button')); componentHandler.upgradeAllRegistered(); componentHandler.registerUpgradedCallback('MaterialButton', function(element : HTMLElement) {}); componentHandler.register({ constructor: function(element: HTMLElement) {}, classAsString: 'MaterialCheese', cssClass: 'mdl-cheese' }); componentHandler.register({ constructor: function(element: HTMLElement) {}, classAsString: 'MaterialFoo', cssClass: 'mdl-foo', widget: true }); componentHandler.register({ constructor: function(element: HTMLElement) {}, classAsString: 'MaterialFoo', cssClass: 'mdl-foo', widget: 'FooBar' }); componentHandler.downgradeElements(document.querySelectorAll('div'));
use-strict/DefinitelyTyped
material-design-lite/material-design-lite-tests.ts
TypeScript
mit
1,328
// References var Observable = Rx.Observable, observableProto = Observable.prototype, observableNever = Observable.never, observableThrow = Observable.throwException, AnonymousObservable = Rx.AnonymousObservable, Observer = Rx.Observer, Subject = Rx.Subject, internals = Rx.internals, helpers = Rx.helpers, ScheduledObserver = internals.ScheduledObserver, SingleAssignmentDisposable = Rx.SingleAssignmentDisposable, CompositeDisposable = Rx.CompositeDisposable, RefCountDisposable = Rx.RefCountDisposable, disposableEmpty = Rx.Disposable.empty, immediateScheduler = Rx.Scheduler.immediate, defaultKeySerializer = helpers.defaultKeySerializer, addRef = Rx.internals.addRef, identity = helpers.identity, isPromise = helpers.isPromise, inherits = internals.inherits, noop = helpers.noop, isScheduler = helpers.isScheduler, observableFromPromise = Observable.fromPromise, slice = Array.prototype.slice; function argsOrArray(args, idx) { return args.length === 1 && Array.isArray(args[idx]) ? args[idx] : slice.call(args); } var argumentOutOfRange = 'Argument out of range';
peter-watters/Record-Catalog
node_modules/grunt-bower-requirejs/node_modules/bower/node_modules/inquirer/node_modules/rx/src/core/liteextrasheader.js
JavaScript
mit
1,223
d3 = function() { var π = Math.PI, ε = 1e-6, d3 = { version: "3.0.6" }, d3_radians = π / 180, d3_degrees = 180 / π, d3_document = document, d3_window = window; function d3_target(d) { return d.target; } function d3_source(d) { return d.source; } var d3_format_decimalPoint = ".", d3_format_thousandsSeparator = ",", d3_format_grouping = [ 3, 3 ]; if (!Date.now) Date.now = function() { return +new Date(); }; try { d3_document.createElement("div").style.setProperty("opacity", 0, ""); } catch (error) { var d3_style_prototype = d3_window.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty; d3_style_prototype.setProperty = function(name, value, priority) { d3_style_setProperty.call(this, name, value + "", priority); }; } function d3_class(ctor, properties) { try { for (var key in properties) { Object.defineProperty(ctor.prototype, key, { value: properties[key], enumerable: false }); } } catch (e) { ctor.prototype = properties; } } var d3_array = d3_arraySlice; function d3_arrayCopy(pseudoarray) { var i = -1, n = pseudoarray.length, array = []; while (++i < n) array.push(pseudoarray[i]); return array; } function d3_arraySlice(pseudoarray) { return Array.prototype.slice.call(pseudoarray); } try { d3_array(d3_document.documentElement.childNodes)[0].nodeType; } catch (e) { d3_array = d3_arrayCopy; } var d3_arraySubclass = [].__proto__ ? function(array, prototype) { array.__proto__ = prototype; } : function(array, prototype) { for (var property in prototype) array[property] = prototype[property]; }; d3.map = function(object) { var map = new d3_Map(); for (var key in object) map.set(key, object[key]); return map; }; function d3_Map() {} d3_class(d3_Map, { has: function(key) { return d3_map_prefix + key in this; }, get: function(key) { return this[d3_map_prefix + key]; }, set: function(key, value) { return this[d3_map_prefix + key] = value; }, remove: function(key) { key = d3_map_prefix + key; return key in this && delete this[key]; }, keys: function() { var keys = []; this.forEach(function(key) { keys.push(key); }); return keys; }, values: function() { var values = []; this.forEach(function(key, value) { values.push(value); }); return values; }, entries: function() { var entries = []; this.forEach(function(key, value) { entries.push({ key: key, value: value }); }); return entries; }, forEach: function(f) { for (var key in this) { if (key.charCodeAt(0) === d3_map_prefixCode) { f.call(this, key.substring(1), this[key]); } } } }); var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0); function d3_identity(d) { return d; } function d3_true() { return true; } function d3_functor(v) { return typeof v === "function" ? v : function() { return v; }; } d3.functor = d3_functor; d3.rebind = function(target, source) { var i = 1, n = arguments.length, method; while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); return target; }; function d3_rebind(target, source, method) { return function() { var value = method.apply(source, arguments); return arguments.length ? target : value; }; } d3.ascending = function(a, b) { return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; }; d3.descending = function(a, b) { return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; }; d3.mean = function(array, f) { var n = array.length, a, m = 0, i = -1, j = 0; if (arguments.length === 1) { while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j; } else { while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j; } return j ? m : undefined; }; d3.median = function(array, f) { if (arguments.length > 1) array = array.map(f); array = array.filter(d3_number); return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined; }; d3.min = function(array, f) { var i = -1, n = array.length, a, b; if (arguments.length === 1) { while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; while (++i < n) if ((b = array[i]) != null && a > b) a = b; } else { while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; } return a; }; d3.max = function(array, f) { var i = -1, n = array.length, a, b; if (arguments.length === 1) { while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; while (++i < n) if ((b = array[i]) != null && b > a) a = b; } else { while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; } return a; }; d3.extent = function(array, f) { var i = -1, n = array.length, a, b, c; if (arguments.length === 1) { while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined; while (++i < n) if ((b = array[i]) != null) { if (a > b) a = b; if (c < b) c = b; } } else { while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined; while (++i < n) if ((b = f.call(array, array[i], i)) != null) { if (a > b) a = b; if (c < b) c = b; } } return [ a, c ]; }; d3.random = { normal: function(µ, σ) { var n = arguments.length; if (n < 2) σ = 1; if (n < 1) µ = 0; return function() { var x, y, r; do { x = Math.random() * 2 - 1; y = Math.random() * 2 - 1; r = x * x + y * y; } while (!r || r > 1); return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r); }; }, logNormal: function() { var random = d3.random.normal.apply(d3, arguments); return function() { return Math.exp(random()); }; }, irwinHall: function(m) { return function() { for (var s = 0, j = 0; j < m; j++) s += Math.random(); return s / m; }; } }; function d3_number(x) { return x != null && !isNaN(x); } d3.sum = function(array, f) { var s = 0, n = array.length, a, i = -1; if (arguments.length === 1) { while (++i < n) if (!isNaN(a = +array[i])) s += a; } else { while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a; } return s; }; d3.quantile = function(values, p) { var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h; return e ? v + e * (values[h] - v) : v; }; d3.shuffle = function(array) { var m = array.length, t, i; while (m) { i = Math.random() * m-- | 0; t = array[m], array[m] = array[i], array[i] = t; } return array; }; d3.transpose = function(matrix) { return d3.zip.apply(d3, matrix); }; d3.zip = function() { if (!(n = arguments.length)) return []; for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) { for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) { zip[j] = arguments[j][i]; } } return zips; }; function d3_zipLength(d) { return d.length; } d3.bisector = function(f) { return { left: function(a, x, lo, hi) { if (arguments.length < 3) lo = 0; if (arguments.length < 4) hi = a.length; while (lo < hi) { var mid = lo + hi >>> 1; if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid; } return lo; }, right: function(a, x, lo, hi) { if (arguments.length < 3) lo = 0; if (arguments.length < 4) hi = a.length; while (lo < hi) { var mid = lo + hi >>> 1; if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1; } return lo; } }; }; var d3_bisector = d3.bisector(function(d) { return d; }); d3.bisectLeft = d3_bisector.left; d3.bisect = d3.bisectRight = d3_bisector.right; d3.nest = function() { var nest = {}, keys = [], sortKeys = [], sortValues, rollup; function map(array, depth) { if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array; var i = -1, n = array.length, key = keys[depth++], keyValue, object, valuesByKey = new d3_Map(), values, o = {}; while (++i < n) { if (values = valuesByKey.get(keyValue = key(object = array[i]))) { values.push(object); } else { valuesByKey.set(keyValue, [ object ]); } } valuesByKey.forEach(function(keyValue, values) { o[keyValue] = map(values, depth); }); return o; } function entries(map, depth) { if (depth >= keys.length) return map; var a = [], sortKey = sortKeys[depth++], key; for (key in map) { a.push({ key: key, values: entries(map[key], depth) }); } if (sortKey) a.sort(function(a, b) { return sortKey(a.key, b.key); }); return a; } nest.map = function(array) { return map(array, 0); }; nest.entries = function(array) { return entries(map(array, 0), 0); }; nest.key = function(d) { keys.push(d); return nest; }; nest.sortKeys = function(order) { sortKeys[keys.length - 1] = order; return nest; }; nest.sortValues = function(order) { sortValues = order; return nest; }; nest.rollup = function(f) { rollup = f; return nest; }; return nest; }; d3.keys = function(map) { var keys = []; for (var key in map) keys.push(key); return keys; }; d3.values = function(map) { var values = []; for (var key in map) values.push(map[key]); return values; }; d3.entries = function(map) { var entries = []; for (var key in map) entries.push({ key: key, value: map[key] }); return entries; }; d3.permute = function(array, indexes) { var permutes = [], i = -1, n = indexes.length; while (++i < n) permutes[i] = array[indexes[i]]; return permutes; }; d3.merge = function(arrays) { return Array.prototype.concat.apply([], arrays); }; function d3_collapse(s) { return s.trim().replace(/\s+/g, " "); } d3.range = function(start, stop, step) { if (arguments.length < 3) { step = 1; if (arguments.length < 2) { stop = start; start = 0; } } if ((stop - start) / step === Infinity) throw new Error("infinite range"); var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j; start *= k, stop *= k, step *= k; if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k); return range; }; function d3_range_integerScale(x) { var k = 1; while (x * k % 1) k *= 10; return k; } d3.requote = function(s) { return s.replace(d3_requote_re, "\\$&"); }; var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; d3.round = function(x, n) { return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x); }; d3.xhr = function(url, mimeType, callback) { var xhr = {}, dispatch = d3.dispatch("progress", "load", "error"), headers = {}, response = d3_identity, request = new (d3_window.XDomainRequest && /^(http(s)?:)?\/\//.test(url) ? XDomainRequest : XMLHttpRequest)(); "onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() { request.readyState > 3 && respond(); }; function respond() { var s = request.status; !s && request.responseText || s >= 200 && s < 300 || s === 304 ? dispatch.load.call(xhr, response.call(xhr, request)) : dispatch.error.call(xhr, request); } request.onprogress = function(event) { var o = d3.event; d3.event = event; try { dispatch.progress.call(xhr, request); } finally { d3.event = o; } }; xhr.header = function(name, value) { name = (name + "").toLowerCase(); if (arguments.length < 2) return headers[name]; if (value == null) delete headers[name]; else headers[name] = value + ""; return xhr; }; xhr.mimeType = function(value) { if (!arguments.length) return mimeType; mimeType = value == null ? null : value + ""; return xhr; }; xhr.response = function(value) { response = value; return xhr; }; [ "get", "post" ].forEach(function(method) { xhr[method] = function() { return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments))); }; }); xhr.send = function(method, data, callback) { if (arguments.length === 2 && typeof data === "function") callback = data, data = null; request.open(method, url, true); if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*"; if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]); if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType); if (callback != null) xhr.on("error", callback).on("load", function(request) { callback(null, request); }); request.send(data == null ? null : data); return xhr; }; xhr.abort = function() { request.abort(); return xhr; }; d3.rebind(xhr, dispatch, "on"); if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType, mimeType = null; return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback)); }; function d3_xhr_fixCallback(callback) { return callback.length === 1 ? function(error, request) { callback(error == null ? request : null); } : callback; } d3.text = function() { return d3.xhr.apply(d3, arguments).response(d3_text); }; function d3_text(request) { return request.responseText; } d3.json = function(url, callback) { return d3.xhr(url, "application/json", callback).response(d3_json); }; function d3_json(request) { return JSON.parse(request.responseText); } d3.html = function(url, callback) { return d3.xhr(url, "text/html", callback).response(d3_html); }; function d3_html(request) { var range = d3_document.createRange(); range.selectNode(d3_document.body); return range.createContextualFragment(request.responseText); } d3.xml = function() { return d3.xhr.apply(d3, arguments).response(d3_xml); }; function d3_xml(request) { return request.responseXML; } var d3_nsPrefix = { svg: "http://www.w3.org/2000/svg", xhtml: "http://www.w3.org/1999/xhtml", xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" }; d3.ns = { prefix: d3_nsPrefix, qualify: function(name) { var i = name.indexOf(":"), prefix = name; if (i >= 0) { prefix = name.substring(0, i); name = name.substring(i + 1); } return d3_nsPrefix.hasOwnProperty(prefix) ? { space: d3_nsPrefix[prefix], local: name } : name; } }; d3.dispatch = function() { var dispatch = new d3_dispatch(), i = -1, n = arguments.length; while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); return dispatch; }; function d3_dispatch() {} d3_dispatch.prototype.on = function(type, listener) { var i = type.indexOf("."), name = ""; if (i > 0) { name = type.substring(i + 1); type = type.substring(0, i); } return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener); }; function d3_dispatch_event(dispatch) { var listeners = [], listenerByName = new d3_Map(); function event() { var z = listeners, i = -1, n = z.length, l; while (++i < n) if (l = z[i].on) l.apply(this, arguments); return dispatch; } event.on = function(name, listener) { var l = listenerByName.get(name), i; if (arguments.length < 2) return l && l.on; if (l) { l.on = null; listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); listenerByName.remove(name); } if (listener) listeners.push(listenerByName.set(name, { on: listener })); return dispatch; }; return event; } d3.format = function(specifier) { var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "", basePrefix = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false; if (precision) precision = +precision.substring(1); if (zfill || fill === "0" && align === "=") { zfill = fill = "0"; align = "="; if (comma) width -= Math.floor((width - 1) / 4); } switch (type) { case "n": comma = true; type = "g"; break; case "%": scale = 100; suffix = "%"; type = "f"; break; case "p": scale = 100; suffix = "%"; type = "r"; break; case "b": case "o": case "x": case "X": if (basePrefix) basePrefix = "0" + type.toLowerCase(); case "c": case "d": integer = true; precision = 0; break; case "s": scale = -1; type = "r"; break; } if (basePrefix === "#") basePrefix = ""; if (type == "r" && !precision) type = "g"; type = d3_format_types.get(type) || d3_format_typeDefault; var zcomma = zfill && comma; return function(value) { if (integer && value % 1) return ""; var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign; if (scale < 0) { var prefix = d3.formatPrefix(value, precision); value = prefix.scale(value); suffix = prefix.symbol; } else { value *= scale; } value = type(value, precision); if (!zfill && comma) value = d3_format_group(value); var length = basePrefix.length + value.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : ""; if (zcomma) value = d3_format_group(padding + value); if (d3_format_decimalPoint) value.replace(".", d3_format_decimalPoint); negative += basePrefix; return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + suffix; }; }; var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/; var d3_format_types = d3.map({ b: function(x) { return x.toString(2); }, c: function(x) { return String.fromCharCode(x); }, o: function(x) { return x.toString(8); }, x: function(x) { return x.toString(16); }, X: function(x) { return x.toString(16).toUpperCase(); }, g: function(x, p) { return x.toPrecision(p); }, e: function(x, p) { return x.toExponential(p); }, f: function(x, p) { return x.toFixed(p); }, r: function(x, p) { return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p)))); } }); function d3_format_precision(x, p) { return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1); } function d3_format_typeDefault(x) { return x + ""; } var d3_format_group = d3_identity; if (d3_format_grouping) { var d3_format_groupingLength = d3_format_grouping.length; d3_format_group = function(value) { var i = value.lastIndexOf("."), f = i >= 0 ? "." + value.substring(i + 1) : (i = value.length, ""), t = [], j = 0, g = d3_format_grouping[0]; while (i > 0 && g > 0) { t.push(value.substring(i -= g, i + g)); g = d3_format_grouping[j = (j + 1) % d3_format_groupingLength]; } return t.reverse().join(d3_format_thousandsSeparator || "") + f; }; } var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix); d3.formatPrefix = function(value, precision) { var i = 0; if (value) { if (value < 0) value *= -1; if (precision) value = d3.round(value, d3_format_precision(value, precision)); i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3)); } return d3_formatPrefixes[8 + i / 3]; }; function d3_formatPrefix(d, i) { var k = Math.pow(10, Math.abs(8 - i) * 3); return { scale: i > 8 ? function(d) { return d / k; } : function(d) { return d * k; }, symbol: d }; } var d3_ease_default = function() { return d3_identity; }; var d3_ease = d3.map({ linear: d3_ease_default, poly: d3_ease_poly, quad: function() { return d3_ease_quad; }, cubic: function() { return d3_ease_cubic; }, sin: function() { return d3_ease_sin; }, exp: function() { return d3_ease_exp; }, circle: function() { return d3_ease_circle; }, elastic: d3_ease_elastic, back: d3_ease_back, bounce: function() { return d3_ease_bounce; } }); var d3_ease_mode = d3.map({ "in": d3_identity, out: d3_ease_reverse, "in-out": d3_ease_reflect, "out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); } }); d3.ease = function(name) { var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in"; t = d3_ease.get(t) || d3_ease_default; m = d3_ease_mode.get(m) || d3_identity; return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1)))); }; function d3_ease_clamp(f) { return function(t) { return t <= 0 ? 0 : t >= 1 ? 1 : f(t); }; } function d3_ease_reverse(f) { return function(t) { return 1 - f(1 - t); }; } function d3_ease_reflect(f) { return function(t) { return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t)); }; } function d3_ease_quad(t) { return t * t; } function d3_ease_cubic(t) { return t * t * t; } function d3_ease_cubicInOut(t) { if (t <= 0) return 0; if (t >= 1) return 1; var t2 = t * t, t3 = t2 * t; return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75); } function d3_ease_poly(e) { return function(t) { return Math.pow(t, e); }; } function d3_ease_sin(t) { return 1 - Math.cos(t * π / 2); } function d3_ease_exp(t) { return Math.pow(2, 10 * (t - 1)); } function d3_ease_circle(t) { return 1 - Math.sqrt(1 - t * t); } function d3_ease_elastic(a, p) { var s; if (arguments.length < 2) p = .45; if (arguments.length) s = p / (2 * π) * Math.asin(1 / a); else a = 1, s = p / 4; return function(t) { return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * π / p); }; } function d3_ease_back(s) { if (!s) s = 1.70158; return function(t) { return t * t * ((s + 1) * t - s); }; } function d3_ease_bounce(t) { return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; } d3.event = null; function d3_eventCancel() { d3.event.stopPropagation(); d3.event.preventDefault(); } function d3_eventSource() { var e = d3.event, s; while (s = e.sourceEvent) e = s; return e; } function d3_eventDispatch(target) { var dispatch = new d3_dispatch(), i = 0, n = arguments.length; while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); dispatch.of = function(thiz, argumentz) { return function(e1) { try { var e0 = e1.sourceEvent = d3.event; e1.target = target; d3.event = e1; dispatch[e1.type].apply(thiz, argumentz); } finally { d3.event = e0; } }; }; return dispatch; } d3.transform = function(string) { var g = d3_document.createElementNS(d3.ns.prefix.svg, "g"); return (d3.transform = function(string) { g.setAttribute("transform", string); var t = g.transform.baseVal.consolidate(); return new d3_transform(t ? t.matrix : d3_transformIdentity); })(string); }; function d3_transform(m) { var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; if (r0[0] * r1[1] < r1[0] * r0[1]) { r0[0] *= -1; r0[1] *= -1; kx *= -1; kz *= -1; } this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees; this.translate = [ m.e, m.f ]; this.scale = [ kx, ky ]; this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0; } d3_transform.prototype.toString = function() { return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")"; }; function d3_transformDot(a, b) { return a[0] * b[0] + a[1] * b[1]; } function d3_transformNormalize(a) { var k = Math.sqrt(d3_transformDot(a, a)); if (k) { a[0] /= k; a[1] /= k; } return k; } function d3_transformCombine(a, b, k) { a[0] += k * b[0]; a[1] += k * b[1]; return a; } var d3_transformIdentity = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }; d3.interpolate = function(a, b) { var i = d3.interpolators.length, f; while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ; return f; }; d3.interpolateNumber = function(a, b) { b -= a; return function(t) { return a + b * t; }; }; d3.interpolateRound = function(a, b) { b -= a; return function(t) { return Math.round(a + b * t); }; }; d3.interpolateString = function(a, b) { var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o; d3_interpolate_number.lastIndex = 0; for (i = 0; m = d3_interpolate_number.exec(b); ++i) { if (m.index) s.push(b.substring(s0, s1 = m.index)); q.push({ i: s.length, x: m[0] }); s.push(null); s0 = d3_interpolate_number.lastIndex; } if (s0 < b.length) s.push(b.substring(s0)); for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) { o = q[i]; if (o.x == m[0]) { if (o.i) { if (s[o.i + 1] == null) { s[o.i - 1] += o.x; s.splice(o.i, 1); for (j = i + 1; j < n; ++j) q[j].i--; } else { s[o.i - 1] += o.x + s[o.i + 1]; s.splice(o.i, 2); for (j = i + 1; j < n; ++j) q[j].i -= 2; } } else { if (s[o.i + 1] == null) { s[o.i] = o.x; } else { s[o.i] = o.x + s[o.i + 1]; s.splice(o.i + 1, 1); for (j = i + 1; j < n; ++j) q[j].i--; } } q.splice(i, 1); n--; i--; } else { o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x)); } } while (i < n) { o = q.pop(); if (s[o.i + 1] == null) { s[o.i] = o.x; } else { s[o.i] = o.x + s[o.i + 1]; s.splice(o.i + 1, 1); } n--; } if (s.length === 1) { return s[0] == null ? q[0].x : function() { return b; }; } return function(t) { for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t); return s.join(""); }; }; d3.interpolateTransform = function(a, b) { var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale; if (ta[0] != tb[0] || ta[1] != tb[1]) { s.push("translate(", null, ",", null, ")"); q.push({ i: 1, x: d3.interpolateNumber(ta[0], tb[0]) }, { i: 3, x: d3.interpolateNumber(ta[1], tb[1]) }); } else if (tb[0] || tb[1]) { s.push("translate(" + tb + ")"); } else { s.push(""); } if (ra != rb) { if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; q.push({ i: s.push(s.pop() + "rotate(", null, ")") - 2, x: d3.interpolateNumber(ra, rb) }); } else if (rb) { s.push(s.pop() + "rotate(" + rb + ")"); } if (wa != wb) { q.push({ i: s.push(s.pop() + "skewX(", null, ")") - 2, x: d3.interpolateNumber(wa, wb) }); } else if (wb) { s.push(s.pop() + "skewX(" + wb + ")"); } if (ka[0] != kb[0] || ka[1] != kb[1]) { n = s.push(s.pop() + "scale(", null, ",", null, ")"); q.push({ i: n - 4, x: d3.interpolateNumber(ka[0], kb[0]) }, { i: n - 2, x: d3.interpolateNumber(ka[1], kb[1]) }); } else if (kb[0] != 1 || kb[1] != 1) { s.push(s.pop() + "scale(" + kb + ")"); } n = q.length; return function(t) { var i = -1, o; while (++i < n) s[(o = q[i]).i] = o.x(t); return s.join(""); }; }; d3.interpolateRgb = function(a, b) { a = d3.rgb(a); b = d3.rgb(b); var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab; return function(t) { return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t)); }; }; d3.interpolateHsl = function(a, b) { a = d3.hsl(a); b = d3.hsl(b); var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0; if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360; return function(t) { return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + ""; }; }; d3.interpolateLab = function(a, b) { a = d3.lab(a); b = d3.lab(b); var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab; return function(t) { return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + ""; }; }; d3.interpolateHcl = function(a, b) { a = d3.hcl(a); b = d3.hcl(b); var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al; if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; return function(t) { return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + ""; }; }; d3.interpolateArray = function(a, b) { var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i; for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i])); for (;i < na; ++i) c[i] = a[i]; for (;i < nb; ++i) c[i] = b[i]; return function(t) { for (i = 0; i < n0; ++i) c[i] = x[i](t); return c; }; }; d3.interpolateObject = function(a, b) { var i = {}, c = {}, k; for (k in a) { if (k in b) { i[k] = d3_interpolateByName(k)(a[k], b[k]); } else { c[k] = a[k]; } } for (k in b) { if (!(k in a)) { c[k] = b[k]; } } return function(t) { for (k in i) c[k] = i[k](t); return c; }; }; var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g; function d3_interpolateByName(name) { return name == "transform" ? d3.interpolateTransform : d3.interpolate; } d3.interpolators = [ d3.interpolateObject, function(a, b) { return b instanceof Array && d3.interpolateArray(a, b); }, function(a, b) { return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); }, function(a, b) { return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Color) && d3.interpolateRgb(a, b); }, function(a, b) { return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); } ]; function d3_uninterpolateNumber(a, b) { b = b - (a = +a) ? 1 / (b - a) : 0; return function(x) { return (x - a) * b; }; } function d3_uninterpolateClamp(a, b) { b = b - (a = +a) ? 1 / (b - a) : 0; return function(x) { return Math.max(0, Math.min(1, (x - a) * b)); }; } function d3_Color() {} d3_Color.prototype.toString = function() { return this.rgb() + ""; }; d3.rgb = function(r, g, b) { return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b); }; function d3_rgb(r, g, b) { return new d3_Rgb(r, g, b); } function d3_Rgb(r, g, b) { this.r = r; this.g = g; this.b = b; } var d3_rgbPrototype = d3_Rgb.prototype = new d3_Color(); d3_rgbPrototype.brighter = function(k) { k = Math.pow(.7, arguments.length ? k : 1); var r = this.r, g = this.g, b = this.b, i = 30; if (!r && !g && !b) return d3_rgb(i, i, i); if (r && r < i) r = i; if (g && g < i) g = i; if (b && b < i) b = i; return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k))); }; d3_rgbPrototype.darker = function(k) { k = Math.pow(.7, arguments.length ? k : 1); return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b)); }; d3_rgbPrototype.hsl = function() { return d3_rgb_hsl(this.r, this.g, this.b); }; d3_rgbPrototype.toString = function() { return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); }; function d3_rgb_hex(v) { return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16); } function d3_rgb_parse(format, rgb, hsl) { var r = 0, g = 0, b = 0, m1, m2, name; m1 = /([a-z]+)\((.*)\)/i.exec(format); if (m1) { m2 = m1[2].split(","); switch (m1[1]) { case "hsl": { return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100); } case "rgb": { return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2])); } } } if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b); if (format != null && format.charAt(0) === "#") { if (format.length === 4) { r = format.charAt(1); r += r; g = format.charAt(2); g += g; b = format.charAt(3); b += b; } else if (format.length === 7) { r = format.substring(1, 3); g = format.substring(3, 5); b = format.substring(5, 7); } r = parseInt(r, 16); g = parseInt(g, 16); b = parseInt(b, 16); } return rgb(r, g, b); } function d3_rgb_hsl(r, g, b) { var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2; if (d) { s = l < .5 ? d / (max + min) : d / (2 - max - min); if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4; h *= 60; } else { s = h = 0; } return d3_hsl(h, s, l); } function d3_rgb_lab(r, g, b) { r = d3_rgb_xyz(r); g = d3_rgb_xyz(g); b = d3_rgb_xyz(b); var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z); return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z)); } function d3_rgb_xyz(r) { return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4); } function d3_rgb_parseNumber(c) { var f = parseFloat(c); return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; } var d3_rgb_names = d3.map({ aliceblue: "#f0f8ff", antiquewhite: "#faebd7", aqua: "#00ffff", aquamarine: "#7fffd4", azure: "#f0ffff", beige: "#f5f5dc", bisque: "#ffe4c4", black: "#000000", blanchedalmond: "#ffebcd", blue: "#0000ff", blueviolet: "#8a2be2", brown: "#a52a2a", burlywood: "#deb887", cadetblue: "#5f9ea0", chartreuse: "#7fff00", chocolate: "#d2691e", coral: "#ff7f50", cornflowerblue: "#6495ed", cornsilk: "#fff8dc", crimson: "#dc143c", cyan: "#00ffff", darkblue: "#00008b", darkcyan: "#008b8b", darkgoldenrod: "#b8860b", darkgray: "#a9a9a9", darkgreen: "#006400", darkgrey: "#a9a9a9", darkkhaki: "#bdb76b", darkmagenta: "#8b008b", darkolivegreen: "#556b2f", darkorange: "#ff8c00", darkorchid: "#9932cc", darkred: "#8b0000", darksalmon: "#e9967a", darkseagreen: "#8fbc8f", darkslateblue: "#483d8b", darkslategray: "#2f4f4f", darkslategrey: "#2f4f4f", darkturquoise: "#00ced1", darkviolet: "#9400d3", deeppink: "#ff1493", deepskyblue: "#00bfff", dimgray: "#696969", dimgrey: "#696969", dodgerblue: "#1e90ff", firebrick: "#b22222", floralwhite: "#fffaf0", forestgreen: "#228b22", fuchsia: "#ff00ff", gainsboro: "#dcdcdc", ghostwhite: "#f8f8ff", gold: "#ffd700", goldenrod: "#daa520", gray: "#808080", green: "#008000", greenyellow: "#adff2f", grey: "#808080", honeydew: "#f0fff0", hotpink: "#ff69b4", indianred: "#cd5c5c", indigo: "#4b0082", ivory: "#fffff0", khaki: "#f0e68c", lavender: "#e6e6fa", lavenderblush: "#fff0f5", lawngreen: "#7cfc00", lemonchiffon: "#fffacd", lightblue: "#add8e6", lightcoral: "#f08080", lightcyan: "#e0ffff", lightgoldenrodyellow: "#fafad2", lightgray: "#d3d3d3", lightgreen: "#90ee90", lightgrey: "#d3d3d3", lightpink: "#ffb6c1", lightsalmon: "#ffa07a", lightseagreen: "#20b2aa", lightskyblue: "#87cefa", lightslategray: "#778899", lightslategrey: "#778899", lightsteelblue: "#b0c4de", lightyellow: "#ffffe0", lime: "#00ff00", limegreen: "#32cd32", linen: "#faf0e6", magenta: "#ff00ff", maroon: "#800000", mediumaquamarine: "#66cdaa", mediumblue: "#0000cd", mediumorchid: "#ba55d3", mediumpurple: "#9370db", mediumseagreen: "#3cb371", mediumslateblue: "#7b68ee", mediumspringgreen: "#00fa9a", mediumturquoise: "#48d1cc", mediumvioletred: "#c71585", midnightblue: "#191970", mintcream: "#f5fffa", mistyrose: "#ffe4e1", moccasin: "#ffe4b5", navajowhite: "#ffdead", navy: "#000080", oldlace: "#fdf5e6", olive: "#808000", olivedrab: "#6b8e23", orange: "#ffa500", orangered: "#ff4500", orchid: "#da70d6", palegoldenrod: "#eee8aa", palegreen: "#98fb98", paleturquoise: "#afeeee", palevioletred: "#db7093", papayawhip: "#ffefd5", peachpuff: "#ffdab9", peru: "#cd853f", pink: "#ffc0cb", plum: "#dda0dd", powderblue: "#b0e0e6", purple: "#800080", red: "#ff0000", rosybrown: "#bc8f8f", royalblue: "#4169e1", saddlebrown: "#8b4513", salmon: "#fa8072", sandybrown: "#f4a460", seagreen: "#2e8b57", seashell: "#fff5ee", sienna: "#a0522d", silver: "#c0c0c0", skyblue: "#87ceeb", slateblue: "#6a5acd", slategray: "#708090", slategrey: "#708090", snow: "#fffafa", springgreen: "#00ff7f", steelblue: "#4682b4", tan: "#d2b48c", teal: "#008080", thistle: "#d8bfd8", tomato: "#ff6347", turquoise: "#40e0d0", violet: "#ee82ee", wheat: "#f5deb3", white: "#ffffff", whitesmoke: "#f5f5f5", yellow: "#ffff00", yellowgreen: "#9acd32" }); d3_rgb_names.forEach(function(key, value) { d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb)); }); d3.hsl = function(h, s, l) { return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l); }; function d3_hsl(h, s, l) { return new d3_Hsl(h, s, l); } function d3_Hsl(h, s, l) { this.h = h; this.s = s; this.l = l; } var d3_hslPrototype = d3_Hsl.prototype = new d3_Color(); d3_hslPrototype.brighter = function(k) { k = Math.pow(.7, arguments.length ? k : 1); return d3_hsl(this.h, this.s, this.l / k); }; d3_hslPrototype.darker = function(k) { k = Math.pow(.7, arguments.length ? k : 1); return d3_hsl(this.h, this.s, k * this.l); }; d3_hslPrototype.rgb = function() { return d3_hsl_rgb(this.h, this.s, this.l); }; function d3_hsl_rgb(h, s, l) { var m1, m2; h = h % 360; if (h < 0) h += 360; s = s < 0 ? 0 : s > 1 ? 1 : s; l = l < 0 ? 0 : l > 1 ? 1 : l; m2 = l <= .5 ? l * (1 + s) : l + s - l * s; m1 = 2 * l - m2; function v(h) { if (h > 360) h -= 360; else if (h < 0) h += 360; if (h < 60) return m1 + (m2 - m1) * h / 60; if (h < 180) return m2; if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; return m1; } function vv(h) { return Math.round(v(h) * 255); } return d3_rgb(vv(h + 120), vv(h), vv(h - 120)); } d3.hcl = function(h, c, l) { return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l); }; function d3_hcl(h, c, l) { return new d3_Hcl(h, c, l); } function d3_Hcl(h, c, l) { this.h = h; this.c = c; this.l = l; } var d3_hclPrototype = d3_Hcl.prototype = new d3_Color(); d3_hclPrototype.brighter = function(k) { return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1))); }; d3_hclPrototype.darker = function(k) { return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1))); }; d3_hclPrototype.rgb = function() { return d3_hcl_lab(this.h, this.c, this.l).rgb(); }; function d3_hcl_lab(h, c, l) { return d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c); } d3.lab = function(l, a, b) { return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b); }; function d3_lab(l, a, b) { return new d3_Lab(l, a, b); } function d3_Lab(l, a, b) { this.l = l; this.a = a; this.b = b; } var d3_lab_K = 18; var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883; var d3_labPrototype = d3_Lab.prototype = new d3_Color(); d3_labPrototype.brighter = function(k) { return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); }; d3_labPrototype.darker = function(k) { return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); }; d3_labPrototype.rgb = function() { return d3_lab_rgb(this.l, this.a, this.b); }; function d3_lab_rgb(l, a, b) { var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200; x = d3_lab_xyz(x) * d3_lab_X; y = d3_lab_xyz(y) * d3_lab_Y; z = d3_lab_xyz(z) * d3_lab_Z; return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z)); } function d3_lab_hcl(l, a, b) { return d3_hcl(Math.atan2(b, a) / π * 180, Math.sqrt(a * a + b * b), l); } function d3_lab_xyz(x) { return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037; } function d3_xyz_lab(x) { return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; } function d3_xyz_rgb(r) { return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055)); } function d3_selection(groups) { d3_arraySubclass(groups, d3_selectionPrototype); return groups; } var d3_select = function(s, n) { return n.querySelector(s); }, d3_selectAll = function(s, n) { return n.querySelectorAll(s); }, d3_selectRoot = d3_document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) { return d3_selectMatcher.call(n, s); }; if (typeof Sizzle === "function") { d3_select = function(s, n) { return Sizzle(s, n)[0] || null; }; d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); }; d3_selectMatches = Sizzle.matchesSelector; } var d3_selectionPrototype = []; d3.selection = function() { return d3_selectionRoot; }; d3.selection.prototype = d3_selectionPrototype; d3_selectionPrototype.select = function(selector) { var subgroups = [], subgroup, subnode, group, node; if (typeof selector !== "function") selector = d3_selection_selector(selector); for (var j = -1, m = this.length; ++j < m; ) { subgroups.push(subgroup = []); subgroup.parentNode = (group = this[j]).parentNode; for (var i = -1, n = group.length; ++i < n; ) { if (node = group[i]) { subgroup.push(subnode = selector.call(node, node.__data__, i)); if (subnode && "__data__" in node) subnode.__data__ = node.__data__; } else { subgroup.push(null); } } } return d3_selection(subgroups); }; function d3_selection_selector(selector) { return function() { return d3_select(selector, this); }; } d3_selectionPrototype.selectAll = function(selector) { var subgroups = [], subgroup, node; if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); for (var j = -1, m = this.length; ++j < m; ) { for (var group = this[j], i = -1, n = group.length; ++i < n; ) { if (node = group[i]) { subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i))); subgroup.parentNode = node; } } } return d3_selection(subgroups); }; function d3_selection_selectorAll(selector) { return function() { return d3_selectAll(selector, this); }; } d3_selectionPrototype.attr = function(name, value) { if (arguments.length < 2) { if (typeof name === "string") { var node = this.node(); name = d3.ns.qualify(name); return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name); } for (value in name) this.each(d3_selection_attr(value, name[value])); return this; } return this.each(d3_selection_attr(name, value)); }; function d3_selection_attr(name, value) { name = d3.ns.qualify(name); function attrNull() { this.removeAttribute(name); } function attrNullNS() { this.removeAttributeNS(name.space, name.local); } function attrConstant() { this.setAttribute(name, value); } function attrConstantNS() { this.setAttributeNS(name.space, name.local, value); } function attrFunction() { var x = value.apply(this, arguments); if (x == null) this.removeAttribute(name); else this.setAttribute(name, x); } function attrFunctionNS() { var x = value.apply(this, arguments); if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x); } return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant; } d3_selectionPrototype.classed = function(name, value) { if (arguments.length < 2) { if (typeof name === "string") { var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1; if (value = node.classList) { while (++i < n) if (!value.contains(name[i])) return false; } else { value = node.className; if (value.baseVal != null) value = value.baseVal; while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false; } return true; } for (value in name) this.each(d3_selection_classed(value, name[value])); return this; } return this.each(d3_selection_classed(name, value)); }; function d3_selection_classedRe(name) { return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g"); } function d3_selection_classed(name, value) { name = name.trim().split(/\s+/).map(d3_selection_classedName); var n = name.length; function classedConstant() { var i = -1; while (++i < n) name[i](this, value); } function classedFunction() { var i = -1, x = value.apply(this, arguments); while (++i < n) name[i](this, x); } return typeof value === "function" ? classedFunction : classedConstant; } function d3_selection_classedName(name) { var re = d3_selection_classedRe(name); return function(node, value) { if (c = node.classList) return value ? c.add(name) : c.remove(name); var c = node.className, cb = c.baseVal != null, cv = cb ? c.baseVal : c; if (value) { re.lastIndex = 0; if (!re.test(cv)) { cv = d3_collapse(cv + " " + name); if (cb) c.baseVal = cv; else node.className = cv; } } else if (cv) { cv = d3_collapse(cv.replace(re, " ")); if (cb) c.baseVal = cv; else node.className = cv; } }; } d3_selectionPrototype.style = function(name, value, priority) { var n = arguments.length; if (n < 3) { if (typeof name !== "string") { if (n < 2) value = ""; for (priority in name) this.each(d3_selection_style(priority, name[priority], value)); return this; } if (n < 2) return d3_window.getComputedStyle(this.node(), null).getPropertyValue(name); priority = ""; } return this.each(d3_selection_style(name, value, priority)); }; function d3_selection_style(name, value, priority) { function styleNull() { this.style.removeProperty(name); } function styleConstant() { this.style.setProperty(name, value, priority); } function styleFunction() { var x = value.apply(this, arguments); if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority); } return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant; } d3_selectionPrototype.property = function(name, value) { if (arguments.length < 2) { if (typeof name === "string") return this.node()[name]; for (value in name) this.each(d3_selection_property(value, name[value])); return this; } return this.each(d3_selection_property(name, value)); }; function d3_selection_property(name, value) { function propertyNull() { delete this[name]; } function propertyConstant() { this[name] = value; } function propertyFunction() { var x = value.apply(this, arguments); if (x == null) delete this[name]; else this[name] = x; } return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant; } d3_selectionPrototype.text = function(value) { return arguments.length ? this.each(typeof value === "function" ? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null ? function() { this.textContent = ""; } : function() { this.textContent = value; }) : this.node().textContent; }; d3_selectionPrototype.html = function(value) { return arguments.length ? this.each(typeof value === "function" ? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null ? function() { this.innerHTML = ""; } : function() { this.innerHTML = value; }) : this.node().innerHTML; }; d3_selectionPrototype.append = function(name) { name = d3.ns.qualify(name); function append() { return this.appendChild(d3_document.createElementNS(this.namespaceURI, name)); } function appendNS() { return this.appendChild(d3_document.createElementNS(name.space, name.local)); } return this.select(name.local ? appendNS : append); }; d3_selectionPrototype.insert = function(name, before) { name = d3.ns.qualify(name); function insert() { return this.insertBefore(d3_document.createElementNS(this.namespaceURI, name), d3_select(before, this)); } function insertNS() { return this.insertBefore(d3_document.createElementNS(name.space, name.local), d3_select(before, this)); } return this.select(name.local ? insertNS : insert); }; d3_selectionPrototype.remove = function() { return this.each(function() { var parent = this.parentNode; if (parent) parent.removeChild(this); }); }; d3_selectionPrototype.data = function(value, key) { var i = -1, n = this.length, group, node; if (!arguments.length) { value = new Array(n = (group = this[0]).length); while (++i < n) { if (node = group[i]) { value[i] = node.__data__; } } return value; } function bind(group, groupData) { var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData; if (key) { var nodeByKeyValue = new d3_Map(), dataByKeyValue = new d3_Map(), keyValues = [], keyValue; for (i = -1; ++i < n; ) { keyValue = key.call(node = group[i], node.__data__, i); if (nodeByKeyValue.has(keyValue)) { exitNodes[i] = node; } else { nodeByKeyValue.set(keyValue, node); } keyValues.push(keyValue); } for (i = -1; ++i < m; ) { keyValue = key.call(groupData, nodeData = groupData[i], i); if (node = nodeByKeyValue.get(keyValue)) { updateNodes[i] = node; node.__data__ = nodeData; } else if (!dataByKeyValue.has(keyValue)) { enterNodes[i] = d3_selection_dataNode(nodeData); } dataByKeyValue.set(keyValue, nodeData); nodeByKeyValue.remove(keyValue); } for (i = -1; ++i < n; ) { if (nodeByKeyValue.has(keyValues[i])) { exitNodes[i] = group[i]; } } } else { for (i = -1; ++i < n0; ) { node = group[i]; nodeData = groupData[i]; if (node) { node.__data__ = nodeData; updateNodes[i] = node; } else { enterNodes[i] = d3_selection_dataNode(nodeData); } } for (;i < m; ++i) { enterNodes[i] = d3_selection_dataNode(groupData[i]); } for (;i < n; ++i) { exitNodes[i] = group[i]; } } enterNodes.update = updateNodes; enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode; enter.push(enterNodes); update.push(updateNodes); exit.push(exitNodes); } var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]); if (typeof value === "function") { while (++i < n) { bind(group = this[i], value.call(group, group.parentNode.__data__, i)); } } else { while (++i < n) { bind(group = this[i], value); } } update.enter = function() { return enter; }; update.exit = function() { return exit; }; return update; }; function d3_selection_dataNode(data) { return { __data__: data }; } d3_selectionPrototype.datum = function(value) { return arguments.length ? this.property("__data__", value) : this.property("__data__"); }; d3_selectionPrototype.filter = function(filter) { var subgroups = [], subgroup, group, node; if (typeof filter !== "function") filter = d3_selection_filter(filter); for (var j = 0, m = this.length; j < m; j++) { subgroups.push(subgroup = []); subgroup.parentNode = (group = this[j]).parentNode; for (var i = 0, n = group.length; i < n; i++) { if ((node = group[i]) && filter.call(node, node.__data__, i)) { subgroup.push(node); } } } return d3_selection(subgroups); }; function d3_selection_filter(selector) { return function() { return d3_selectMatches(this, selector); }; } d3_selectionPrototype.order = function() { for (var j = -1, m = this.length; ++j < m; ) { for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) { if (node = group[i]) { if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); next = node; } } } return this; }; d3_selectionPrototype.sort = function(comparator) { comparator = d3_selection_sortComparator.apply(this, arguments); for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator); return this.order(); }; function d3_selection_sortComparator(comparator) { if (!arguments.length) comparator = d3.ascending; return function(a, b) { return !a - !b || comparator(a.__data__, b.__data__); }; } d3_selectionPrototype.on = function(type, listener, capture) { var n = arguments.length; if (n < 3) { if (typeof type !== "string") { if (n < 2) listener = false; for (capture in type) this.each(d3_selection_on(capture, type[capture], listener)); return this; } if (n < 2) return (n = this.node()["__on" + type]) && n._; capture = false; } return this.each(d3_selection_on(type, listener, capture)); }; function d3_selection_on(type, listener, capture) { var name = "__on" + type, i = type.indexOf("."); if (i > 0) type = type.substring(0, i); function onRemove() { var wrapper = this[name]; if (wrapper) { this.removeEventListener(type, wrapper, wrapper.$); delete this[name]; } } function onAdd() { var node = this, args = d3_array(arguments); onRemove.call(this); this.addEventListener(type, this[name] = wrapper, wrapper.$ = capture); wrapper._ = listener; function wrapper(e) { var o = d3.event; d3.event = e; args[0] = node.__data__; try { listener.apply(node, args); } finally { d3.event = o; } } } return listener ? onAdd : onRemove; } d3_selectionPrototype.each = function(callback) { return d3_selection_each(this, function(node, i, j) { callback.call(node, node.__data__, i, j); }); }; function d3_selection_each(groups, callback) { for (var j = 0, m = groups.length; j < m; j++) { for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) { if (node = group[i]) callback(node, i, j); } } return groups; } d3_selectionPrototype.call = function(callback) { var args = d3_array(arguments); callback.apply(args[0] = this, args); return this; }; d3_selectionPrototype.empty = function() { return !this.node(); }; d3_selectionPrototype.node = function() { for (var j = 0, m = this.length; j < m; j++) { for (var group = this[j], i = 0, n = group.length; i < n; i++) { var node = group[i]; if (node) return node; } } return null; }; d3_selectionPrototype.transition = function() { var id = d3_transitionInheritId || ++d3_transitionId, subgroups = [], subgroup, node, transition = Object.create(d3_transitionInherit); transition.time = Date.now(); for (var j = -1, m = this.length; ++j < m; ) { subgroups.push(subgroup = []); for (var group = this[j], i = -1, n = group.length; ++i < n; ) { if (node = group[i]) d3_transitionNode(node, i, id, transition); subgroup.push(node); } } return d3_transition(subgroups, id); }; var d3_selectionRoot = d3_selection([ [ d3_document ] ]); d3_selectionRoot[0].parentNode = d3_selectRoot; d3.select = function(selector) { return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]); }; d3.selectAll = function(selector) { return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]); }; function d3_selection_enter(selection) { d3_arraySubclass(selection, d3_selection_enterPrototype); return selection; } var d3_selection_enterPrototype = []; d3.selection.enter = d3_selection_enter; d3.selection.enter.prototype = d3_selection_enterPrototype; d3_selection_enterPrototype.append = d3_selectionPrototype.append; d3_selection_enterPrototype.insert = d3_selectionPrototype.insert; d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; d3_selection_enterPrototype.node = d3_selectionPrototype.node; d3_selection_enterPrototype.select = function(selector) { var subgroups = [], subgroup, subnode, upgroup, group, node; for (var j = -1, m = this.length; ++j < m; ) { upgroup = (group = this[j]).update; subgroups.push(subgroup = []); subgroup.parentNode = group.parentNode; for (var i = -1, n = group.length; ++i < n; ) { if (node = group[i]) { subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i)); subnode.__data__ = node.__data__; } else { subgroup.push(null); } } } return d3_selection(subgroups); }; function d3_transition(groups, id) { d3_arraySubclass(groups, d3_transitionPrototype); groups.id = id; return groups; } var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit = { ease: d3_ease_cubicInOut, delay: 0, duration: 250 }; d3_transitionPrototype.call = d3_selectionPrototype.call; d3_transitionPrototype.empty = d3_selectionPrototype.empty; d3_transitionPrototype.node = d3_selectionPrototype.node; d3.transition = function(selection) { return arguments.length ? d3_transitionInheritId ? selection.transition() : selection : d3_selectionRoot.transition(); }; d3.transition.prototype = d3_transitionPrototype; function d3_transitionNode(node, i, id, inherit) { var lock = node.__transition__ || (node.__transition__ = { active: 0, count: 0 }), transition = lock[id]; if (!transition) { var time = inherit.time; transition = lock[id] = { tween: new d3_Map(), event: d3.dispatch("start", "end"), time: time, ease: inherit.ease, delay: inherit.delay, duration: inherit.duration }; ++lock.count; d3.timer(function(elapsed) { var d = node.__data__, ease = transition.ease, event = transition.event, delay = transition.delay, duration = transition.duration, tweened = []; return delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time), 1; function start(elapsed) { if (lock.active > id) return stop(); lock.active = id; event.start.call(node, d, i); transition.tween.forEach(function(key, value) { if (value = value.call(node, d, i)) { tweened.push(value); } }); if (!tick(elapsed)) d3.timer(tick, 0, time); return 1; } function tick(elapsed) { if (lock.active !== id) return stop(); var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length; while (n > 0) { tweened[--n].call(node, e); } if (t >= 1) { stop(); event.end.call(node, d, i); return 1; } } function stop() { if (--lock.count) delete lock[id]; else delete node.__transition__; return 1; } }, 0, time); return transition; } } d3_transitionPrototype.select = function(selector) { var id = this.id, subgroups = [], subgroup, subnode, node; if (typeof selector !== "function") selector = d3_selection_selector(selector); for (var j = -1, m = this.length; ++j < m; ) { subgroups.push(subgroup = []); for (var group = this[j], i = -1, n = group.length; ++i < n; ) { if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i))) { if ("__data__" in node) subnode.__data__ = node.__data__; d3_transitionNode(subnode, i, id, node.__transition__[id]); subgroup.push(subnode); } else { subgroup.push(null); } } } return d3_transition(subgroups, id); }; d3_transitionPrototype.selectAll = function(selector) { var id = this.id, subgroups = [], subgroup, subnodes, node, subnode, transition; if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); for (var j = -1, m = this.length; ++j < m; ) { for (var group = this[j], i = -1, n = group.length; ++i < n; ) { if (node = group[i]) { transition = node.__transition__[id]; subnodes = selector.call(node, node.__data__, i); subgroups.push(subgroup = []); for (var k = -1, o = subnodes.length; ++k < o; ) { d3_transitionNode(subnode = subnodes[k], k, id, transition); subgroup.push(subnode); } } } } return d3_transition(subgroups, id); }; d3_transitionPrototype.filter = function(filter) { var subgroups = [], subgroup, group, node; if (typeof filter !== "function") filter = d3_selection_filter(filter); for (var j = 0, m = this.length; j < m; j++) { subgroups.push(subgroup = []); for (var group = this[j], i = 0, n = group.length; i < n; i++) { if ((node = group[i]) && filter.call(node, node.__data__, i)) { subgroup.push(node); } } } return d3_transition(subgroups, this.id, this.time).ease(this.ease()); }; d3_transitionPrototype.attr = function(nameNS, value) { if (arguments.length < 2) { for (value in nameNS) this.attr(value, nameNS[value]); return this; } var interpolate = d3_interpolateByName(nameNS), name = d3.ns.qualify(nameNS); function attrNull() { this.removeAttribute(name); } function attrNullNS() { this.removeAttributeNS(name.space, name.local); } return d3_transition_tween(this, "attr." + nameNS, value, function(b) { function attrString() { var a = this.getAttribute(name), i; return a !== b && (i = interpolate(a, b), function(t) { this.setAttribute(name, i(t)); }); } function attrStringNS() { var a = this.getAttributeNS(name.space, name.local), i; return a !== b && (i = interpolate(a, b), function(t) { this.setAttributeNS(name.space, name.local, i(t)); }); } return b == null ? name.local ? attrNullNS : attrNull : (b += "", name.local ? attrStringNS : attrString); }); }; d3_transitionPrototype.attrTween = function(nameNS, tween) { var name = d3.ns.qualify(nameNS); function attrTween(d, i) { var f = tween.call(this, d, i, this.getAttribute(name)); return f && function(t) { this.setAttribute(name, f(t)); }; } function attrTweenNS(d, i) { var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); return f && function(t) { this.setAttributeNS(name.space, name.local, f(t)); }; } return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); }; d3_transitionPrototype.style = function(name, value, priority) { var n = arguments.length; if (n < 3) { if (typeof name !== "string") { if (n < 2) value = ""; for (priority in name) this.style(priority, name[priority], value); return this; } priority = ""; } var interpolate = d3_interpolateByName(name); function styleNull() { this.style.removeProperty(name); } return d3_transition_tween(this, "style." + name, value, function(b) { function styleString() { var a = d3_window.getComputedStyle(this, null).getPropertyValue(name), i; return a !== b && (i = interpolate(a, b), function(t) { this.style.setProperty(name, i(t), priority); }); } return b == null ? styleNull : (b += "", styleString); }); }; d3_transitionPrototype.styleTween = function(name, tween, priority) { if (arguments.length < 3) priority = ""; return this.tween("style." + name, function(d, i) { var f = tween.call(this, d, i, d3_window.getComputedStyle(this, null).getPropertyValue(name)); return f && function(t) { this.style.setProperty(name, f(t), priority); }; }); }; d3_transitionPrototype.text = function(value) { return d3_transition_tween(this, "text", value, d3_transition_text); }; function d3_transition_text(b) { if (b == null) b = ""; return function() { this.textContent = b; }; } d3_transitionPrototype.remove = function() { return this.each("end.transition", function() { var p; if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this); }); }; d3_transitionPrototype.ease = function(value) { var id = this.id; if (arguments.length < 1) return this.node().__transition__[id].ease; if (typeof value !== "function") value = d3.ease.apply(d3, arguments); return d3_selection_each(this, function(node) { node.__transition__[id].ease = value; }); }; d3_transitionPrototype.delay = function(value) { var id = this.id; return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { node.__transition__[id].delay = value.call(node, node.__data__, i, j) | 0; } : (value |= 0, function(node) { node.__transition__[id].delay = value; })); }; d3_transitionPrototype.duration = function(value) { var id = this.id; return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j) | 0); } : (value = Math.max(1, value | 0), function(node) { node.__transition__[id].duration = value; })); }; d3_transitionPrototype.each = function(type, listener) { var id = this.id; if (arguments.length < 2) { var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId; d3_transitionInheritId = id; d3_selection_each(this, function(node, i, j) { d3_transitionInherit = node.__transition__[id]; type.call(node, node.__data__, i, j); }); d3_transitionInherit = inherit; d3_transitionInheritId = inheritId; } else { d3_selection_each(this, function(node) { node.__transition__[id].event.on(type, listener); }); } return this; }; d3_transitionPrototype.transition = function() { var id0 = this.id, id1 = ++d3_transitionId, subgroups = [], subgroup, group, node, transition; for (var j = 0, m = this.length; j < m; j++) { subgroups.push(subgroup = []); for (var group = this[j], i = 0, n = group.length; i < n; i++) { if (node = group[i]) { transition = Object.create(node.__transition__[id0]); transition.delay += transition.duration; d3_transitionNode(node, i, id1, transition); } subgroup.push(node); } } return d3_transition(subgroups, id1); }; d3_transitionPrototype.tween = function(name, tween) { var id = this.id; if (arguments.length < 2) return this.node().__transition__[id].tween.get(name); return d3_selection_each(this, tween == null ? function(node) { node.__transition__[id].tween.remove(name); } : function(node) { node.__transition__[id].tween.set(name, tween); }); }; function d3_transition_tween(groups, name, value, tween) { var id = groups.id; return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) { node.__transition__[id].tween.set(name, tween(value.call(node, node.__data__, i, j))); } : (value = tween(value), function(node) { node.__transition__[id].tween.set(name, value); })); } var d3_timer_id = 0, d3_timer_byId = {}, d3_timer_queue = null, d3_timer_interval, d3_timer_timeout; d3.timer = function(callback, delay, then) { if (arguments.length < 3) { if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return; then = Date.now(); } var timer = d3_timer_byId[callback.id]; if (timer && timer.callback === callback) { timer.then = then; timer.delay = delay; } else d3_timer_byId[callback.id = ++d3_timer_id] = d3_timer_queue = { callback: callback, then: then, delay: delay, next: d3_timer_queue }; if (!d3_timer_interval) { d3_timer_timeout = clearTimeout(d3_timer_timeout); d3_timer_interval = 1; d3_timer_frame(d3_timer_step); } }; function d3_timer_step() { var elapsed, now = Date.now(), t1 = d3_timer_queue; while (t1) { elapsed = now - t1.then; if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed); t1 = t1.next; } var delay = d3_timer_flush() - now; if (delay > 24) { if (isFinite(delay)) { clearTimeout(d3_timer_timeout); d3_timer_timeout = setTimeout(d3_timer_step, delay); } d3_timer_interval = 0; } else { d3_timer_interval = 1; d3_timer_frame(d3_timer_step); } } d3.timer.flush = function() { var elapsed, now = Date.now(), t1 = d3_timer_queue; while (t1) { elapsed = now - t1.then; if (!t1.delay) t1.flush = t1.callback(elapsed); t1 = t1.next; } d3_timer_flush(); }; function d3_timer_flush() { var t0 = null, t1 = d3_timer_queue, then = Infinity; while (t1) { if (t1.flush) { delete d3_timer_byId[t1.callback.id]; t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next; } else { then = Math.min(then, t1.then + t1.delay); t1 = (t0 = t1).next; } } return then; } var d3_timer_frame = d3_window.requestAnimationFrame || d3_window.webkitRequestAnimationFrame || d3_window.mozRequestAnimationFrame || d3_window.oRequestAnimationFrame || d3_window.msRequestAnimationFrame || function(callback) { setTimeout(callback, 17); }; d3.mouse = function(container) { return d3_mousePoint(container, d3_eventSource()); }; var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0; function d3_mousePoint(container, e) { var svg = container.ownerSVGElement || container; if (svg.createSVGPoint) { var point = svg.createSVGPoint(); if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) { svg = d3.select(d3_document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0); var ctm = svg[0][0].getScreenCTM(); d3_mouse_bug44083 = !(ctm.f || ctm.e); svg.remove(); } if (d3_mouse_bug44083) { point.x = e.pageX; point.y = e.pageY; } else { point.x = e.clientX; point.y = e.clientY; } point = point.matrixTransform(container.getScreenCTM().inverse()); return [ point.x, point.y ]; } var rect = container.getBoundingClientRect(); return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ]; } d3.touches = function(container, touches) { if (arguments.length < 2) touches = d3_eventSource().touches; return touches ? d3_array(touches).map(function(touch) { var point = d3_mousePoint(container, touch); point.identifier = touch.identifier; return point; }) : []; }; function d3_noop() {} d3.scale = {}; function d3_scaleExtent(domain) { var start = domain[0], stop = domain[domain.length - 1]; return start < stop ? [ start, stop ] : [ stop, start ]; } function d3_scaleRange(scale) { return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); } function d3_scale_nice(domain, nice) { var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx; if (x1 < x0) { dx = i0, i0 = i1, i1 = dx; dx = x0, x0 = x1, x1 = dx; } if (nice = nice(x1 - x0)) { domain[i0] = nice.floor(x0); domain[i1] = nice.ceil(x1); } return domain; } function d3_scale_niceDefault() { return Math; } d3.scale.linear = function() { return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3.interpolate, false); }; function d3_scale_linear(domain, range, interpolate, clamp) { var output, input; function rescale() { var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; output = linear(domain, range, uninterpolate, interpolate); input = linear(range, domain, uninterpolate, d3.interpolate); return scale; } function scale(x) { return output(x); } scale.invert = function(y) { return input(y); }; scale.domain = function(x) { if (!arguments.length) return domain; domain = x.map(Number); return rescale(); }; scale.range = function(x) { if (!arguments.length) return range; range = x; return rescale(); }; scale.rangeRound = function(x) { return scale.range(x).interpolate(d3.interpolateRound); }; scale.clamp = function(x) { if (!arguments.length) return clamp; clamp = x; return rescale(); }; scale.interpolate = function(x) { if (!arguments.length) return interpolate; interpolate = x; return rescale(); }; scale.ticks = function(m) { return d3_scale_linearTicks(domain, m); }; scale.tickFormat = function(m) { return d3_scale_linearTickFormat(domain, m); }; scale.nice = function() { d3_scale_nice(domain, d3_scale_linearNice); return rescale(); }; scale.copy = function() { return d3_scale_linear(domain, range, interpolate, clamp); }; return rescale(); } function d3_scale_linearRebind(scale, linear) { return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); } function d3_scale_linearNice(dx) { dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1); return dx && { floor: function(x) { return Math.floor(x / dx) * dx; }, ceil: function(x) { return Math.ceil(x / dx) * dx; } }; } function d3_scale_linearTickRange(domain, m) { var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step; if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2; extent[0] = Math.ceil(extent[0] / step) * step; extent[1] = Math.floor(extent[1] / step) * step + step * .5; extent[2] = step; return extent; } function d3_scale_linearTicks(domain, m) { return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); } function d3_scale_linearTickFormat(domain, m) { return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f"); } function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]); return function(x) { return i(u(x)); }; } function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1; if (domain[k] < domain[0]) { domain = domain.slice().reverse(); range = range.slice().reverse(); } while (++j <= k) { u.push(uninterpolate(domain[j - 1], domain[j])); i.push(interpolate(range[j - 1], range[j])); } return function(x) { var j = d3.bisect(domain, x, 1, k) - 1; return i[j](u[j](x)); }; } d3.scale.log = function() { return d3_scale_log(d3.scale.linear(), d3_scale_logp); }; function d3_scale_log(linear, log) { var pow = log.pow; function scale(x) { return linear(log(x)); } scale.invert = function(x) { return pow(linear.invert(x)); }; scale.domain = function(x) { if (!arguments.length) return linear.domain().map(pow); log = x[0] < 0 ? d3_scale_logn : d3_scale_logp; pow = log.pow; linear.domain(x.map(log)); return scale; }; scale.nice = function() { linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault)); return scale; }; scale.ticks = function() { var extent = d3_scaleExtent(linear.domain()), ticks = []; if (extent.every(isFinite)) { var i = Math.floor(extent[0]), j = Math.ceil(extent[1]), u = pow(extent[0]), v = pow(extent[1]); if (log === d3_scale_logn) { ticks.push(pow(i)); for (;i++ < j; ) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k); } else { for (;i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k); ticks.push(pow(i)); } for (i = 0; ticks[i] < u; i++) {} for (j = ticks.length; ticks[j - 1] > v; j--) {} ticks = ticks.slice(i, j); } return ticks; }; scale.tickFormat = function(n, format) { if (arguments.length < 2) format = d3_scale_logFormat; if (!arguments.length) return format; var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), e; return function(d) { return d / pow(f(log(d) + e)) <= k ? format(d) : ""; }; }; scale.copy = function() { return d3_scale_log(linear.copy(), log); }; return d3_scale_linearRebind(scale, linear); } var d3_scale_logFormat = d3.format(".0e"); function d3_scale_logp(x) { return Math.log(x < 0 ? 0 : x) / Math.LN10; } function d3_scale_logn(x) { return -Math.log(x > 0 ? 0 : -x) / Math.LN10; } d3_scale_logp.pow = function(x) { return Math.pow(10, x); }; d3_scale_logn.pow = function(x) { return -Math.pow(10, -x); }; d3.scale.pow = function() { return d3_scale_pow(d3.scale.linear(), 1); }; function d3_scale_pow(linear, exponent) { var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent); function scale(x) { return linear(powp(x)); } scale.invert = function(x) { return powb(linear.invert(x)); }; scale.domain = function(x) { if (!arguments.length) return linear.domain().map(powb); linear.domain(x.map(powp)); return scale; }; scale.ticks = function(m) { return d3_scale_linearTicks(scale.domain(), m); }; scale.tickFormat = function(m) { return d3_scale_linearTickFormat(scale.domain(), m); }; scale.nice = function() { return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice)); }; scale.exponent = function(x) { if (!arguments.length) return exponent; var domain = scale.domain(); powp = d3_scale_powPow(exponent = x); powb = d3_scale_powPow(1 / exponent); return scale.domain(domain); }; scale.copy = function() { return d3_scale_pow(linear.copy(), exponent); }; return d3_scale_linearRebind(scale, linear); } function d3_scale_powPow(e) { return function(x) { return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); }; } d3.scale.sqrt = function() { return d3.scale.pow().exponent(.5); }; d3.scale.ordinal = function() { return d3_scale_ordinal([], { t: "range", a: [ [] ] }); }; function d3_scale_ordinal(domain, ranger) { var index, range, rangeBand; function scale(x) { return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length]; } function steps(start, step) { return d3.range(domain.length).map(function(i) { return start + step * i; }); } scale.domain = function(x) { if (!arguments.length) return domain; domain = []; index = new d3_Map(); var i = -1, n = x.length, xi; while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi)); return scale[ranger.t].apply(scale, ranger.a); }; scale.range = function(x) { if (!arguments.length) return range; range = x; rangeBand = 0; ranger = { t: "range", a: arguments }; return scale; }; scale.rangePoints = function(x, padding) { if (arguments.length < 2) padding = 0; var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding); range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step); rangeBand = 0; ranger = { t: "rangePoints", a: arguments }; return scale; }; scale.rangeBands = function(x, padding, outerPadding) { if (arguments.length < 2) padding = 0; if (arguments.length < 3) outerPadding = padding; var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding); range = steps(start + step * outerPadding, step); if (reverse) range.reverse(); rangeBand = step * (1 - padding); ranger = { t: "rangeBands", a: arguments }; return scale; }; scale.rangeRoundBands = function(x, padding, outerPadding) { if (arguments.length < 2) padding = 0; if (arguments.length < 3) outerPadding = padding; var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step; range = steps(start + Math.round(error / 2), step); if (reverse) range.reverse(); rangeBand = Math.round(step * (1 - padding)); ranger = { t: "rangeRoundBands", a: arguments }; return scale; }; scale.rangeBand = function() { return rangeBand; }; scale.rangeExtent = function() { return d3_scaleExtent(ranger.a[0]); }; scale.copy = function() { return d3_scale_ordinal(domain, ranger); }; return scale.domain(domain); } d3.scale.category10 = function() { return d3.scale.ordinal().range(d3_category10); }; d3.scale.category20 = function() { return d3.scale.ordinal().range(d3_category20); }; d3.scale.category20b = function() { return d3.scale.ordinal().range(d3_category20b); }; d3.scale.category20c = function() { return d3.scale.ordinal().range(d3_category20c); }; var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ]; var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ]; var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ]; var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ]; d3.scale.quantile = function() { return d3_scale_quantile([], []); }; function d3_scale_quantile(domain, range) { var thresholds; function rescale() { var k = 0, q = range.length; thresholds = []; while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); return scale; } function scale(x) { if (isNaN(x = +x)) return NaN; return range[d3.bisect(thresholds, x)]; } scale.domain = function(x) { if (!arguments.length) return domain; domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending); return rescale(); }; scale.range = function(x) { if (!arguments.length) return range; range = x; return rescale(); }; scale.quantiles = function() { return thresholds; }; scale.copy = function() { return d3_scale_quantile(domain, range); }; return rescale(); } d3.scale.quantize = function() { return d3_scale_quantize(0, 1, [ 0, 1 ]); }; function d3_scale_quantize(x0, x1, range) { var kx, i; function scale(x) { return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; } function rescale() { kx = range.length / (x1 - x0); i = range.length - 1; return scale; } scale.domain = function(x) { if (!arguments.length) return [ x0, x1 ]; x0 = +x[0]; x1 = +x[x.length - 1]; return rescale(); }; scale.range = function(x) { if (!arguments.length) return range; range = x; return rescale(); }; scale.copy = function() { return d3_scale_quantize(x0, x1, range); }; return rescale(); } d3.scale.threshold = function() { return d3_scale_threshold([ .5 ], [ 0, 1 ]); }; function d3_scale_threshold(domain, range) { function scale(x) { return range[d3.bisect(domain, x)]; } scale.domain = function(_) { if (!arguments.length) return domain; domain = _; return scale; }; scale.range = function(_) { if (!arguments.length) return range; range = _; return scale; }; scale.copy = function() { return d3_scale_threshold(domain, range); }; return scale; } d3.scale.identity = function() { return d3_scale_identity([ 0, 1 ]); }; function d3_scale_identity(domain) { function identity(x) { return +x; } identity.invert = identity; identity.domain = identity.range = function(x) { if (!arguments.length) return domain; domain = x.map(identity); return identity; }; identity.ticks = function(m) { return d3_scale_linearTicks(domain, m); }; identity.tickFormat = function(m) { return d3_scale_linearTickFormat(domain, m); }; identity.copy = function() { return d3_scale_identity(domain); }; return identity; } d3.svg = {}; d3.svg.arc = function() { var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; function arc() { var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), df = da < π ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1); return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z"; } arc.innerRadius = function(v) { if (!arguments.length) return innerRadius; innerRadius = d3_functor(v); return arc; }; arc.outerRadius = function(v) { if (!arguments.length) return outerRadius; outerRadius = d3_functor(v); return arc; }; arc.startAngle = function(v) { if (!arguments.length) return startAngle; startAngle = d3_functor(v); return arc; }; arc.endAngle = function(v) { if (!arguments.length) return endAngle; endAngle = d3_functor(v); return arc; }; arc.centroid = function() { var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset; return [ Math.cos(a) * r, Math.sin(a) * r ]; }; return arc; }; var d3_svg_arcOffset = -π / 2, d3_svg_arcMax = 2 * π - 1e-6; function d3_svg_arcInnerRadius(d) { return d.innerRadius; } function d3_svg_arcOuterRadius(d) { return d.outerRadius; } function d3_svg_arcStartAngle(d) { return d.startAngle; } function d3_svg_arcEndAngle(d) { return d.endAngle; } function d3_svg_line(projection) { var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7; function line(data) { var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y); function segment() { segments.push("M", interpolate(projection(points), tension)); } while (++i < n) { if (defined.call(this, d = data[i], i)) { points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]); } else if (points.length) { segment(); points = []; } } if (points.length) segment(); return segments.length ? segments.join("") : null; } line.x = function(_) { if (!arguments.length) return x; x = _; return line; }; line.y = function(_) { if (!arguments.length) return y; y = _; return line; }; line.defined = function(_) { if (!arguments.length) return defined; defined = _; return line; }; line.interpolate = function(_) { if (!arguments.length) return interpolateKey; if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; return line; }; line.tension = function(_) { if (!arguments.length) return tension; tension = _; return line; }; return line; } d3.svg.line = function() { return d3_svg_line(d3_identity); }; function d3_svg_lineX(d) { return d[0]; } function d3_svg_lineY(d) { return d[1]; } var d3_svg_lineInterpolators = d3.map({ linear: d3_svg_lineLinear, "linear-closed": d3_svg_lineLinearClosed, "step-before": d3_svg_lineStepBefore, "step-after": d3_svg_lineStepAfter, basis: d3_svg_lineBasis, "basis-open": d3_svg_lineBasisOpen, "basis-closed": d3_svg_lineBasisClosed, bundle: d3_svg_lineBundle, cardinal: d3_svg_lineCardinal, "cardinal-open": d3_svg_lineCardinalOpen, "cardinal-closed": d3_svg_lineCardinalClosed, monotone: d3_svg_lineMonotone }); d3_svg_lineInterpolators.forEach(function(key, value) { value.key = key; value.closed = /-closed$/.test(key); }); function d3_svg_lineLinear(points) { return points.join("L"); } function d3_svg_lineLinearClosed(points) { return d3_svg_lineLinear(points) + "Z"; } function d3_svg_lineStepBefore(points) { var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); return path.join(""); } function d3_svg_lineStepAfter(points) { var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); return path.join(""); } function d3_svg_lineCardinalOpen(points, tension) { return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension)); } function d3_svg_lineCardinalClosed(points, tension) { return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension)); } function d3_svg_lineCardinal(points, tension) { return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension)); } function d3_svg_lineHermite(points, tangents) { if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) { return d3_svg_lineLinear(points); } var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1; if (quad) { path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1]; p0 = points[1]; pi = 2; } if (tangents.length > 1) { t = tangents[1]; p = points[pi]; pi++; path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; for (var i = 2; i < tangents.length; i++, pi++) { p = points[pi]; t = tangents[i]; path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; } } if (quad) { var lp = points[pi]; path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1]; } return path; } function d3_svg_lineCardinalTangents(points, tension) { var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length; while (++i < n) { p0 = p1; p1 = p2; p2 = points[i]; tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]); } return tangents; } function d3_svg_lineBasis(points) { if (points.length < 3) return d3_svg_lineLinear(points); var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ]; d3_svg_lineBasisBezier(path, px, py); while (++i < n) { pi = points[i]; px.shift(); px.push(pi[0]); py.shift(); py.push(pi[1]); d3_svg_lineBasisBezier(path, px, py); } i = -1; while (++i < 2) { px.shift(); px.push(pi[0]); py.shift(); py.push(pi[1]); d3_svg_lineBasisBezier(path, px, py); } return path.join(""); } function d3_svg_lineBasisOpen(points) { if (points.length < 4) return d3_svg_lineLinear(points); var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ]; while (++i < 3) { pi = points[i]; px.push(pi[0]); py.push(pi[1]); } path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); --i; while (++i < n) { pi = points[i]; px.shift(); px.push(pi[0]); py.shift(); py.push(pi[1]); d3_svg_lineBasisBezier(path, px, py); } return path.join(""); } function d3_svg_lineBasisClosed(points) { var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = []; while (++i < 4) { pi = points[i % n]; px.push(pi[0]); py.push(pi[1]); } path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; --i; while (++i < m) { pi = points[i % n]; px.shift(); px.push(pi[0]); py.shift(); py.push(pi[1]); d3_svg_lineBasisBezier(path, px, py); } return path.join(""); } function d3_svg_lineBundle(points, tension) { var n = points.length - 1; if (n) { var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t; while (++i <= n) { p = points[i]; t = i / n; p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); } } return d3_svg_lineBasis(points); } function d3_svg_lineDot4(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; } var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ]; function d3_svg_lineBasisBezier(path, x, y) { path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); } function d3_svg_lineSlope(p0, p1) { return (p1[1] - p0[1]) / (p1[0] - p0[0]); } function d3_svg_lineFiniteDifferences(points) { var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1); while (++i < j) { m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2; } m[i] = d; return m; } function d3_svg_lineMonotoneTangents(points) { var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1; while (++i < j) { d = d3_svg_lineSlope(points[i], points[i + 1]); if (Math.abs(d) < 1e-6) { m[i] = m[i + 1] = 0; } else { a = m[i] / d; b = m[i + 1] / d; s = a * a + b * b; if (s > 9) { s = d * 3 / Math.sqrt(s); m[i] = s * a; m[i + 1] = s * b; } } } i = -1; while (++i <= j) { s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i])); tangents.push([ s || 0, m[i] * s || 0 ]); } return tangents; } function d3_svg_lineMonotone(points) { return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); } d3.svg.line.radial = function() { var line = d3_svg_line(d3_svg_lineRadial); line.radius = line.x, delete line.x; line.angle = line.y, delete line.y; return line; }; function d3_svg_lineRadial(points) { var point, i = -1, n = points.length, r, a; while (++i < n) { point = points[i]; r = point[0]; a = point[1] + d3_svg_arcOffset; point[0] = r * Math.cos(a); point[1] = r * Math.sin(a); } return points; } function d3_svg_area(projection) { var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7; function area(data) { var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() { return x; } : d3_functor(x1), fy1 = y0 === y1 ? function() { return y; } : d3_functor(y1), x, y; function segment() { segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z"); } while (++i < n) { if (defined.call(this, d = data[i], i)) { points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]); points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]); } else if (points0.length) { segment(); points0 = []; points1 = []; } } if (points0.length) segment(); return segments.length ? segments.join("") : null; } area.x = function(_) { if (!arguments.length) return x1; x0 = x1 = _; return area; }; area.x0 = function(_) { if (!arguments.length) return x0; x0 = _; return area; }; area.x1 = function(_) { if (!arguments.length) return x1; x1 = _; return area; }; area.y = function(_) { if (!arguments.length) return y1; y0 = y1 = _; return area; }; area.y0 = function(_) { if (!arguments.length) return y0; y0 = _; return area; }; area.y1 = function(_) { if (!arguments.length) return y1; y1 = _; return area; }; area.defined = function(_) { if (!arguments.length) return defined; defined = _; return area; }; area.interpolate = function(_) { if (!arguments.length) return interpolateKey; if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; interpolateReverse = interpolate.reverse || interpolate; L = interpolate.closed ? "M" : "L"; return area; }; area.tension = function(_) { if (!arguments.length) return tension; tension = _; return area; }; return area; } d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; d3.svg.area = function() { return d3_svg_area(d3_identity); }; d3.svg.area.radial = function() { var area = d3_svg_area(d3_svg_lineRadial); area.radius = area.x, delete area.x; area.innerRadius = area.x0, delete area.x0; area.outerRadius = area.x1, delete area.x1; area.angle = area.y, delete area.y; area.startAngle = area.y0, delete area.y0; area.endAngle = area.y1, delete area.y1; return area; }; d3.svg.chord = function() { var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; function chord(d, i) { var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i); return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z"; } function subgroup(self, f, d, i) { var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset; return { r: r, a0: a0, a1: a1, p0: [ r * Math.cos(a0), r * Math.sin(a0) ], p1: [ r * Math.cos(a1), r * Math.sin(a1) ] }; } function equals(a, b) { return a.a0 == b.a0 && a.a1 == b.a1; } function arc(r, p, a) { return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p; } function curve(r0, p0, r1, p1) { return "Q 0,0 " + p1; } chord.radius = function(v) { if (!arguments.length) return radius; radius = d3_functor(v); return chord; }; chord.source = function(v) { if (!arguments.length) return source; source = d3_functor(v); return chord; }; chord.target = function(v) { if (!arguments.length) return target; target = d3_functor(v); return chord; }; chord.startAngle = function(v) { if (!arguments.length) return startAngle; startAngle = d3_functor(v); return chord; }; chord.endAngle = function(v) { if (!arguments.length) return endAngle; endAngle = d3_functor(v); return chord; }; return chord; }; function d3_svg_chordRadius(d) { return d.radius; } d3.svg.diagonal = function() { var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection; function diagonal(d, i) { var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, { x: p0.x, y: m }, { x: p3.x, y: m }, p3 ]; p = p.map(projection); return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; } diagonal.source = function(x) { if (!arguments.length) return source; source = d3_functor(x); return diagonal; }; diagonal.target = function(x) { if (!arguments.length) return target; target = d3_functor(x); return diagonal; }; diagonal.projection = function(x) { if (!arguments.length) return projection; projection = x; return diagonal; }; return diagonal; }; function d3_svg_diagonalProjection(d) { return [ d.x, d.y ]; } d3.svg.diagonal.radial = function() { var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection; diagonal.projection = function(x) { return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection; }; return diagonal; }; function d3_svg_diagonalRadialProjection(projection) { return function() { var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset; return [ r * Math.cos(a), r * Math.sin(a) ]; }; } d3.svg.symbol = function() { var type = d3_svg_symbolType, size = d3_svg_symbolSize; function symbol(d, i) { return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i)); } symbol.type = function(x) { if (!arguments.length) return type; type = d3_functor(x); return symbol; }; symbol.size = function(x) { if (!arguments.length) return size; size = d3_functor(x); return symbol; }; return symbol; }; function d3_svg_symbolSize() { return 64; } function d3_svg_symbolType() { return "circle"; } function d3_svg_symbolCircle(size) { var r = Math.sqrt(size / π); return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z"; } var d3_svg_symbols = d3.map({ circle: d3_svg_symbolCircle, cross: function(size) { var r = Math.sqrt(size / 5) / 2; return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z"; }, diamond: function(size) { var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30; return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z"; }, square: function(size) { var r = Math.sqrt(size) / 2; return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z"; }, "triangle-down": function(size) { var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z"; }, "triangle-up": function(size) { var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z"; } }); d3.svg.symbolTypes = d3_svg_symbols.keys(); var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians); d3.svg.axis = function() { var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0; function axis(g) { g.each(function() { var g = d3.select(this); var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_; var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".tick.minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", ".tick").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1); var tick = g.selectAll(".tick.major").data(ticks, String), tickEnter = tick.enter().insert("g", "path").attr("class", "tick major").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform; var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"), d3.transition(path)); var scale1 = scale.copy(), scale0 = this.__chart__ || scale1; this.__chart__ = scale1; tickEnter.append("line"); tickEnter.append("text"); var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"); switch (orient) { case "bottom": { tickTransform = d3_svg_axisX; subtickEnter.attr("y2", tickMinorSize); subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize); lineEnter.attr("y2", tickMajorSize); textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding); lineUpdate.attr("x2", 0).attr("y2", tickMajorSize); textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding); text.attr("dy", ".71em").style("text-anchor", "middle"); pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); break; } case "top": { tickTransform = d3_svg_axisX; subtickEnter.attr("y2", -tickMinorSize); subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize); lineEnter.attr("y2", -tickMajorSize); textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)); lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize); textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)); text.attr("dy", "0em").style("text-anchor", "middle"); pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize); break; } case "left": { tickTransform = d3_svg_axisY; subtickEnter.attr("x2", -tickMinorSize); subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0); lineEnter.attr("x2", -tickMajorSize); textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)); lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0); textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0); text.attr("dy", ".32em").style("text-anchor", "end"); pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); break; } case "right": { tickTransform = d3_svg_axisY; subtickEnter.attr("x2", tickMinorSize); subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0); lineEnter.attr("x2", tickMajorSize); textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding); lineUpdate.attr("x2", tickMajorSize).attr("y2", 0); textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0); text.attr("dy", ".32em").style("text-anchor", "start"); pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize); break; } } if (scale.ticks) { tickEnter.call(tickTransform, scale0); tickUpdate.call(tickTransform, scale1); tickExit.call(tickTransform, scale1); subtickEnter.call(tickTransform, scale0); subtickUpdate.call(tickTransform, scale1); subtickExit.call(tickTransform, scale1); } else { var dx = scale1.rangeBand() / 2, x = function(d) { return scale1(d) + dx; }; tickEnter.call(tickTransform, x); tickUpdate.call(tickTransform, x); } }); } axis.scale = function(x) { if (!arguments.length) return scale; scale = x; return axis; }; axis.orient = function(x) { if (!arguments.length) return orient; orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient; return axis; }; axis.ticks = function() { if (!arguments.length) return tickArguments_; tickArguments_ = arguments; return axis; }; axis.tickValues = function(x) { if (!arguments.length) return tickValues; tickValues = x; return axis; }; axis.tickFormat = function(x) { if (!arguments.length) return tickFormat_; tickFormat_ = x; return axis; }; axis.tickSize = function(x, y) { if (!arguments.length) return tickMajorSize; var n = arguments.length - 1; tickMajorSize = +x; tickMinorSize = n > 1 ? +y : tickMajorSize; tickEndSize = n > 0 ? +arguments[n] : tickMajorSize; return axis; }; axis.tickPadding = function(x) { if (!arguments.length) return tickPadding; tickPadding = +x; return axis; }; axis.tickSubdivide = function(x) { if (!arguments.length) return tickSubdivide; tickSubdivide = +x; return axis; }; return axis; }; var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = { top: 1, right: 1, bottom: 1, left: 1 }; function d3_svg_axisX(selection, x) { selection.attr("transform", function(d) { return "translate(" + x(d) + ",0)"; }); } function d3_svg_axisY(selection, y) { selection.attr("transform", function(d) { return "translate(0," + y(d) + ")"; }); } function d3_svg_axisSubdivide(scale, ticks, m) { subticks = []; if (m && ticks.length > 1) { var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v; while (++i < n) { for (j = m; --j > 0; ) { if ((v = +ticks[i] - j * d) >= extent[0]) { subticks.push(v); } } } for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) { subticks.push(v); } } return subticks; } d3.svg.brush = function() { var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain; function brush(g) { g.each(function() { var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e; g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart); bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"); fg.enter().append("rect").attr("class", "extent").style("cursor", "move"); tz.enter().append("g").attr("class", function(d) { return "resize " + d; }).style("cursor", function(d) { return d3_svg_brushCursor[d]; }).append("rect").attr("x", function(d) { return /[ew]$/.test(d) ? -3 : null; }).attr("y", function(d) { return /^[ns]/.test(d) ? -3 : null; }).attr("width", 6).attr("height", 6).style("visibility", "hidden"); tz.style("display", brush.empty() ? "none" : null); tz.exit().remove(); if (x) { e = d3_scaleRange(x); bg.attr("x", e[0]).attr("width", e[1] - e[0]); redrawX(g); } if (y) { e = d3_scaleRange(y); bg.attr("y", e[0]).attr("height", e[1] - e[0]); redrawY(g); } redraw(g); }); } function redraw(g) { g.selectAll(".resize").attr("transform", function(d) { return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")"; }); } function redrawX(g) { g.select(".extent").attr("x", extent[0][0]); g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]); } function redrawY(g) { g.select(".extent").attr("y", extent[0][1]); g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]); } function brushstart() { var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset; var w = d3.select(d3_window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup); if (dragging) { origin[0] = extent[0][0] - origin[0]; origin[1] = extent[0][1] - origin[1]; } else if (resizing) { var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing); offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ]; origin[0] = extent[ex][0]; origin[1] = extent[ey][1]; } else if (d3.event.altKey) center = origin.slice(); g.style("pointer-events", "none").selectAll(".resize").style("display", null); d3.select("body").style("cursor", eventTarget.style("cursor")); event_({ type: "brushstart" }); brushmove(); d3_eventCancel(); function mouse() { var touches = d3.event.changedTouches; return touches ? d3.touches(target, touches)[0] : d3.mouse(target); } function keydown() { if (d3.event.keyCode == 32) { if (!dragging) { center = null; origin[0] -= extent[1][0]; origin[1] -= extent[1][1]; dragging = 2; } d3_eventCancel(); } } function keyup() { if (d3.event.keyCode == 32 && dragging == 2) { origin[0] += extent[1][0]; origin[1] += extent[1][1]; dragging = 0; d3_eventCancel(); } } function brushmove() { var point = mouse(), moved = false; if (offset) { point[0] += offset[0]; point[1] += offset[1]; } if (!dragging) { if (d3.event.altKey) { if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ]; origin[0] = extent[+(point[0] < center[0])][0]; origin[1] = extent[+(point[1] < center[1])][1]; } else center = null; } if (resizingX && move1(point, x, 0)) { redrawX(g); moved = true; } if (resizingY && move1(point, y, 1)) { redrawY(g); moved = true; } if (moved) { redraw(g); event_({ type: "brush", mode: dragging ? "move" : "resize" }); } } function move1(point, scale, i) { var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max; if (dragging) { r0 -= position; r1 -= size + position; } min = Math.max(r0, Math.min(r1, point[i])); if (dragging) { max = (min += position) + size; } else { if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min)); if (position < min) { max = min; min = position; } else { max = position; } } if (extent[0][i] !== min || extent[1][i] !== max) { extentDomain = null; extent[0][i] = min; extent[1][i] = max; return true; } } function brushend() { brushmove(); g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null); d3.select("body").style("cursor", null); w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null); event_({ type: "brushend" }); d3_eventCancel(); } } brush.x = function(z) { if (!arguments.length) return x; x = z; resizes = d3_svg_brushResizes[!x << 1 | !y]; return brush; }; brush.y = function(z) { if (!arguments.length) return y; y = z; resizes = d3_svg_brushResizes[!x << 1 | !y]; return brush; }; brush.extent = function(z) { var x0, x1, y0, y1, t; if (!arguments.length) { z = extentDomain || extent; if (x) { x0 = z[0][0], x1 = z[1][0]; if (!extentDomain) { x0 = extent[0][0], x1 = extent[1][0]; if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); if (x1 < x0) t = x0, x0 = x1, x1 = t; } } if (y) { y0 = z[0][1], y1 = z[1][1]; if (!extentDomain) { y0 = extent[0][1], y1 = extent[1][1]; if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); if (y1 < y0) t = y0, y0 = y1, y1 = t; } } return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ]; } extentDomain = [ [ 0, 0 ], [ 0, 0 ] ]; if (x) { x0 = z[0], x1 = z[1]; if (y) x0 = x0[0], x1 = x1[0]; extentDomain[0][0] = x0, extentDomain[1][0] = x1; if (x.invert) x0 = x(x0), x1 = x(x1); if (x1 < x0) t = x0, x0 = x1, x1 = t; extent[0][0] = x0 | 0, extent[1][0] = x1 | 0; } if (y) { y0 = z[0], y1 = z[1]; if (x) y0 = y0[1], y1 = y1[1]; extentDomain[0][1] = y0, extentDomain[1][1] = y1; if (y.invert) y0 = y(y0), y1 = y(y1); if (y1 < y0) t = y0, y0 = y1, y1 = t; extent[0][1] = y0 | 0, extent[1][1] = y1 | 0; } return brush; }; brush.clear = function() { extentDomain = null; extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0; return brush; }; brush.empty = function() { return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1]; }; return d3.rebind(brush, event, "on"); }; var d3_svg_brushCursor = { n: "ns-resize", e: "ew-resize", s: "ns-resize", w: "ew-resize", nw: "nwse-resize", ne: "nesw-resize", se: "nwse-resize", sw: "nesw-resize" }; var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ]; d3.behavior = {}; d3.behavior.drag = function() { var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null; function drag() { this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown); } function mousedown() { var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches ? d3.event.changedTouches[0].identifier : null, offset, origin_ = point(), moved = 0; var w = d3.select(d3_window).on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true); if (origin) { offset = origin.apply(target, arguments); offset = [ offset.x - origin_[0], offset.y - origin_[1] ]; } else { offset = [ 0, 0 ]; } if (touchId == null) d3_eventCancel(); event_({ type: "dragstart" }); function point() { var p = target.parentNode; return touchId != null ? d3.touches(p).filter(function(p) { return p.identifier === touchId; })[0] : d3.mouse(p); } function dragmove() { if (!target.parentNode) return dragend(); var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1]; moved |= dx | dy; origin_ = p; d3_eventCancel(); event_({ type: "drag", x: p[0] + offset[0], y: p[1] + offset[1], dx: dx, dy: dy }); } function dragend() { event_({ type: "dragend" }); if (moved) { d3_eventCancel(); if (d3.event.target === eventTarget) w.on("click.drag", click, true); } w.on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", null); } function click() { d3_eventCancel(); w.on("click.drag", null); } } drag.origin = function(x) { if (!arguments.length) return origin; origin = x; return drag; }; return d3.rebind(drag, event, "on"); }; d3.behavior.zoom = function() { var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime; function zoom() { this.on("mousedown.zoom", mousedown).on("mousemove.zoom", mousemove).on(d3_behavior_zoomWheel + ".zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart); } zoom.translate = function(x) { if (!arguments.length) return translate; translate = x.map(Number); rescale(); return zoom; }; zoom.scale = function(x) { if (!arguments.length) return scale; scale = +x; rescale(); return zoom; }; zoom.scaleExtent = function(x) { if (!arguments.length) return scaleExtent; scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number); return zoom; }; zoom.x = function(z) { if (!arguments.length) return x1; x1 = z; x0 = z.copy(); translate = [ 0, 0 ]; scale = 1; return zoom; }; zoom.y = function(z) { if (!arguments.length) return y1; y1 = z; y0 = z.copy(); translate = [ 0, 0 ]; scale = 1; return zoom; }; function location(p) { return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ]; } function point(l) { return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ]; } function scaleTo(s) { scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s)); } function translateTo(p, l) { l = point(l); translate[0] += p[0] - l[0]; translate[1] += p[1] - l[1]; } function rescale() { if (x1) x1.domain(x0.range().map(function(x) { return (x - translate[0]) / scale; }).map(x0.invert)); if (y1) y1.domain(y0.range().map(function(y) { return (y - translate[1]) / scale; }).map(y0.invert)); } function dispatch(event) { rescale(); d3.event.preventDefault(); event({ type: "zoom", scale: scale, translate: translate }); } function mousedown() { var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(d3_window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target)); d3_window.focus(); d3_eventCancel(); function mousemove() { moved = 1; translateTo(d3.mouse(target), l); dispatch(event_); } function mouseup() { if (moved) d3_eventCancel(); w.on("mousemove.zoom", null).on("mouseup.zoom", null); if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true); } function click() { d3_eventCancel(); w.on("click.zoom", null); } } function mousewheel() { if (!translate0) translate0 = location(d3.mouse(this)); scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale); translateTo(d3.mouse(this), translate0); dispatch(event.of(this, arguments)); } function mousemove() { translate0 = null; } function dblclick() { var p = d3.mouse(this), l = location(p), k = Math.log(scale) / Math.LN2; scaleTo(Math.pow(2, d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1)); translateTo(p, l); dispatch(event.of(this, arguments)); } function touchstart() { var touches = d3.touches(this), now = Date.now(); scale0 = scale; translate0 = {}; touches.forEach(function(t) { translate0[t.identifier] = location(t); }); d3_eventCancel(); if (touches.length === 1) { if (now - touchtime < 500) { var p = touches[0], l = location(touches[0]); scaleTo(scale * 2); translateTo(p, l); dispatch(event.of(this, arguments)); } touchtime = now; } } function touchmove() { var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier]; if (p1 = touches[1]) { var p1, l1 = translate0[p1.identifier]; p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ]; l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ]; scaleTo(d3.event.scale * scale0); } translateTo(p0, l0); touchtime = null; dispatch(event.of(this, arguments)); } return d3.rebind(zoom, event, "on"); }; var d3_behavior_zoomInfinity = [ 0, Infinity ]; var d3_behavior_zoomDelta, d3_behavior_zoomWheel = "onwheel" in document ? (d3_behavior_zoomDelta = function() { return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1); }, "wheel") : "onmousewheel" in document ? (d3_behavior_zoomDelta = function() { return d3.event.wheelDelta; }, "mousewheel") : (d3_behavior_zoomDelta = function() { return -d3.event.detail; }, "MozMousePixelScroll"); d3.layout = {}; d3.layout.bundle = function() { return function(links) { var paths = [], i = -1, n = links.length; while (++i < n) paths.push(d3_layout_bundlePath(links[i])); return paths; }; }; function d3_layout_bundlePath(link) { var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ]; while (start !== lca) { start = start.parent; points.push(start); } var k = points.length; while (end !== lca) { points.splice(k, 0, end); end = end.parent; } return points; } function d3_layout_bundleAncestors(node) { var ancestors = [], parent = node.parent; while (parent != null) { ancestors.push(node); node = parent; parent = parent.parent; } ancestors.push(node); return ancestors; } function d3_layout_bundleLeastCommonAncestor(a, b) { if (a === b) return a; var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null; while (aNode === bNode) { sharedNode = aNode; aNode = aNodes.pop(); bNode = bNodes.pop(); } return sharedNode; } d3.layout.chord = function() { var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords; function relayout() { var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j; chords = []; groups = []; k = 0, i = -1; while (++i < n) { x = 0, j = -1; while (++j < n) { x += matrix[i][j]; } groupSums.push(x); subgroupIndex.push(d3.range(n)); k += x; } if (sortGroups) { groupIndex.sort(function(a, b) { return sortGroups(groupSums[a], groupSums[b]); }); } if (sortSubgroups) { subgroupIndex.forEach(function(d, i) { d.sort(function(a, b) { return sortSubgroups(matrix[i][a], matrix[i][b]); }); }); } k = (2 * π - padding * n) / k; x = 0, i = -1; while (++i < n) { x0 = x, j = -1; while (++j < n) { var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k; subgroups[di + "-" + dj] = { index: di, subindex: dj, startAngle: a0, endAngle: a1, value: v }; } groups[di] = { index: di, startAngle: x0, endAngle: x, value: (x - x0) / k }; x += padding; } i = -1; while (++i < n) { j = i - 1; while (++j < n) { var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i]; if (source.value || target.value) { chords.push(source.value < target.value ? { source: target, target: source } : { source: source, target: target }); } } } if (sortChords) resort(); } function resort() { chords.sort(function(a, b) { return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2); }); } chord.matrix = function(x) { if (!arguments.length) return matrix; n = (matrix = x) && matrix.length; chords = groups = null; return chord; }; chord.padding = function(x) { if (!arguments.length) return padding; padding = x; chords = groups = null; return chord; }; chord.sortGroups = function(x) { if (!arguments.length) return sortGroups; sortGroups = x; chords = groups = null; return chord; }; chord.sortSubgroups = function(x) { if (!arguments.length) return sortSubgroups; sortSubgroups = x; chords = null; return chord; }; chord.sortChords = function(x) { if (!arguments.length) return sortChords; sortChords = x; if (chords) resort(); return chord; }; chord.chords = function() { if (!chords) relayout(); return chords; }; chord.groups = function() { if (!groups) relayout(); return groups; }; return chord; }; d3.layout.force = function() { var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, nodes = [], links = [], distances, strengths, charges; function repulse(node) { return function(quad, x1, _, x2) { if (quad.point !== node) { var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy); if ((x2 - x1) * dn < theta) { var k = quad.charge * dn * dn; node.px -= dx * k; node.py -= dy * k; return true; } if (quad.point && isFinite(dn)) { var k = quad.pointCharge * dn * dn; node.px -= dx * k; node.py -= dy * k; } } return !quad.charge; }; } force.tick = function() { if ((alpha *= .99) < .005) { event.end({ type: "end", alpha: alpha = 0 }); return true; } var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y; for (i = 0; i < m; ++i) { o = links[i]; s = o.source; t = o.target; x = t.x - s.x; y = t.y - s.y; if (l = x * x + y * y) { l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; x *= l; y *= l; t.x -= x * (k = s.weight / (t.weight + s.weight)); t.y -= y * k; s.x += x * (k = 1 - k); s.y += y * k; } } if (k = alpha * gravity) { x = size[0] / 2; y = size[1] / 2; i = -1; if (k) while (++i < n) { o = nodes[i]; o.x += (x - o.x) * k; o.y += (y - o.y) * k; } } if (charge) { d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges); i = -1; while (++i < n) { if (!(o = nodes[i]).fixed) { q.visit(repulse(o)); } } } i = -1; while (++i < n) { o = nodes[i]; if (o.fixed) { o.x = o.px; o.y = o.py; } else { o.x -= (o.px - (o.px = o.x)) * friction; o.y -= (o.py - (o.py = o.y)) * friction; } } event.tick({ type: "tick", alpha: alpha }); }; force.nodes = function(x) { if (!arguments.length) return nodes; nodes = x; return force; }; force.links = function(x) { if (!arguments.length) return links; links = x; return force; }; force.size = function(x) { if (!arguments.length) return size; size = x; return force; }; force.linkDistance = function(x) { if (!arguments.length) return linkDistance; linkDistance = typeof x === "function" ? x : +x; return force; }; force.distance = force.linkDistance; force.linkStrength = function(x) { if (!arguments.length) return linkStrength; linkStrength = typeof x === "function" ? x : +x; return force; }; force.friction = function(x) { if (!arguments.length) return friction; friction = +x; return force; }; force.charge = function(x) { if (!arguments.length) return charge; charge = typeof x === "function" ? x : +x; return force; }; force.gravity = function(x) { if (!arguments.length) return gravity; gravity = +x; return force; }; force.theta = function(x) { if (!arguments.length) return theta; theta = +x; return force; }; force.alpha = function(x) { if (!arguments.length) return alpha; x = +x; if (alpha) { if (x > 0) alpha = x; else alpha = 0; } else if (x > 0) { event.start({ type: "start", alpha: alpha = x }); d3.timer(force.tick); } return force; }; force.start = function() { var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o; for (i = 0; i < n; ++i) { (o = nodes[i]).index = i; o.weight = 0; } for (i = 0; i < m; ++i) { o = links[i]; if (typeof o.source == "number") o.source = nodes[o.source]; if (typeof o.target == "number") o.target = nodes[o.target]; ++o.source.weight; ++o.target.weight; } for (i = 0; i < n; ++i) { o = nodes[i]; if (isNaN(o.x)) o.x = position("x", w); if (isNaN(o.y)) o.y = position("y", h); if (isNaN(o.px)) o.px = o.x; if (isNaN(o.py)) o.py = o.y; } distances = []; if (typeof linkDistance === "function") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i); else for (i = 0; i < m; ++i) distances[i] = linkDistance; strengths = []; if (typeof linkStrength === "function") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i); else for (i = 0; i < m; ++i) strengths[i] = linkStrength; charges = []; if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge; function position(dimension, size) { var neighbors = neighbor(i), j = -1, m = neighbors.length, x; while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x; return Math.random() * size; } function neighbor() { if (!neighbors) { neighbors = []; for (j = 0; j < n; ++j) { neighbors[j] = []; } for (j = 0; j < m; ++j) { var o = links[j]; neighbors[o.source.index].push(o.target); neighbors[o.target.index].push(o.source); } } return neighbors[i]; } return force.resume(); }; force.resume = function() { return force.alpha(.1); }; force.stop = function() { return force.alpha(0); }; force.drag = function() { if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend); if (!arguments.length) return drag; this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag); }; function dragmove(d) { d.px = d3.event.x, d.py = d3.event.y; force.resume(); } return d3.rebind(force, event, "on"); }; function d3_layout_forceDragstart(d) { d.fixed |= 2; } function d3_layout_forceDragend(d) { d.fixed &= ~6; } function d3_layout_forceMouseover(d) { d.fixed |= 4; d.px = d.x, d.py = d.y; } function d3_layout_forceMouseout(d) { d.fixed &= ~4; } function d3_layout_forceAccumulate(quad, alpha, charges) { var cx = 0, cy = 0; quad.charge = 0; if (!quad.leaf) { var nodes = quad.nodes, n = nodes.length, i = -1, c; while (++i < n) { c = nodes[i]; if (c == null) continue; d3_layout_forceAccumulate(c, alpha, charges); quad.charge += c.charge; cx += c.charge * c.cx; cy += c.charge * c.cy; } } if (quad.point) { if (!quad.leaf) { quad.point.x += Math.random() - .5; quad.point.y += Math.random() - .5; } var k = alpha * charges[quad.point.index]; quad.charge += quad.pointCharge = k; cx += k * quad.point.x; cy += k * quad.point.y; } quad.cx = cx / quad.charge; quad.cy = cy / quad.charge; } var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1; d3.layout.partition = function() { var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ]; function position(node, x, dx, dy) { var children = node.children; node.x = x; node.y = node.depth * dy; node.dx = dx; node.dy = dy; if (children && (n = children.length)) { var i = -1, n, c, d; dx = node.value ? dx / node.value : 0; while (++i < n) { position(c = children[i], x, d = c.value * dx, dy); x += d; } } } function depth(node) { var children = node.children, d = 0; if (children && (n = children.length)) { var i = -1, n; while (++i < n) d = Math.max(d, depth(children[i])); } return 1 + d; } function partition(d, i) { var nodes = hierarchy.call(this, d, i); position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); return nodes; } partition.size = function(x) { if (!arguments.length) return size; size = x; return partition; }; return d3_layout_hierarchyRebind(partition, hierarchy); }; d3.layout.pie = function() { var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * π; function pie(data) { var values = data.map(function(d, i) { return +value.call(pie, d, i); }); var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle); var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - startAngle) / d3.sum(values); var index = d3.range(data.length); if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) { return values[j] - values[i]; } : function(i, j) { return sort(data[i], data[j]); }); var arcs = []; index.forEach(function(i) { var d; arcs[i] = { data: data[i], value: d = values[i], startAngle: a, endAngle: a += d * k }; }); return arcs; } pie.value = function(x) { if (!arguments.length) return value; value = x; return pie; }; pie.sort = function(x) { if (!arguments.length) return sort; sort = x; return pie; }; pie.startAngle = function(x) { if (!arguments.length) return startAngle; startAngle = x; return pie; }; pie.endAngle = function(x) { if (!arguments.length) return endAngle; endAngle = x; return pie; }; return pie; }; var d3_layout_pieSortByValue = {}; d3.layout.stack = function() { var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY; function stack(data, index) { var series = data.map(function(d, i) { return values.call(stack, d, i); }); var points = series.map(function(d) { return d.map(function(v, i) { return [ x.call(stack, v, i), y.call(stack, v, i) ]; }); }); var orders = order.call(stack, points, index); series = d3.permute(series, orders); points = d3.permute(points, orders); var offsets = offset.call(stack, points, index); var n = series.length, m = series[0].length, i, j, o; for (j = 0; j < m; ++j) { out.call(stack, series[0][j], o = offsets[j], points[0][j][1]); for (i = 1; i < n; ++i) { out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]); } } return data; } stack.values = function(x) { if (!arguments.length) return values; values = x; return stack; }; stack.order = function(x) { if (!arguments.length) return order; order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault; return stack; }; stack.offset = function(x) { if (!arguments.length) return offset; offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero; return stack; }; stack.x = function(z) { if (!arguments.length) return x; x = z; return stack; }; stack.y = function(z) { if (!arguments.length) return y; y = z; return stack; }; stack.out = function(z) { if (!arguments.length) return out; out = z; return stack; }; return stack; }; function d3_layout_stackX(d) { return d.x; } function d3_layout_stackY(d) { return d.y; } function d3_layout_stackOut(d, y0, y) { d.y0 = y0; d.y = y; } var d3_layout_stackOrders = d3.map({ "inside-out": function(data) { var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }), top = 0, bottom = 0, tops = [], bottoms = []; for (i = 0; i < n; ++i) { j = index[i]; if (top < bottom) { top += sums[j]; tops.push(j); } else { bottom += sums[j]; bottoms.push(j); } } return bottoms.reverse().concat(tops); }, reverse: function(data) { return d3.range(data.length).reverse(); }, "default": d3_layout_stackOrderDefault }); var d3_layout_stackOffsets = d3.map({ silhouette: function(data) { var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = []; for (j = 0; j < m; ++j) { for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; if (o > max) max = o; sums.push(o); } for (j = 0; j < m; ++j) { y0[j] = (max - sums[j]) / 2; } return y0; }, wiggle: function(data) { var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = []; y0[0] = o = o0 = 0; for (j = 1; j < m; ++j) { for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; } s2 += s3 * data[i][j][1]; } y0[j] = o -= s1 ? s2 / s1 * dx : 0; if (o < o0) o0 = o; } for (j = 0; j < m; ++j) y0[j] -= o0; return y0; }, expand: function(data) { var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = []; for (j = 0; j < m; ++j) { for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k; } for (j = 0; j < m; ++j) y0[j] = 0; return y0; }, zero: d3_layout_stackOffsetZero }); function d3_layout_stackOrderDefault(data) { return d3.range(data.length); } function d3_layout_stackOffsetZero(data) { var j = -1, m = data[0].length, y0 = []; while (++j < m) y0[j] = 0; return y0; } function d3_layout_stackMaxIndex(array) { var i = 1, j = 0, v = array[0][1], k, n = array.length; for (;i < n; ++i) { if ((k = array[i][1]) > v) { j = i; v = k; } } return j; } function d3_layout_stackReduceSum(d) { return d.reduce(d3_layout_stackSum, 0); } function d3_layout_stackSum(p, d) { return p + d[1]; } d3.layout.histogram = function() { var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges; function histogram(data, i) { var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x; while (++i < m) { bin = bins[i] = []; bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); bin.y = 0; } if (m > 0) { i = -1; while (++i < n) { x = values[i]; if (x >= range[0] && x <= range[1]) { bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; bin.y += k; bin.push(data[i]); } } } return bins; } histogram.value = function(x) { if (!arguments.length) return valuer; valuer = x; return histogram; }; histogram.range = function(x) { if (!arguments.length) return ranger; ranger = d3_functor(x); return histogram; }; histogram.bins = function(x) { if (!arguments.length) return binner; binner = typeof x === "number" ? function(range) { return d3_layout_histogramBinFixed(range, x); } : d3_functor(x); return histogram; }; histogram.frequency = function(x) { if (!arguments.length) return frequency; frequency = !!x; return histogram; }; return histogram; }; function d3_layout_histogramBinSturges(range, values) { return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); } function d3_layout_histogramBinFixed(range, n) { var x = -1, b = +range[0], m = (range[1] - b) / n, f = []; while (++x <= n) f[x] = m * x + b; return f; } function d3_layout_histogramRange(values) { return [ d3.min(values), d3.max(values) ]; } d3.layout.hierarchy = function() { var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue; function recurse(node, depth, nodes) { var childs = children.call(hierarchy, node, depth); node.depth = depth; nodes.push(node); if (childs && (n = childs.length)) { var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d; while (++i < n) { d = recurse(childs[i], j, nodes); d.parent = node; c.push(d); v += d.value; } if (sort) c.sort(sort); if (value) node.value = v; } else if (value) { node.value = +value.call(hierarchy, node, depth) || 0; } return node; } function revalue(node, depth) { var children = node.children, v = 0; if (children && (n = children.length)) { var i = -1, n, j = depth + 1; while (++i < n) v += revalue(children[i], j); } else if (value) { v = +value.call(hierarchy, node, depth) || 0; } if (value) node.value = v; return v; } function hierarchy(d) { var nodes = []; recurse(d, 0, nodes); return nodes; } hierarchy.sort = function(x) { if (!arguments.length) return sort; sort = x; return hierarchy; }; hierarchy.children = function(x) { if (!arguments.length) return children; children = x; return hierarchy; }; hierarchy.value = function(x) { if (!arguments.length) return value; value = x; return hierarchy; }; hierarchy.revalue = function(root) { revalue(root, 0); return root; }; return hierarchy; }; function d3_layout_hierarchyRebind(object, hierarchy) { d3.rebind(object, hierarchy, "sort", "children", "value"); object.nodes = object; object.links = d3_layout_hierarchyLinks; return object; } function d3_layout_hierarchyChildren(d) { return d.children; } function d3_layout_hierarchyValue(d) { return d.value; } function d3_layout_hierarchySort(a, b) { return b.value - a.value; } function d3_layout_hierarchyLinks(nodes) { return d3.merge(nodes.map(function(parent) { return (parent.children || []).map(function(child) { return { source: parent, target: child }; }); })); } d3.layout.pack = function() { var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ]; function pack(d, i) { var nodes = hierarchy.call(this, d, i), root = nodes[0]; root.x = 0; root.y = 0; d3_layout_treeVisitAfter(root, function(d) { d.r = Math.sqrt(d.value); }); d3_layout_treeVisitAfter(root, d3_layout_packSiblings); var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h); if (padding > 0) { var dr = padding * k / 2; d3_layout_treeVisitAfter(root, function(d) { d.r += dr; }); d3_layout_treeVisitAfter(root, d3_layout_packSiblings); d3_layout_treeVisitAfter(root, function(d) { d.r -= dr; }); k = Math.max(2 * root.r / w, 2 * root.r / h); } d3_layout_packTransform(root, w / 2, h / 2, 1 / k); return nodes; } pack.size = function(x) { if (!arguments.length) return size; size = x; return pack; }; pack.padding = function(_) { if (!arguments.length) return padding; padding = +_; return pack; }; return d3_layout_hierarchyRebind(pack, hierarchy); }; function d3_layout_packSort(a, b) { return a.value - b.value; } function d3_layout_packInsert(a, b) { var c = a._pack_next; a._pack_next = b; b._pack_prev = a; b._pack_next = c; c._pack_prev = b; } function d3_layout_packSplice(a, b) { a._pack_next = b; b._pack_prev = a; } function d3_layout_packIntersects(a, b) { var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r; return dr * dr - dx * dx - dy * dy > .001; } function d3_layout_packSiblings(node) { if (!(nodes = node.children) || !(n = nodes.length)) return; var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n; function bound(node) { xMin = Math.min(node.x - node.r, xMin); xMax = Math.max(node.x + node.r, xMax); yMin = Math.min(node.y - node.r, yMin); yMax = Math.max(node.y + node.r, yMax); } nodes.forEach(d3_layout_packLink); a = nodes[0]; a.x = -a.r; a.y = 0; bound(a); if (n > 1) { b = nodes[1]; b.x = b.r; b.y = 0; bound(b); if (n > 2) { c = nodes[2]; d3_layout_packPlace(a, b, c); bound(c); d3_layout_packInsert(a, c); a._pack_prev = c; d3_layout_packInsert(c, b); b = a._pack_next; for (i = 3; i < n; i++) { d3_layout_packPlace(a, b, c = nodes[i]); var isect = 0, s1 = 1, s2 = 1; for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { if (d3_layout_packIntersects(j, c)) { isect = 1; break; } } if (isect == 1) { for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { if (d3_layout_packIntersects(k, c)) { break; } } } if (isect) { if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b); i--; } else { d3_layout_packInsert(a, c); b = c; bound(c); } } } } var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0; for (i = 0; i < n; i++) { c = nodes[i]; c.x -= cx; c.y -= cy; cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y)); } node.r = cr; nodes.forEach(d3_layout_packUnlink); } function d3_layout_packLink(node) { node._pack_next = node._pack_prev = node; } function d3_layout_packUnlink(node) { delete node._pack_next; delete node._pack_prev; } function d3_layout_packTransform(node, x, y, k) { var children = node.children; node.x = x += k * node.x; node.y = y += k * node.y; node.r *= k; if (children) { var i = -1, n = children.length; while (++i < n) d3_layout_packTransform(children[i], x, y, k); } } function d3_layout_packPlace(a, b, c) { var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y; if (db && (dx || dy)) { var da = b.r + c.r, dc = dx * dx + dy * dy; da *= da; db *= db; var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc); c.x = a.x + x * dx + y * dy; c.y = a.y + x * dy - y * dx; } else { c.x = a.x + db; c.y = a.y; } } d3.layout.cluster = function() { var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ]; function cluster(d, i) { var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0; d3_layout_treeVisitAfter(root, function(node) { var children = node.children; if (children && children.length) { node.x = d3_layout_clusterX(children); node.y = d3_layout_clusterY(children); } else { node.x = previousNode ? x += separation(node, previousNode) : 0; node.y = 0; previousNode = node; } }); var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; d3_layout_treeVisitAfter(root, function(node) { node.x = (node.x - x0) / (x1 - x0) * size[0]; node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; }); return nodes; } cluster.separation = function(x) { if (!arguments.length) return separation; separation = x; return cluster; }; cluster.size = function(x) { if (!arguments.length) return size; size = x; return cluster; }; return d3_layout_hierarchyRebind(cluster, hierarchy); }; function d3_layout_clusterY(children) { return 1 + d3.max(children, function(child) { return child.y; }); } function d3_layout_clusterX(children) { return children.reduce(function(x, child) { return x + child.x; }, 0) / children.length; } function d3_layout_clusterLeft(node) { var children = node.children; return children && children.length ? d3_layout_clusterLeft(children[0]) : node; } function d3_layout_clusterRight(node) { var children = node.children, n; return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; } d3.layout.tree = function() { var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ]; function tree(d, i) { var nodes = hierarchy.call(this, d, i), root = nodes[0]; function firstWalk(node, previousSibling) { var children = node.children, layout = node._tree; if (children && (n = children.length)) { var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1; while (++i < n) { child = children[i]; firstWalk(child, previousChild); ancestor = apportion(child, previousChild, ancestor); previousChild = child; } d3_layout_treeShift(node); var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim); if (previousSibling) { layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); layout.mod = layout.prelim - midpoint; } else { layout.prelim = midpoint; } } else { if (previousSibling) { layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); } } } function secondWalk(node, x) { node.x = node._tree.prelim + x; var children = node.children; if (children && (n = children.length)) { var i = -1, n; x += node._tree.mod; while (++i < n) { secondWalk(children[i], x); } } } function apportion(node, previousSibling, ancestor) { if (previousSibling) { var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift; while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) { vom = d3_layout_treeLeft(vom); vop = d3_layout_treeRight(vop); vop._tree.ancestor = node; shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip); if (shift > 0) { d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift); sip += shift; sop += shift; } sim += vim._tree.mod; sip += vip._tree.mod; som += vom._tree.mod; sop += vop._tree.mod; } if (vim && !d3_layout_treeRight(vop)) { vop._tree.thread = vim; vop._tree.mod += sim - sop; } if (vip && !d3_layout_treeLeft(vom)) { vom._tree.thread = vip; vom._tree.mod += sip - som; ancestor = node; } } return ancestor; } d3_layout_treeVisitAfter(root, function(node, previousSibling) { node._tree = { ancestor: node, prelim: 0, mod: 0, change: 0, shift: 0, number: previousSibling ? previousSibling._tree.number + 1 : 0 }; }); firstWalk(root); secondWalk(root, -root._tree.prelim); var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1; d3_layout_treeVisitAfter(root, function(node) { node.x = (node.x - x0) / (x1 - x0) * size[0]; node.y = node.depth / y1 * size[1]; delete node._tree; }); return nodes; } tree.separation = function(x) { if (!arguments.length) return separation; separation = x; return tree; }; tree.size = function(x) { if (!arguments.length) return size; size = x; return tree; }; return d3_layout_hierarchyRebind(tree, hierarchy); }; function d3_layout_treeSeparation(a, b) { return a.parent == b.parent ? 1 : 2; } function d3_layout_treeLeft(node) { var children = node.children; return children && children.length ? children[0] : node._tree.thread; } function d3_layout_treeRight(node) { var children = node.children, n; return children && (n = children.length) ? children[n - 1] : node._tree.thread; } function d3_layout_treeSearch(node, compare) { var children = node.children; if (children && (n = children.length)) { var child, n, i = -1; while (++i < n) { if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) { node = child; } } } return node; } function d3_layout_treeRightmost(a, b) { return a.x - b.x; } function d3_layout_treeLeftmost(a, b) { return b.x - a.x; } function d3_layout_treeDeepest(a, b) { return a.depth - b.depth; } function d3_layout_treeVisitAfter(node, callback) { function visit(node, previousSibling) { var children = node.children; if (children && (n = children.length)) { var child, previousChild = null, i = -1, n; while (++i < n) { child = children[i]; visit(child, previousChild); previousChild = child; } } callback(node, previousSibling); } visit(node, null); } function d3_layout_treeShift(node) { var shift = 0, change = 0, children = node.children, i = children.length, child; while (--i >= 0) { child = children[i]._tree; child.prelim += shift; child.mod += shift; shift += child.shift + (change += child.change); } } function d3_layout_treeMove(ancestor, node, shift) { ancestor = ancestor._tree; node = node._tree; var change = shift / (node.number - ancestor.number); ancestor.change += change; node.change -= change; node.shift += shift; node.prelim += shift; node.mod += shift; } function d3_layout_treeAncestor(vim, node, ancestor) { return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor; } d3.layout.treemap = function() { var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5)); function scale(children, k) { var i = -1, n = children.length, child, area; while (++i < n) { area = (child = children[i]).value * (k < 0 ? 0 : k); child.area = isNaN(area) || area <= 0 ? 0 : area; } } function squarify(node) { var children = node.children; if (children && children.length) { var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n; scale(remaining, rect.dx * rect.dy / node.value); row.area = 0; while ((n = remaining.length) > 0) { row.push(child = remaining[n - 1]); row.area += child.area; if (mode !== "squarify" || (score = worst(row, u)) <= best) { remaining.pop(); best = score; } else { row.area -= row.pop().area; position(row, u, rect, false); u = Math.min(rect.dx, rect.dy); row.length = row.area = 0; best = Infinity; } } if (row.length) { position(row, u, rect, true); row.length = row.area = 0; } children.forEach(squarify); } } function stickify(node) { var children = node.children; if (children && children.length) { var rect = pad(node), remaining = children.slice(), child, row = []; scale(remaining, rect.dx * rect.dy / node.value); row.area = 0; while (child = remaining.pop()) { row.push(child); row.area += child.area; if (child.z != null) { position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); row.length = row.area = 0; } } children.forEach(stickify); } } function worst(row, u) { var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length; while (++i < n) { if (!(r = row[i].area)) continue; if (r < rmin) rmin = r; if (r > rmax) rmax = r; } s *= s; u *= u; return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity; } function position(row, u, rect, flush) { var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o; if (u == rect.dx) { if (flush || v > rect.dy) v = rect.dy; while (++i < n) { o = row[i]; o.x = x; o.y = y; o.dy = v; x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0); } o.z = true; o.dx += rect.x + rect.dx - x; rect.y += v; rect.dy -= v; } else { if (flush || v > rect.dx) v = rect.dx; while (++i < n) { o = row[i]; o.x = x; o.y = y; o.dx = v; y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0); } o.z = false; o.dy += rect.y + rect.dy - y; rect.x += v; rect.dx -= v; } } function treemap(d) { var nodes = stickies || hierarchy(d), root = nodes[0]; root.x = 0; root.y = 0; root.dx = size[0]; root.dy = size[1]; if (stickies) hierarchy.revalue(root); scale([ root ], root.dx * root.dy / root.value); (stickies ? stickify : squarify)(root); if (sticky) stickies = nodes; return nodes; } treemap.size = function(x) { if (!arguments.length) return size; size = x; return treemap; }; treemap.padding = function(x) { if (!arguments.length) return padding; function padFunction(node) { var p = x.call(treemap, node, node.depth); return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p); } function padConstant(node) { return d3_layout_treemapPad(node, x); } var type; pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], padConstant) : padConstant; return treemap; }; treemap.round = function(x) { if (!arguments.length) return round != Number; round = x ? Math.round : Number; return treemap; }; treemap.sticky = function(x) { if (!arguments.length) return sticky; sticky = x; stickies = null; return treemap; }; treemap.ratio = function(x) { if (!arguments.length) return ratio; ratio = x; return treemap; }; treemap.mode = function(x) { if (!arguments.length) return mode; mode = x + ""; return treemap; }; return d3_layout_hierarchyRebind(treemap, hierarchy); }; function d3_layout_treemapPadNull(node) { return { x: node.x, y: node.y, dx: node.dx, dy: node.dy }; } function d3_layout_treemapPad(node, padding) { var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2]; if (dx < 0) { x += dx / 2; dx = 0; } if (dy < 0) { y += dy / 2; dy = 0; } return { x: x, y: y, dx: dx, dy: dy }; } function d3_dsv(delimiter, mimeType) { var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0); function dsv(url, callback) { return d3.xhr(url, mimeType, callback).response(response); } function response(request) { return dsv.parse(request.responseText); } dsv.parse = function(text) { var o; return dsv.parseRows(text, function(row) { if (o) return o(row); o = new Function("d", "return {" + row.map(function(name, i) { return JSON.stringify(name) + ": d[" + i + "]"; }).join(",") + "}"); }); }; dsv.parseRows = function(text, f) { var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol; function token() { if (I >= N) return EOF; if (eol) return eol = false, EOL; var j = I; if (text.charCodeAt(j) === 34) { var i = j; while (i++ < N) { if (text.charCodeAt(i) === 34) { if (text.charCodeAt(i + 1) !== 34) break; ++i; } } I = i + 2; var c = text.charCodeAt(i + 1); if (c === 13) { eol = true; if (text.charCodeAt(i + 2) === 10) ++I; } else if (c === 10) { eol = true; } return text.substring(j + 1, i).replace(/""/g, '"'); } while (I < N) { var c = text.charCodeAt(I++), k = 1; if (c === 10) eol = true; else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } else if (c !== delimiterCode) continue; return text.substring(j, I - k); } return text.substring(j); } while ((t = token()) !== EOF) { var a = []; while (t !== EOL && t !== EOF) { a.push(t); t = token(); } if (f && !(a = f(a, n++))) continue; rows.push(a); } return rows; }; dsv.format = function(rows) { return rows.map(formatRow).join("\n"); }; function formatRow(row) { return row.map(formatValue).join(delimiter); } function formatValue(text) { return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text; } return dsv; } d3.csv = d3_dsv(",", "text/csv"); d3.tsv = d3_dsv(" ", "text/tab-separated-values"); d3.geo = {}; d3.geo.stream = function(object, listener) { if (d3_geo_streamObjectType.hasOwnProperty(object.type)) { d3_geo_streamObjectType[object.type](object, listener); } else { d3_geo_streamGeometry(object, listener); } }; function d3_geo_streamGeometry(geometry, listener) { if (d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) { d3_geo_streamGeometryType[geometry.type](geometry, listener); } } var d3_geo_streamObjectType = { Feature: function(feature, listener) { d3_geo_streamGeometry(feature.geometry, listener); }, FeatureCollection: function(object, listener) { var features = object.features, i = -1, n = features.length; while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener); } }; var d3_geo_streamGeometryType = { Sphere: function(object, listener) { listener.sphere(); }, Point: function(object, listener) { var coordinate = object.coordinates; listener.point(coordinate[0], coordinate[1]); }, MultiPoint: function(object, listener) { var coordinates = object.coordinates, i = -1, n = coordinates.length, coordinate; while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1]); }, LineString: function(object, listener) { d3_geo_streamLine(object.coordinates, listener, 0); }, MultiLineString: function(object, listener) { var coordinates = object.coordinates, i = -1, n = coordinates.length; while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0); }, Polygon: function(object, listener) { d3_geo_streamPolygon(object.coordinates, listener); }, MultiPolygon: function(object, listener) { var coordinates = object.coordinates, i = -1, n = coordinates.length; while (++i < n) d3_geo_streamPolygon(coordinates[i], listener); }, GeometryCollection: function(object, listener) { var geometries = object.geometries, i = -1, n = geometries.length; while (++i < n) d3_geo_streamGeometry(geometries[i], listener); } }; function d3_geo_streamLine(coordinates, listener, closed) { var i = -1, n = coordinates.length - closed, coordinate; listener.lineStart(); while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1]); listener.lineEnd(); } function d3_geo_streamPolygon(coordinates, listener) { var i = -1, n = coordinates.length; listener.polygonStart(); while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1); listener.polygonEnd(); } function d3_geo_spherical(cartesian) { return [ Math.atan2(cartesian[1], cartesian[0]), Math.asin(Math.max(-1, Math.min(1, cartesian[2]))) ]; } function d3_geo_sphericalEqual(a, b) { return Math.abs(a[0] - b[0]) < ε && Math.abs(a[1] - b[1]) < ε; } function d3_geo_cartesian(spherical) { var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ); return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ]; } function d3_geo_cartesianDot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } function d3_geo_cartesianCross(a, b) { return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ]; } function d3_geo_cartesianAdd(a, b) { a[0] += b[0]; a[1] += b[1]; a[2] += b[2]; } function d3_geo_cartesianScale(vector, k) { return [ vector[0] * k, vector[1] * k, vector[2] * k ]; } function d3_geo_cartesianNormalize(d) { var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); d[0] /= l; d[1] /= l; d[2] /= l; } function d3_geo_resample(project) { var δ2 = .5, maxDepth = 16; function resample(stream) { var λ0, x0, y0, a0, b0, c0; var resample = { point: point, lineStart: lineStart, lineEnd: lineEnd, polygonStart: function() { stream.polygonStart(); resample.lineStart = polygonLineStart; }, polygonEnd: function() { stream.polygonEnd(); resample.lineStart = lineStart; } }; function point(x, y) { x = project(x, y); stream.point(x[0], x[1]); } function lineStart() { x0 = NaN; resample.point = linePoint; stream.lineStart(); } function linePoint(λ, φ) { var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ); resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); stream.point(x0, y0); } function lineEnd() { resample.point = point; stream.lineEnd(); } function polygonLineStart() { var λ00, φ00, x00, y00, a00, b00, c00; lineStart(); resample.point = function(λ, φ) { linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; resample.point = linePoint; }; resample.lineEnd = function() { resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream); resample.lineEnd = lineEnd; lineEnd(); }; } return resample; } function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) { var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; if (d2 > 4 * δ2 && depth--) { var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = Math.abs(Math.abs(c) - 1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2; if (dz * dz / d2 > δ2 || Math.abs((dx * dx2 + dy * dy2) / d2 - .5) > .3) { resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream); stream.point(x2, y2); resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream); } } } resample.precision = function(_) { if (!arguments.length) return Math.sqrt(δ2); maxDepth = (δ2 = _ * _) > 0 && 16; return resample; }; return resample; } d3.geo.albersUsa = function() { var lower48 = d3.geo.albers(); var alaska = d3.geo.albers().rotate([ 160, 0 ]).center([ 0, 60 ]).parallels([ 55, 65 ]); var hawaii = d3.geo.albers().rotate([ 160, 0 ]).center([ 0, 20 ]).parallels([ 8, 18 ]); var puertoRico = d3.geo.albers().rotate([ 60, 0 ]).center([ 0, 10 ]).parallels([ 8, 18 ]); function albersUsa(coordinates) { return projection(coordinates)(coordinates); } function projection(point) { var lon = point[0], lat = point[1]; return lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48; } albersUsa.scale = function(x) { if (!arguments.length) return lower48.scale(); lower48.scale(x); alaska.scale(x * .6); hawaii.scale(x); puertoRico.scale(x * 1.5); return albersUsa.translate(lower48.translate()); }; albersUsa.translate = function(x) { if (!arguments.length) return lower48.translate(); var dz = lower48.scale(), dx = x[0], dy = x[1]; lower48.translate(x); alaska.translate([ dx - .4 * dz, dy + .17 * dz ]); hawaii.translate([ dx - .19 * dz, dy + .2 * dz ]); puertoRico.translate([ dx + .58 * dz, dy + .43 * dz ]); return albersUsa; }; return albersUsa.scale(lower48.scale()); }; function d3_geo_albers(φ0, φ1) { var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), ρ0 = Math.sqrt(C) / n; function albers(λ, φ) { var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n; return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ]; } albers.invert = function(x, y) { var ρ0_y = ρ0 - y; return [ Math.atan2(x, ρ0_y) / n, Math.asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ]; }; return albers; } (d3.geo.albers = function() { var φ0 = 29.5 * d3_radians, φ1 = 45.5 * d3_radians, m = d3_geo_projectionMutator(d3_geo_albers), p = m(φ0, φ1); p.parallels = function(_) { if (!arguments.length) return [ φ0 * d3_degrees, φ1 * d3_degrees ]; return m(φ0 = _[0] * d3_radians, φ1 = _[1] * d3_radians); }; return p.rotate([ 98, 0 ]).center([ 0, 38 ]).scale(1e3); }).raw = d3_geo_albers; var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) { return Math.sqrt(2 / (1 + cosλcosφ)); }, function(ρ) { return 2 * Math.asin(ρ / 2); }); (d3.geo.azimuthalEqualArea = function() { return d3_geo_projection(d3_geo_azimuthalEqualArea); }).raw = d3_geo_azimuthalEqualArea; var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) { var c = Math.acos(cosλcosφ); return c && c / Math.sin(c); }, d3_identity); (d3.geo.azimuthalEquidistant = function() { return d3_geo_projection(d3_geo_azimuthalEquidistant); }).raw = d3_geo_azimuthalEquidistant; d3.geo.bounds = d3_geo_bounds(d3_identity); function d3_geo_bounds(projectStream) { var x0, y0, x1, y1; var bound = { point: boundPoint, lineStart: d3_noop, lineEnd: d3_noop, polygonStart: function() { bound.lineEnd = boundPolygonLineEnd; }, polygonEnd: function() { bound.point = boundPoint; } }; function boundPoint(x, y) { if (x < x0) x0 = x; if (x > x1) x1 = x; if (y < y0) y0 = y; if (y > y1) y1 = y; } function boundPolygonLineEnd() { bound.point = bound.lineEnd = d3_noop; } return function(feature) { y1 = x1 = -(x0 = y0 = Infinity); d3.geo.stream(feature, projectStream(bound)); return [ [ x0, y0 ], [ x1, y1 ] ]; }; } d3.geo.centroid = function(object) { d3_geo_centroidDimension = d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; d3.geo.stream(object, d3_geo_centroid); var m; if (d3_geo_centroidW && Math.abs(m = Math.sqrt(d3_geo_centroidX * d3_geo_centroidX + d3_geo_centroidY * d3_geo_centroidY + d3_geo_centroidZ * d3_geo_centroidZ)) > ε) { return [ Math.atan2(d3_geo_centroidY, d3_geo_centroidX) * d3_degrees, Math.asin(Math.max(-1, Math.min(1, d3_geo_centroidZ / m))) * d3_degrees ]; } }; var d3_geo_centroidDimension, d3_geo_centroidW, d3_geo_centroidX, d3_geo_centroidY, d3_geo_centroidZ; var d3_geo_centroid = { sphere: function() { if (d3_geo_centroidDimension < 2) { d3_geo_centroidDimension = 2; d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; } }, point: d3_geo_centroidPoint, lineStart: d3_geo_centroidLineStart, lineEnd: d3_geo_centroidLineEnd, polygonStart: function() { if (d3_geo_centroidDimension < 2) { d3_geo_centroidDimension = 2; d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; } d3_geo_centroid.lineStart = d3_geo_centroidRingStart; }, polygonEnd: function() { d3_geo_centroid.lineStart = d3_geo_centroidLineStart; } }; function d3_geo_centroidPoint(λ, φ) { if (d3_geo_centroidDimension) return; ++d3_geo_centroidW; λ *= d3_radians; var cosφ = Math.cos(φ *= d3_radians); d3_geo_centroidX += (cosφ * Math.cos(λ) - d3_geo_centroidX) / d3_geo_centroidW; d3_geo_centroidY += (cosφ * Math.sin(λ) - d3_geo_centroidY) / d3_geo_centroidW; d3_geo_centroidZ += (Math.sin(φ) - d3_geo_centroidZ) / d3_geo_centroidW; } function d3_geo_centroidRingStart() { var λ00, φ00; d3_geo_centroidDimension = 1; d3_geo_centroidLineStart(); d3_geo_centroidDimension = 2; var linePoint = d3_geo_centroid.point; d3_geo_centroid.point = function(λ, φ) { linePoint(λ00 = λ, φ00 = φ); }; d3_geo_centroid.lineEnd = function() { d3_geo_centroid.point(λ00, φ00); d3_geo_centroidLineEnd(); d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd; }; } function d3_geo_centroidLineStart() { var x0, y0, z0; if (d3_geo_centroidDimension > 1) return; if (d3_geo_centroidDimension < 1) { d3_geo_centroidDimension = 1; d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; } d3_geo_centroid.point = function(λ, φ) { λ *= d3_radians; var cosφ = Math.cos(φ *= d3_radians); x0 = cosφ * Math.cos(λ); y0 = cosφ * Math.sin(λ); z0 = Math.sin(φ); d3_geo_centroid.point = nextPoint; }; function nextPoint(λ, φ) { λ *= d3_radians; var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); d3_geo_centroidW += w; d3_geo_centroidX += w * (x0 + (x0 = x)); d3_geo_centroidY += w * (y0 + (y0 = y)); d3_geo_centroidZ += w * (z0 + (z0 = z)); } } function d3_geo_centroidLineEnd() { d3_geo_centroid.point = d3_geo_centroidPoint; } d3.geo.circle = function() { var origin = [ 0, 0 ], angle, precision = 6, interpolate; function circle() { var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = []; interpolate(null, null, 1, { point: function(x, y) { ring.push(x = rotate(x, y)); x[0] *= d3_degrees, x[1] *= d3_degrees; } }); return { type: "Polygon", coordinates: [ ring ] }; } circle.origin = function(x) { if (!arguments.length) return origin; origin = x; return circle; }; circle.angle = function(x) { if (!arguments.length) return angle; interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians); return circle; }; circle.precision = function(_) { if (!arguments.length) return precision; interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians); return circle; }; return circle.angle(90); }; function d3_geo_circleInterpolate(radians, precision) { var cr = Math.cos(radians), sr = Math.sin(radians); return function(from, to, direction, listener) { if (from != null) { from = d3_geo_circleAngle(cr, from); to = d3_geo_circleAngle(cr, to); if (direction > 0 ? from < to : from > to) from += direction * 2 * π; } else { from = radians + direction * 2 * π; to = radians; } var point; for (var step = direction * precision, t = from; direction > 0 ? t > to : t < to; t -= step) { listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]); } }; } function d3_geo_circleAngle(cr, point) { var a = d3_geo_cartesian(point); a[0] -= cr; d3_geo_cartesianNormalize(a); var angle = Math.acos(Math.max(-1, Math.min(1, -a[1]))); return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI); } function d3_geo_clip(pointVisible, clipLine, interpolate) { return function(listener) { var line = clipLine(listener); var clip = { point: point, lineStart: lineStart, lineEnd: lineEnd, polygonStart: function() { clip.point = pointRing; clip.lineStart = ringStart; clip.lineEnd = ringEnd; invisible = false; invisibleArea = visibleArea = 0; segments = []; listener.polygonStart(); }, polygonEnd: function() { clip.point = point; clip.lineStart = lineStart; clip.lineEnd = lineEnd; segments = d3.merge(segments); if (segments.length) { d3_geo_clipPolygon(segments, interpolate, listener); } else if (visibleArea < -ε || invisible && invisibleArea < -ε) { listener.lineStart(); interpolate(null, null, 1, listener); listener.lineEnd(); } listener.polygonEnd(); segments = null; }, sphere: function() { listener.polygonStart(); listener.lineStart(); interpolate(null, null, 1, listener); listener.lineEnd(); listener.polygonEnd(); } }; function point(λ, φ) { if (pointVisible(λ, φ)) listener.point(λ, φ); } function pointLine(λ, φ) { line.point(λ, φ); } function lineStart() { clip.point = pointLine; line.lineStart(); } function lineEnd() { clip.point = point; line.lineEnd(); } var segments, visibleArea, invisibleArea, invisible; var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), ring; function pointRing(λ, φ) { ringListener.point(λ, φ); ring.push([ λ, φ ]); } function ringStart() { ringListener.lineStart(); ring = []; } function ringEnd() { pointRing(ring[0][0], ring[0][1]); ringListener.lineEnd(); var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length; if (!n) { invisible = true; invisibleArea += d3_geo_clipAreaRing(ring, -1); ring = null; return; } ring = null; if (clean & 1) { segment = ringSegments[0]; visibleArea += d3_geo_clipAreaRing(segment, 1); var n = segment.length - 1, i = -1, point; listener.lineStart(); while (++i < n) listener.point((point = segment[i])[0], point[1]); listener.lineEnd(); return; } if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); segments.push(ringSegments.filter(d3_geo_clipSegmentLength1)); } return clip; }; } function d3_geo_clipPolygon(segments, interpolate, listener) { var subject = [], clip = []; segments.forEach(function(segment) { var n = segment.length; if (n <= 1) return; var p0 = segment[0], p1 = segment[n - 1], a = { point: p0, points: segment, other: null, visited: false, entry: true, subject: true }, b = { point: p0, points: [ p0 ], other: a, visited: false, entry: false, subject: false }; a.other = b; subject.push(a); clip.push(b); a = { point: p1, points: [ p1 ], other: null, visited: false, entry: false, subject: true }; b = { point: p1, points: [ p1 ], other: a, visited: false, entry: true, subject: false }; a.other = b; subject.push(a); clip.push(b); }); clip.sort(d3_geo_clipSort); d3_geo_clipLinkCircular(subject); d3_geo_clipLinkCircular(clip); if (!subject.length) return; var start = subject[0], current, points, point; while (1) { current = start; while (current.visited) if ((current = current.next) === start) return; points = current.points; listener.lineStart(); do { current.visited = current.other.visited = true; if (current.entry) { if (current.subject) { for (var i = 0; i < points.length; i++) listener.point((point = points[i])[0], point[1]); } else { interpolate(current.point, current.next.point, 1, listener); } current = current.next; } else { if (current.subject) { points = current.prev.points; for (var i = points.length; --i >= 0; ) listener.point((point = points[i])[0], point[1]); } else { interpolate(current.point, current.prev.point, -1, listener); } current = current.prev; } current = current.other; points = current.points; } while (!current.visited); listener.lineEnd(); } } function d3_geo_clipLinkCircular(array) { if (!(n = array.length)) return; var n, i = 0, a = array[0], b; while (++i < n) { a.next = b = array[i]; b.prev = a; a = b; } a.next = b = array[0]; b.prev = a; } function d3_geo_clipSort(a, b) { return ((a = a.point)[0] < 0 ? a[1] - π / 2 - ε : π / 2 - a[1]) - ((b = b.point)[0] < 0 ? b[1] - π / 2 - ε : π / 2 - b[1]); } function d3_geo_clipSegmentLength1(segment) { return segment.length > 1; } function d3_geo_clipBufferListener() { var lines = [], line; return { lineStart: function() { lines.push(line = []); }, point: function(λ, φ) { line.push([ λ, φ ]); }, lineEnd: d3_noop, buffer: function() { var buffer = lines; lines = []; line = null; return buffer; } }; } function d3_geo_clipAreaRing(ring, invisible) { if (!(n = ring.length)) return 0; var n, i = 0, area = 0, p = ring[0], λ = p[0], φ = p[1], cosφ = Math.cos(φ), x0 = Math.atan2(invisible * Math.sin(λ) * cosφ, Math.sin(φ)), y0 = 1 - invisible * Math.cos(λ) * cosφ, x1 = x0, x, y; while (++i < n) { p = ring[i]; cosφ = Math.cos(φ = p[1]); x = Math.atan2(invisible * Math.sin(λ = p[0]) * cosφ, Math.sin(φ)); y = 1 - invisible * Math.cos(λ) * cosφ; if (Math.abs(y0 - 2) < ε && Math.abs(y - 2) < ε) continue; if (Math.abs(y) < ε || Math.abs(y0) < ε) {} else if (Math.abs(Math.abs(x - x0) - π) < ε) { if (y + y0 > 2) area += 4 * (x - x0); } else if (Math.abs(y0 - 2) < ε) area += 4 * (x - x1); else area += ((3 * π + x - x0) % (2 * π) - π) * (y0 + y); x1 = x0, x0 = x, y0 = y; } return area; } var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate); function d3_geo_clipAntimeridianLine(listener) { var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean; return { lineStart: function() { listener.lineStart(); clean = 1; }, point: function(λ1, φ1) { var sλ1 = λ1 > 0 ? π : -π, dλ = Math.abs(λ1 - λ0); if (Math.abs(dλ - π) < ε) { listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? π / 2 : -π / 2); listener.point(sλ0, φ0); listener.lineEnd(); listener.lineStart(); listener.point(sλ1, φ0); listener.point(λ1, φ0); clean = 0; } else if (sλ0 !== sλ1 && dλ >= π) { if (Math.abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε; if (Math.abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε; φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1); listener.point(sλ0, φ0); listener.lineEnd(); listener.lineStart(); listener.point(sλ1, φ0); clean = 0; } listener.point(λ0 = λ1, φ0 = φ1); sλ0 = sλ1; }, lineEnd: function() { listener.lineEnd(); λ0 = φ0 = NaN; }, clean: function() { return 2 - clean; } }; } function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) { var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1); return Math.abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2; } function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) { var φ; if (from == null) { φ = direction * π / 2; listener.point(-π, φ); listener.point(0, φ); listener.point(π, φ); listener.point(π, 0); listener.point(π, -φ); listener.point(0, -φ); listener.point(-π, -φ); listener.point(-π, 0); listener.point(-π, φ); } else if (Math.abs(from[0] - to[0]) > ε) { var s = (from[0] < to[0] ? 1 : -1) * π; φ = direction * s / 2; listener.point(-s, φ); listener.point(0, φ); listener.point(s, φ); } else { listener.point(to[0], to[1]); } } function d3_geo_clipCircle(degrees) { var radians = degrees * d3_radians, cr = Math.cos(radians), interpolate = d3_geo_circleInterpolate(radians, 6 * d3_radians); return d3_geo_clip(visible, clipLine, interpolate); function visible(λ, φ) { return Math.cos(λ) * Math.cos(φ) > cr; } function clipLine(listener) { var point0, v0, v00, clean; return { lineStart: function() { v00 = v0 = false; clean = 1; }, point: function(λ, φ) { var point1 = [ λ, φ ], point2, v = visible(λ, φ); if (!point0 && (v00 = v0 = v)) listener.lineStart(); if (v !== v0) { point2 = intersect(point0, point1); if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) { point1[0] += ε; point1[1] += ε; v = visible(point1[0], point1[1]); } } if (v !== v0) { clean = 0; if (v0 = v) { listener.lineStart(); point2 = intersect(point1, point0); listener.point(point2[0], point2[1]); } else { point2 = intersect(point0, point1); listener.point(point2[0], point2[1]); listener.lineEnd(); } point0 = point2; } if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) listener.point(point1[0], point1[1]); point0 = point1; }, lineEnd: function() { if (v0) listener.lineEnd(); point0 = null; }, clean: function() { return clean | (v00 && v0) << 1; } }; } function intersect(a, b) { var pa = d3_geo_cartesian(a, 0), pb = d3_geo_cartesian(b, 0); var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; if (!determinant) return a; var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2); d3_geo_cartesianAdd(A, B); var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t = Math.sqrt(w * w - uu * (d3_geo_cartesianDot(A, A) - 1)), q = d3_geo_cartesianScale(u, (-w - t) / uu); d3_geo_cartesianAdd(q, A); return d3_geo_spherical(q); } } function d3_geo_compose(a, b) { function compose(x, y) { return x = a(x, y), b(x[0], x[1]); } if (a.invert && b.invert) compose.invert = function(x, y) { return x = b.invert(x, y), x && a.invert(x[0], x[1]); }; return compose; } function d3_geo_equirectangular(λ, φ) { return [ λ, φ ]; } (d3.geo.equirectangular = function() { return d3_geo_projection(d3_geo_equirectangular).scale(250 / π); }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular; var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) { return 1 / cosλcosφ; }, Math.atan); (d3.geo.gnomonic = function() { return d3_geo_projection(d3_geo_gnomonic); }).raw = d3_geo_gnomonic; d3.geo.graticule = function() { var x1, x0, y1, y0, dx = 22.5, dy = dx, x, y, precision = 2.5; function graticule() { return { type: "MultiLineString", coordinates: lines() }; } function lines() { return d3.range(Math.ceil(x0 / dx) * dx, x1, dx).map(x).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).map(y)); } graticule.lines = function() { return lines().map(function(coordinates) { return { type: "LineString", coordinates: coordinates }; }); }; graticule.outline = function() { return { type: "Polygon", coordinates: [ x(x0).concat(y(y1).slice(1), x(x1).reverse().slice(1), y(y0).reverse().slice(1)) ] }; }; graticule.extent = function(_) { if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; x0 = +_[0][0], x1 = +_[1][0]; y0 = +_[0][1], y1 = +_[1][1]; if (x0 > x1) _ = x0, x0 = x1, x1 = _; if (y0 > y1) _ = y0, y0 = y1, y1 = _; return graticule.precision(precision); }; graticule.step = function(_) { if (!arguments.length) return [ dx, dy ]; dx = +_[0], dy = +_[1]; return graticule; }; graticule.precision = function(_) { if (!arguments.length) return precision; precision = +_; x = d3_geo_graticuleX(y0, y1, precision); y = d3_geo_graticuleY(x0, x1, precision); return graticule; }; return graticule.extent([ [ -180 + ε, -90 + ε ], [ 180 - ε, 90 - ε ] ]); }; function d3_geo_graticuleX(y0, y1, dy) { var y = d3.range(y0, y1 - ε, dy).concat(y1); return function(x) { return y.map(function(y) { return [ x, y ]; }); }; } function d3_geo_graticuleY(x0, x1, dx) { var x = d3.range(x0, x1 - ε, dx).concat(x1); return function(y) { return x.map(function(x) { return [ x, y ]; }); }; } d3.geo.interpolate = function(source, target) { return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians); }; function d3_geo_interpolate(x0, y0, x1, y1) { var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))), k = 1 / Math.sin(d); function interpolate(t) { var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1; return [ Math.atan2(y, x) / d3_radians, Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_radians ]; } interpolate.distance = d; return interpolate; } d3.geo.greatArc = function() { var source = d3_source, source_, target = d3_target, target_, precision = 6 * d3_radians, interpolate; function greatArc() { var p0 = source_ || source.apply(this, arguments), p1 = target_ || target.apply(this, arguments), i = interpolate || d3.geo.interpolate(p0, p1), t = 0, dt = precision / i.distance, coordinates = [ p0 ]; while ((t += dt) < 1) coordinates.push(i(t)); coordinates.push(p1); return { type: "LineString", coordinates: coordinates }; } greatArc.distance = function() { return (interpolate || d3.geo.interpolate(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments))).distance; }; greatArc.source = function(_) { if (!arguments.length) return source; source = _, source_ = typeof _ === "function" ? null : _; interpolate = source_ && target_ ? d3.geo.interpolate(source_, target_) : null; return greatArc; }; greatArc.target = function(_) { if (!arguments.length) return target; target = _, target_ = typeof _ === "function" ? null : _; interpolate = source_ && target_ ? d3.geo.interpolate(source_, target_) : null; return greatArc; }; greatArc.precision = function(_) { if (!arguments.length) return precision / d3_radians; precision = _ * d3_radians; return greatArc; }; return greatArc; }; function d3_geo_mercator(λ, φ) { return [ λ / (2 * π), Math.max(-.5, Math.min(+.5, Math.log(Math.tan(π / 4 + φ / 2)) / (2 * π))) ]; } d3_geo_mercator.invert = function(x, y) { return [ 2 * π * x, 2 * Math.atan(Math.exp(2 * π * y)) - π / 2 ]; }; (d3.geo.mercator = function() { return d3_geo_projection(d3_geo_mercator).scale(500); }).raw = d3_geo_mercator; var d3_geo_orthographic = d3_geo_azimuthal(function() { return 1; }, Math.asin); (d3.geo.orthographic = function() { return d3_geo_projection(d3_geo_orthographic); }).raw = d3_geo_orthographic; d3.geo.path = function() { var pointRadius = 4.5, projection, context, projectStream, contextStream; function path(object) { if (object) d3.geo.stream(object, projectStream(contextStream.pointRadius(typeof pointRadius === "function" ? +pointRadius.apply(this, arguments) : pointRadius))); return contextStream.result(); } path.area = function(object) { d3_geo_pathAreaSum = 0; d3.geo.stream(object, projectStream(d3_geo_pathArea)); return d3_geo_pathAreaSum; }; path.centroid = function(object) { d3_geo_centroidDimension = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; d3.geo.stream(object, projectStream(d3_geo_pathCentroid)); return d3_geo_centroidZ ? [ d3_geo_centroidX / d3_geo_centroidZ, d3_geo_centroidY / d3_geo_centroidZ ] : undefined; }; path.bounds = function(object) { return d3_geo_bounds(projectStream)(object); }; path.projection = function(_) { if (!arguments.length) return projection; projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity; return path; }; path.context = function(_) { if (!arguments.length) return context; contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_); return path; }; path.pointRadius = function(_) { if (!arguments.length) return pointRadius; pointRadius = typeof _ === "function" ? _ : +_; return path; }; return path.projection(d3.geo.albersUsa()).context(null); }; function d3_geo_pathCircle(radius) { return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z"; } function d3_geo_pathProjectStream(project) { var resample = d3_geo_resample(function(λ, φ) { return project([ λ * d3_degrees, φ * d3_degrees ]); }); return function(stream) { stream = resample(stream); return { point: function(λ, φ) { stream.point(λ * d3_radians, φ * d3_radians); }, sphere: function() { stream.sphere(); }, lineStart: function() { stream.lineStart(); }, lineEnd: function() { stream.lineEnd(); }, polygonStart: function() { stream.polygonStart(); }, polygonEnd: function() { stream.polygonEnd(); } }; }; } function d3_geo_pathBuffer() { var pointCircle = d3_geo_pathCircle(4.5), buffer = []; var stream = { point: point, lineStart: function() { stream.point = pointLineStart; }, lineEnd: lineEnd, polygonStart: function() { stream.lineEnd = lineEndPolygon; }, polygonEnd: function() { stream.lineEnd = lineEnd; stream.point = point; }, pointRadius: function(_) { pointCircle = d3_geo_pathCircle(_); return stream; }, result: function() { if (buffer.length) { var result = buffer.join(""); buffer = []; return result; } } }; function point(x, y) { buffer.push("M", x, ",", y, pointCircle); } function pointLineStart(x, y) { buffer.push("M", x, ",", y); stream.point = pointLine; } function pointLine(x, y) { buffer.push("L", x, ",", y); } function lineEnd() { stream.point = point; } function lineEndPolygon() { buffer.push("Z"); } return stream; } function d3_geo_pathContext(context) { var pointRadius = 4.5; var stream = { point: point, lineStart: function() { stream.point = pointLineStart; }, lineEnd: lineEnd, polygonStart: function() { stream.lineEnd = lineEndPolygon; }, polygonEnd: function() { stream.lineEnd = lineEnd; stream.point = point; }, pointRadius: function(_) { pointRadius = _; return stream; }, result: d3_noop }; function point(x, y) { context.moveTo(x, y); context.arc(x, y, pointRadius, 0, 2 * π); } function pointLineStart(x, y) { context.moveTo(x, y); stream.point = pointLine; } function pointLine(x, y) { context.lineTo(x, y); } function lineEnd() { stream.point = point; } function lineEndPolygon() { context.closePath(); } return stream; } var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = { point: d3_noop, lineStart: d3_noop, lineEnd: d3_noop, polygonStart: function() { d3_geo_pathAreaPolygon = 0; d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart; }, polygonEnd: function() { d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop; d3_geo_pathAreaSum += Math.abs(d3_geo_pathAreaPolygon / 2); } }; function d3_geo_pathAreaRingStart() { var x00, y00, x0, y0; d3_geo_pathArea.point = function(x, y) { d3_geo_pathArea.point = nextPoint; x00 = x0 = x, y00 = y0 = y; }; function nextPoint(x, y) { d3_geo_pathAreaPolygon += y0 * x - x0 * y; x0 = x, y0 = y; } d3_geo_pathArea.lineEnd = function() { nextPoint(x00, y00); }; } var d3_geo_pathCentroid = { point: d3_geo_pathCentroidPoint, lineStart: d3_geo_pathCentroidLineStart, lineEnd: d3_geo_pathCentroidLineEnd, polygonStart: function() { d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart; }, polygonEnd: function() { d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart; d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd; } }; function d3_geo_pathCentroidPoint(x, y) { if (d3_geo_centroidDimension) return; d3_geo_centroidX += x; d3_geo_centroidY += y; ++d3_geo_centroidZ; } function d3_geo_pathCentroidLineStart() { var x0, y0; if (d3_geo_centroidDimension !== 1) { if (d3_geo_centroidDimension < 1) { d3_geo_centroidDimension = 1; d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; } else return; } d3_geo_pathCentroid.point = function(x, y) { d3_geo_pathCentroid.point = nextPoint; x0 = x, y0 = y; }; function nextPoint(x, y) { var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); d3_geo_centroidX += z * (x0 + x) / 2; d3_geo_centroidY += z * (y0 + y) / 2; d3_geo_centroidZ += z; x0 = x, y0 = y; } } function d3_geo_pathCentroidLineEnd() { d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; } function d3_geo_pathCentroidRingStart() { var x00, y00, x0, y0; if (d3_geo_centroidDimension < 2) { d3_geo_centroidDimension = 2; d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; } d3_geo_pathCentroid.point = function(x, y) { d3_geo_pathCentroid.point = nextPoint; x00 = x0 = x, y00 = y0 = y; }; function nextPoint(x, y) { var z = y0 * x - x0 * y; d3_geo_centroidX += z * (x0 + x); d3_geo_centroidY += z * (y0 + y); d3_geo_centroidZ += z * 3; x0 = x, y0 = y; } d3_geo_pathCentroid.lineEnd = function() { nextPoint(x00, y00); }; } d3.geo.area = function(object) { d3_geo_areaSum = 0; d3.geo.stream(object, d3_geo_area); return d3_geo_areaSum; }; var d3_geo_areaSum, d3_geo_areaRingU, d3_geo_areaRingV; var d3_geo_area = { sphere: function() { d3_geo_areaSum += 4 * π; }, point: d3_noop, lineStart: d3_noop, lineEnd: d3_noop, polygonStart: function() { d3_geo_areaRingU = 1, d3_geo_areaRingV = 0; d3_geo_area.lineStart = d3_geo_areaRingStart; }, polygonEnd: function() { var area = 2 * Math.atan2(d3_geo_areaRingV, d3_geo_areaRingU); d3_geo_areaSum += area < 0 ? 4 * π + area : area; d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop; } }; function d3_geo_areaRingStart() { var λ00, φ00, λ0, cosφ0, sinφ0; d3_geo_area.point = function(λ, φ) { d3_geo_area.point = nextPoint; λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4), sinφ0 = Math.sin(φ); }; function nextPoint(λ, φ) { λ *= d3_radians; φ = φ * d3_radians / 2 + π / 4; var dλ = λ - λ0, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u0 = d3_geo_areaRingU, v0 = d3_geo_areaRingV, u = cosφ0 * cosφ + k * Math.cos(dλ), v = k * Math.sin(dλ); d3_geo_areaRingU = u0 * u - v0 * v; d3_geo_areaRingV = v0 * u + u0 * v; λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ; } d3_geo_area.lineEnd = function() { nextPoint(λ00, φ00); }; } d3.geo.projection = d3_geo_projection; d3.geo.projectionMutator = d3_geo_projectionMutator; function d3_geo_projection(project) { return d3_geo_projectionMutator(function() { return project; })(); } function d3_geo_projectionMutator(projectAt) { var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) { x = project(x, y); return [ x[0] * k + δx, δy - x[1] * k ]; }), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, clip = d3_geo_clipAntimeridian, clipAngle = null; function projection(point) { point = projectRotate(point[0] * d3_radians, point[1] * d3_radians); return [ point[0] * k + δx, δy - point[1] * k ]; } function invert(point) { point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k); return point && [ point[0] * d3_degrees, point[1] * d3_degrees ]; } projection.stream = function(stream) { return d3_geo_projectionRadiansRotate(rotate, clip(projectResample(stream))); }; projection.clipAngle = function(_) { if (!arguments.length) return clipAngle; clip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle(clipAngle = +_); return projection; }; projection.scale = function(_) { if (!arguments.length) return k; k = +_; return reset(); }; projection.translate = function(_) { if (!arguments.length) return [ x, y ]; x = +_[0]; y = +_[1]; return reset(); }; projection.center = function(_) { if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ]; λ = _[0] % 360 * d3_radians; φ = _[1] % 360 * d3_radians; return reset(); }; projection.rotate = function(_) { if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ]; δλ = _[0] % 360 * d3_radians; δφ = _[1] % 360 * d3_radians; δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0; return reset(); }; d3.rebind(projection, projectResample, "precision"); function reset() { projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project); var center = project(λ, φ); δx = x - center[0] * k; δy = y + center[1] * k; return projection; } return function() { project = projectAt.apply(this, arguments); projection.invert = project.invert && invert; return reset(); }; } function d3_geo_projectionRadiansRotate(rotate, stream) { return { point: function(x, y) { y = rotate(x * d3_radians, y * d3_radians), x = y[0]; stream.point(x > π ? x - 2 * π : x < -π ? x + 2 * π : x, y[1]); }, sphere: function() { stream.sphere(); }, lineStart: function() { stream.lineStart(); }, lineEnd: function() { stream.lineEnd(); }, polygonStart: function() { stream.polygonStart(); }, polygonEnd: function() { stream.polygonEnd(); } }; } function d3_geo_rotation(δλ, δφ, δγ) { return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_equirectangular; } function d3_geo_forwardRotationλ(δλ) { return function(λ, φ) { return λ += δλ, [ λ > π ? λ - 2 * π : λ < -π ? λ + 2 * π : λ, φ ]; }; } function d3_geo_rotationλ(δλ) { var rotation = d3_geo_forwardRotationλ(δλ); rotation.invert = d3_geo_forwardRotationλ(-δλ); return rotation; } function d3_geo_rotationφγ(δφ, δγ) { var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ); function rotation(λ, φ) { var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ; return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδγ + y * sinδγ))) ]; } rotation.invert = function(λ, φ) { var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ; return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδφ - x * sinδφ))) ]; }; return rotation; } var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) { return 1 / (1 + cosλcosφ); }, function(ρ) { return 2 * Math.atan(ρ); }); (d3.geo.stereographic = function() { return d3_geo_projection(d3_geo_stereographic); }).raw = d3_geo_stereographic; function d3_geo_azimuthal(scale, angle) { function azimuthal(λ, φ) { var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ); return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ]; } azimuthal.invert = function(x, y) { var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c); return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ]; }; return azimuthal; } d3.geom = {}; d3.geom.hull = function(vertices) { if (vertices.length < 3) return []; var len = vertices.length, plen = len - 1, points = [], stack = [], i, j, h = 0, x1, y1, x2, y2, u, v, a, sp; for (i = 1; i < len; ++i) { if (vertices[i][1] < vertices[h][1]) { h = i; } else if (vertices[i][1] == vertices[h][1]) { h = vertices[i][0] < vertices[h][0] ? i : h; } } for (i = 0; i < len; ++i) { if (i === h) continue; y1 = vertices[i][1] - vertices[h][1]; x1 = vertices[i][0] - vertices[h][0]; points.push({ angle: Math.atan2(y1, x1), index: i }); } points.sort(function(a, b) { return a.angle - b.angle; }); a = points[0].angle; v = points[0].index; u = 0; for (i = 1; i < plen; ++i) { j = points[i].index; if (a == points[i].angle) { x1 = vertices[v][0] - vertices[h][0]; y1 = vertices[v][1] - vertices[h][1]; x2 = vertices[j][0] - vertices[h][0]; y2 = vertices[j][1] - vertices[h][1]; if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) { points[i].index = -1; } else { points[u].index = -1; a = points[i].angle; u = i; v = j; } } else { a = points[i].angle; u = i; v = j; } } stack.push(h); for (i = 0, j = 0; i < 2; ++j) { if (points[j].index !== -1) { stack.push(points[j].index); i++; } } sp = stack.length; for (;j < plen; ++j) { if (points[j].index === -1) continue; while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) { --sp; } stack[sp++] = points[j].index; } var poly = []; for (i = 0; i < sp; ++i) { poly.push(vertices[stack[i]]); } return poly; }; function d3_geom_hullCCW(i1, i2, i3, v) { var t, a, b, c, d, e, f; t = v[i1]; a = t[0]; b = t[1]; t = v[i2]; c = t[0]; d = t[1]; t = v[i3]; e = t[0]; f = t[1]; return (f - b) * (c - a) - (d - b) * (e - a) > 0; } d3.geom.polygon = function(coordinates) { coordinates.area = function() { var i = 0, n = coordinates.length, area = coordinates[n - 1][1] * coordinates[0][0] - coordinates[n - 1][0] * coordinates[0][1]; while (++i < n) { area += coordinates[i - 1][1] * coordinates[i][0] - coordinates[i - 1][0] * coordinates[i][1]; } return area * .5; }; coordinates.centroid = function(k) { var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c; if (!arguments.length) k = -1 / (6 * coordinates.area()); while (++i < n) { a = b; b = coordinates[i]; c = a[0] * b[1] - b[0] * a[1]; x += (a[0] + b[0]) * c; y += (a[1] + b[1]) * c; } return [ x * k, y * k ]; }; coordinates.clip = function(subject) { var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d; while (++i < n) { input = subject.slice(); subject.length = 0; b = coordinates[i]; c = input[(m = input.length) - 1]; j = -1; while (++j < m) { d = input[j]; if (d3_geom_polygonInside(d, a, b)) { if (!d3_geom_polygonInside(c, a, b)) { subject.push(d3_geom_polygonIntersect(c, d, a, b)); } subject.push(d); } else if (d3_geom_polygonInside(c, a, b)) { subject.push(d3_geom_polygonIntersect(c, d, a, b)); } c = d; } a = b; } return subject; }; return coordinates; }; function d3_geom_polygonInside(p, a, b) { return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); } function d3_geom_polygonIntersect(c, d, a, b) { var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21); return [ x1 + ua * x21, y1 + ua * y21 ]; } d3.geom.voronoi = function(vertices) { var polygons = vertices.map(function() { return []; }), Z = 1e6; d3_voronoi_tessellate(vertices, function(e) { var s1, s2, x1, x2, y1, y2; if (e.a === 1 && e.b >= 0) { s1 = e.ep.r; s2 = e.ep.l; } else { s1 = e.ep.l; s2 = e.ep.r; } if (e.a === 1) { y1 = s1 ? s1.y : -Z; x1 = e.c - e.b * y1; y2 = s2 ? s2.y : Z; x2 = e.c - e.b * y2; } else { x1 = s1 ? s1.x : -Z; y1 = e.c - e.a * x1; x2 = s2 ? s2.x : Z; y2 = e.c - e.a * x2; } var v1 = [ x1, y1 ], v2 = [ x2, y2 ]; polygons[e.region.l.index].push(v1, v2); polygons[e.region.r.index].push(v1, v2); }); polygons = polygons.map(function(polygon, i) { var cx = vertices[i][0], cy = vertices[i][1], angle = polygon.map(function(v) { return Math.atan2(v[0] - cx, v[1] - cy); }), order = d3.range(polygon.length).sort(function(a, b) { return angle[a] - angle[b]; }); return order.filter(function(d, i) { return !i || angle[d] - angle[order[i - 1]] > ε; }).map(function(d) { return polygon[d]; }); }); polygons.forEach(function(polygon, i) { var n = polygon.length; if (!n) return polygon.push([ -Z, -Z ], [ -Z, Z ], [ Z, Z ], [ Z, -Z ]); if (n > 2) return; var p0 = vertices[i], p1 = polygon[0], p2 = polygon[1], x0 = p0[0], y0 = p0[1], x1 = p1[0], y1 = p1[1], x2 = p2[0], y2 = p2[1], dx = Math.abs(x2 - x1), dy = y2 - y1; if (Math.abs(dy) < ε) { var y = y0 < y1 ? -Z : Z; polygon.push([ -Z, y ], [ Z, y ]); } else if (dx < ε) { var x = x0 < x1 ? -Z : Z; polygon.push([ x, -Z ], [ x, Z ]); } else { var y = (x2 - x1) * (y1 - y0) < (x1 - x0) * (y2 - y1) ? Z : -Z, z = Math.abs(dy) - dx; if (Math.abs(z) < ε) { polygon.push([ dy < 0 ? y : -y, y ]); } else { if (z > 0) y *= -1; polygon.push([ -Z, y ], [ Z, y ]); } } }); return polygons; }; var d3_voronoi_opposite = { l: "r", r: "l" }; function d3_voronoi_tessellate(vertices, callback) { var Sites = { list: vertices.map(function(v, i) { return { index: i, x: v[0], y: v[1] }; }).sort(function(a, b) { return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0; }), bottomSite: null }; var EdgeList = { list: [], leftEnd: null, rightEnd: null, init: function() { EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l"); EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l"); EdgeList.leftEnd.r = EdgeList.rightEnd; EdgeList.rightEnd.l = EdgeList.leftEnd; EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd); }, createHalfEdge: function(edge, side) { return { edge: edge, side: side, vertex: null, l: null, r: null }; }, insert: function(lb, he) { he.l = lb; he.r = lb.r; lb.r.l = he; lb.r = he; }, leftBound: function(p) { var he = EdgeList.leftEnd; do { he = he.r; } while (he != EdgeList.rightEnd && Geom.rightOf(he, p)); he = he.l; return he; }, del: function(he) { he.l.r = he.r; he.r.l = he.l; he.edge = null; }, right: function(he) { return he.r; }, left: function(he) { return he.l; }, leftRegion: function(he) { return he.edge == null ? Sites.bottomSite : he.edge.region[he.side]; }, rightRegion: function(he) { return he.edge == null ? Sites.bottomSite : he.edge.region[d3_voronoi_opposite[he.side]]; } }; var Geom = { bisect: function(s1, s2) { var newEdge = { region: { l: s1, r: s2 }, ep: { l: null, r: null } }; var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy; newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5; if (adx > ady) { newEdge.a = 1; newEdge.b = dy / dx; newEdge.c /= dx; } else { newEdge.b = 1; newEdge.a = dx / dy; newEdge.c /= dy; } return newEdge; }, intersect: function(el1, el2) { var e1 = el1.edge, e2 = el2.edge; if (!e1 || !e2 || e1.region.r == e2.region.r) { return null; } var d = e1.a * e2.b - e1.b * e2.a; if (Math.abs(d) < 1e-10) { return null; } var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e; if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) { el = el1; e = e1; } else { el = el2; e = e2; } var rightOfSite = xint >= e.region.r.x; if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") { return null; } return { x: xint, y: yint }; }, rightOf: function(he, p) { var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x; if (rightOfSite && he.side === "l") { return 1; } if (!rightOfSite && he.side === "r") { return 0; } if (e.a === 1) { var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0; if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) { above = fast = dyp >= e.b * dxp; } else { above = p.x + p.y * e.b > e.c; if (e.b < 0) { above = !above; } if (!above) { fast = 1; } } if (!fast) { var dxs = topsite.x - e.region.l.x; above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b); if (e.b < 0) { above = !above; } } } else { var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y; above = t1 * t1 > t2 * t2 + t3 * t3; } return he.side === "l" ? above : !above; }, endPoint: function(edge, side, site) { edge.ep[side] = site; if (!edge.ep[d3_voronoi_opposite[side]]) return; callback(edge); }, distance: function(s, t) { var dx = s.x - t.x, dy = s.y - t.y; return Math.sqrt(dx * dx + dy * dy); } }; var EventQueue = { list: [], insert: function(he, site, offset) { he.vertex = site; he.ystar = site.y + offset; for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) { var next = list[i]; if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) { continue; } else { break; } } list.splice(i, 0, he); }, del: function(he) { for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {} ls.splice(i, 1); }, empty: function() { return EventQueue.list.length === 0; }, nextEvent: function(he) { for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) { if (ls[i] == he) return ls[i + 1]; } return null; }, min: function() { var elem = EventQueue.list[0]; return { x: elem.vertex.x, y: elem.ystar }; }, extractMin: function() { return EventQueue.list.shift(); } }; EdgeList.init(); Sites.bottomSite = Sites.list.shift(); var newSite = Sites.list.shift(), newIntStar; var lbnd, rbnd, llbnd, rrbnd, bisector; var bot, top, temp, p, v; var e, pm; while (true) { if (!EventQueue.empty()) { newIntStar = EventQueue.min(); } if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) { lbnd = EdgeList.leftBound(newSite); rbnd = EdgeList.right(lbnd); bot = EdgeList.rightRegion(lbnd); e = Geom.bisect(bot, newSite); bisector = EdgeList.createHalfEdge(e, "l"); EdgeList.insert(lbnd, bisector); p = Geom.intersect(lbnd, bisector); if (p) { EventQueue.del(lbnd); EventQueue.insert(lbnd, p, Geom.distance(p, newSite)); } lbnd = bisector; bisector = EdgeList.createHalfEdge(e, "r"); EdgeList.insert(lbnd, bisector); p = Geom.intersect(bisector, rbnd); if (p) { EventQueue.insert(bisector, p, Geom.distance(p, newSite)); } newSite = Sites.list.shift(); } else if (!EventQueue.empty()) { lbnd = EventQueue.extractMin(); llbnd = EdgeList.left(lbnd); rbnd = EdgeList.right(lbnd); rrbnd = EdgeList.right(rbnd); bot = EdgeList.leftRegion(lbnd); top = EdgeList.rightRegion(rbnd); v = lbnd.vertex; Geom.endPoint(lbnd.edge, lbnd.side, v); Geom.endPoint(rbnd.edge, rbnd.side, v); EdgeList.del(lbnd); EventQueue.del(rbnd); EdgeList.del(rbnd); pm = "l"; if (bot.y > top.y) { temp = bot; bot = top; top = temp; pm = "r"; } e = Geom.bisect(bot, top); bisector = EdgeList.createHalfEdge(e, pm); EdgeList.insert(llbnd, bisector); Geom.endPoint(e, d3_voronoi_opposite[pm], v); p = Geom.intersect(llbnd, bisector); if (p) { EventQueue.del(llbnd); EventQueue.insert(llbnd, p, Geom.distance(p, bot)); } p = Geom.intersect(bisector, rrbnd); if (p) { EventQueue.insert(bisector, p, Geom.distance(p, bot)); } } else { break; } } for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) { callback(lbnd.edge); } } d3.geom.delaunay = function(vertices) { var edges = vertices.map(function() { return []; }), triangles = []; d3_voronoi_tessellate(vertices, function(e) { edges[e.region.l.index].push(vertices[e.region.r.index]); }); edges.forEach(function(edge, i) { var v = vertices[i], cx = v[0], cy = v[1]; edge.forEach(function(v) { v.angle = Math.atan2(v[0] - cx, v[1] - cy); }); edge.sort(function(a, b) { return a.angle - b.angle; }); for (var j = 0, m = edge.length - 1; j < m; j++) { triangles.push([ v, edge[j], edge[j + 1] ]); } }); return triangles; }; d3.geom.quadtree = function(points, x1, y1, x2, y2) { var p, i = -1, n = points.length; if (arguments.length < 5) { if (arguments.length === 3) { y2 = y1; x2 = x1; y1 = x1 = 0; } else { x1 = y1 = Infinity; x2 = y2 = -Infinity; while (++i < n) { p = points[i]; if (p.x < x1) x1 = p.x; if (p.y < y1) y1 = p.y; if (p.x > x2) x2 = p.x; if (p.y > y2) y2 = p.y; } } } var dx = x2 - x1, dy = y2 - y1; if (dx > dy) y2 = y1 + dx; else x2 = x1 + dy; function insert(n, p, x1, y1, x2, y2) { if (isNaN(p.x) || isNaN(p.y)) return; if (n.leaf) { var v = n.point; if (v) { if (Math.abs(v.x - p.x) + Math.abs(v.y - p.y) < .01) { insertChild(n, p, x1, y1, x2, y2); } else { n.point = null; insertChild(n, v, x1, y1, x2, y2); insertChild(n, p, x1, y1, x2, y2); } } else { n.point = p; } } else { insertChild(n, p, x1, y1, x2, y2); } } function insertChild(n, p, x1, y1, x2, y2) { var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = p.x >= sx, bottom = p.y >= sy, i = (bottom << 1) + right; n.leaf = false; n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); if (right) x1 = sx; else x2 = sx; if (bottom) y1 = sy; else y2 = sy; insert(n, p, x1, y1, x2, y2); } var root = d3_geom_quadtreeNode(); root.add = function(p) { insert(root, p, x1, y1, x2, y2); }; root.visit = function(f) { d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2); }; points.forEach(root.add); return root; }; function d3_geom_quadtreeNode() { return { leaf: true, nodes: [], point: null }; } function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { if (!f(node, x1, y1, x2, y2)) { var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes; if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); } } d3.time = {}; var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]; function d3_time_utc() { this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]); } d3_time_utc.prototype = { getDate: function() { return this._.getUTCDate(); }, getDay: function() { return this._.getUTCDay(); }, getFullYear: function() { return this._.getUTCFullYear(); }, getHours: function() { return this._.getUTCHours(); }, getMilliseconds: function() { return this._.getUTCMilliseconds(); }, getMinutes: function() { return this._.getUTCMinutes(); }, getMonth: function() { return this._.getUTCMonth(); }, getSeconds: function() { return this._.getUTCSeconds(); }, getTime: function() { return this._.getTime(); }, getTimezoneOffset: function() { return 0; }, valueOf: function() { return this._.valueOf(); }, setDate: function() { d3_time_prototype.setUTCDate.apply(this._, arguments); }, setDay: function() { d3_time_prototype.setUTCDay.apply(this._, arguments); }, setFullYear: function() { d3_time_prototype.setUTCFullYear.apply(this._, arguments); }, setHours: function() { d3_time_prototype.setUTCHours.apply(this._, arguments); }, setMilliseconds: function() { d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); }, setMinutes: function() { d3_time_prototype.setUTCMinutes.apply(this._, arguments); }, setMonth: function() { d3_time_prototype.setUTCMonth.apply(this._, arguments); }, setSeconds: function() { d3_time_prototype.setUTCSeconds.apply(this._, arguments); }, setTime: function() { d3_time_prototype.setTime.apply(this._, arguments); } }; var d3_time_prototype = Date.prototype; var d3_time_formatDateTime = "%a %b %e %X %Y", d3_time_formatDate = "%m/%d/%Y", d3_time_formatTime = "%H:%M:%S"; var d3_time_days = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], d3_time_dayAbbreviations = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ]; d3.time.format = function(template) { var n = template.length; function format(date) { var string = [], i = -1, j = 0, c, p, f; while (++i < n) { if (template.charCodeAt(i) === 37) { string.push(template.substring(j, i)); if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i); if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p); string.push(c); j = i + 1; } } string.push(template.substring(j, i)); return string.join(""); } format.parse = function(string) { var d = { y: 1900, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0 }, i = d3_time_parse(d, template, string, 0); if (i != string.length) return null; if ("p" in d) d.H = d.H % 12 + d.p * 12; var date = new d3_time(); date.setFullYear(d.y, d.m, d.d); date.setHours(d.H, d.M, d.S, d.L); return date; }; format.toString = function() { return template; }; return format; }; function d3_time_parse(date, template, string, j) { var c, p, i = 0, n = template.length, m = string.length; while (i < n) { if (j >= m) return -1; c = template.charCodeAt(i++); if (c === 37) { p = d3_time_parsers[template.charAt(i++)]; if (!p || (j = p(date, string, j)) < 0) return -1; } else if (c != string.charCodeAt(j++)) { return -1; } } return j; } function d3_time_formatRe(names) { return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i"); } function d3_time_formatLookup(names) { var map = new d3_Map(), i = -1, n = names.length; while (++i < n) map.set(names[i].toLowerCase(), i); return map; } function d3_time_formatPad(value, fill, width) { value += ""; var length = value.length; return length < width ? new Array(width - length + 1).join(fill) + value : value; } var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations); var d3_time_formatPads = { "-": "", _: " ", "0": "0" }; var d3_time_formats = { a: function(d) { return d3_time_dayAbbreviations[d.getDay()]; }, A: function(d) { return d3_time_days[d.getDay()]; }, b: function(d) { return d3_time_monthAbbreviations[d.getMonth()]; }, B: function(d) { return d3_time_months[d.getMonth()]; }, c: d3.time.format(d3_time_formatDateTime), d: function(d, p) { return d3_time_formatPad(d.getDate(), p, 2); }, e: function(d, p) { return d3_time_formatPad(d.getDate(), p, 2); }, H: function(d, p) { return d3_time_formatPad(d.getHours(), p, 2); }, I: function(d, p) { return d3_time_formatPad(d.getHours() % 12 || 12, p, 2); }, j: function(d, p) { return d3_time_formatPad(1 + d3.time.dayOfYear(d), p, 3); }, L: function(d, p) { return d3_time_formatPad(d.getMilliseconds(), p, 3); }, m: function(d, p) { return d3_time_formatPad(d.getMonth() + 1, p, 2); }, M: function(d, p) { return d3_time_formatPad(d.getMinutes(), p, 2); }, p: function(d) { return d.getHours() >= 12 ? "PM" : "AM"; }, S: function(d, p) { return d3_time_formatPad(d.getSeconds(), p, 2); }, U: function(d, p) { return d3_time_formatPad(d3.time.sundayOfYear(d), p, 2); }, w: function(d) { return d.getDay(); }, W: function(d, p) { return d3_time_formatPad(d3.time.mondayOfYear(d), p, 2); }, x: d3.time.format(d3_time_formatDate), X: d3.time.format(d3_time_formatTime), y: function(d, p) { return d3_time_formatPad(d.getFullYear() % 100, p, 2); }, Y: function(d, p) { return d3_time_formatPad(d.getFullYear() % 1e4, p, 4); }, Z: d3_time_zone, "%": function() { return "%"; } }; var d3_time_parsers = { a: d3_time_parseWeekdayAbbrev, A: d3_time_parseWeekday, b: d3_time_parseMonthAbbrev, B: d3_time_parseMonth, c: d3_time_parseLocaleFull, d: d3_time_parseDay, e: d3_time_parseDay, H: d3_time_parseHour24, I: d3_time_parseHour24, L: d3_time_parseMilliseconds, m: d3_time_parseMonthNumber, M: d3_time_parseMinutes, p: d3_time_parseAmPm, S: d3_time_parseSeconds, x: d3_time_parseLocaleDate, X: d3_time_parseLocaleTime, y: d3_time_parseYear, Y: d3_time_parseFullYear }; function d3_time_parseWeekdayAbbrev(date, string, i) { d3_time_dayAbbrevRe.lastIndex = 0; var n = d3_time_dayAbbrevRe.exec(string.substring(i)); return n ? i += n[0].length : -1; } function d3_time_parseWeekday(date, string, i) { d3_time_dayRe.lastIndex = 0; var n = d3_time_dayRe.exec(string.substring(i)); return n ? i += n[0].length : -1; } function d3_time_parseMonthAbbrev(date, string, i) { d3_time_monthAbbrevRe.lastIndex = 0; var n = d3_time_monthAbbrevRe.exec(string.substring(i)); return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1; } function d3_time_parseMonth(date, string, i) { d3_time_monthRe.lastIndex = 0; var n = d3_time_monthRe.exec(string.substring(i)); return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1; } function d3_time_parseLocaleFull(date, string, i) { return d3_time_parse(date, d3_time_formats.c.toString(), string, i); } function d3_time_parseLocaleDate(date, string, i) { return d3_time_parse(date, d3_time_formats.x.toString(), string, i); } function d3_time_parseLocaleTime(date, string, i) { return d3_time_parse(date, d3_time_formats.X.toString(), string, i); } function d3_time_parseFullYear(date, string, i) { d3_time_numberRe.lastIndex = 0; var n = d3_time_numberRe.exec(string.substring(i, i + 4)); return n ? (date.y = +n[0], i += n[0].length) : -1; } function d3_time_parseYear(date, string, i) { d3_time_numberRe.lastIndex = 0; var n = d3_time_numberRe.exec(string.substring(i, i + 2)); return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1; } function d3_time_expandYear(d) { return d + (d > 68 ? 1900 : 2e3); } function d3_time_parseMonthNumber(date, string, i) { d3_time_numberRe.lastIndex = 0; var n = d3_time_numberRe.exec(string.substring(i, i + 2)); return n ? (date.m = n[0] - 1, i += n[0].length) : -1; } function d3_time_parseDay(date, string, i) { d3_time_numberRe.lastIndex = 0; var n = d3_time_numberRe.exec(string.substring(i, i + 2)); return n ? (date.d = +n[0], i += n[0].length) : -1; } function d3_time_parseHour24(date, string, i) { d3_time_numberRe.lastIndex = 0; var n = d3_time_numberRe.exec(string.substring(i, i + 2)); return n ? (date.H = +n[0], i += n[0].length) : -1; } function d3_time_parseMinutes(date, string, i) { d3_time_numberRe.lastIndex = 0; var n = d3_time_numberRe.exec(string.substring(i, i + 2)); return n ? (date.M = +n[0], i += n[0].length) : -1; } function d3_time_parseSeconds(date, string, i) { d3_time_numberRe.lastIndex = 0; var n = d3_time_numberRe.exec(string.substring(i, i + 2)); return n ? (date.S = +n[0], i += n[0].length) : -1; } function d3_time_parseMilliseconds(date, string, i) { d3_time_numberRe.lastIndex = 0; var n = d3_time_numberRe.exec(string.substring(i, i + 3)); return n ? (date.L = +n[0], i += n[0].length) : -1; } var d3_time_numberRe = /^\s*\d+/; function d3_time_parseAmPm(date, string, i) { var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase()); return n == null ? -1 : (date.p = n, i); } var d3_time_amPmLookup = d3.map({ am: 0, pm: 1 }); function d3_time_zone(d) { var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60; return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2); } d3.time.format.utc = function(template) { var local = d3.time.format(template); function format(date) { try { d3_time = d3_time_utc; var utc = new d3_time(); utc._ = date; return local(utc); } finally { d3_time = Date; } } format.parse = function(string) { try { d3_time = d3_time_utc; var date = local.parse(string); return date && date._; } finally { d3_time = Date; } }; format.toString = local.toString; return format; }; var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ"); d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso; function d3_time_formatIsoNative(date) { return date.toISOString(); } d3_time_formatIsoNative.parse = function(string) { var date = new Date(string); return isNaN(date) ? null : date; }; d3_time_formatIsoNative.toString = d3_time_formatIso.toString; function d3_time_interval(local, step, number) { function round(date) { var d0 = local(date), d1 = offset(d0, 1); return date - d0 < d1 - date ? d0 : d1; } function ceil(date) { step(date = local(new d3_time(date - 1)), 1); return date; } function offset(date, k) { step(date = new d3_time(+date), k); return date; } function range(t0, t1, dt) { var time = ceil(t0), times = []; if (dt > 1) { while (time < t1) { if (!(number(time) % dt)) times.push(new Date(+time)); step(time, 1); } } else { while (time < t1) times.push(new Date(+time)), step(time, 1); } return times; } function range_utc(t0, t1, dt) { try { d3_time = d3_time_utc; var utc = new d3_time_utc(); utc._ = t0; return range(utc, t1, dt); } finally { d3_time = Date; } } local.floor = local; local.round = round; local.ceil = ceil; local.offset = offset; local.range = range; var utc = local.utc = d3_time_interval_utc(local); utc.floor = utc; utc.round = d3_time_interval_utc(round); utc.ceil = d3_time_interval_utc(ceil); utc.offset = d3_time_interval_utc(offset); utc.range = range_utc; return local; } function d3_time_interval_utc(method) { return function(date, k) { try { d3_time = d3_time_utc; var utc = new d3_time_utc(); utc._ = date; return method(utc, k)._; } finally { d3_time = Date; } }; } d3.time.second = d3_time_interval(function(date) { return new d3_time(Math.floor(date / 1e3) * 1e3); }, function(date, offset) { date.setTime(date.getTime() + Math.floor(offset) * 1e3); }, function(date) { return date.getSeconds(); }); d3.time.seconds = d3.time.second.range; d3.time.seconds.utc = d3.time.second.utc.range; d3.time.minute = d3_time_interval(function(date) { return new d3_time(Math.floor(date / 6e4) * 6e4); }, function(date, offset) { date.setTime(date.getTime() + Math.floor(offset) * 6e4); }, function(date) { return date.getMinutes(); }); d3.time.minutes = d3.time.minute.range; d3.time.minutes.utc = d3.time.minute.utc.range; d3.time.hour = d3_time_interval(function(date) { var timezone = date.getTimezoneOffset() / 60; return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5); }, function(date, offset) { date.setTime(date.getTime() + Math.floor(offset) * 36e5); }, function(date) { return date.getHours(); }); d3.time.hours = d3.time.hour.range; d3.time.hours.utc = d3.time.hour.utc.range; d3.time.day = d3_time_interval(function(date) { var day = new d3_time(1970, 0); day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); return day; }, function(date, offset) { date.setDate(date.getDate() + offset); }, function(date) { return date.getDate() - 1; }); d3.time.days = d3.time.day.range; d3.time.days.utc = d3.time.day.utc.range; d3.time.dayOfYear = function(date) { var year = d3.time.year(date); return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5); }; d3_time_daySymbols.forEach(function(day, i) { day = day.toLowerCase(); i = 7 - i; var interval = d3.time[day] = d3_time_interval(function(date) { (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7); return date; }, function(date, offset) { date.setDate(date.getDate() + Math.floor(offset) * 7); }, function(date) { var day = d3.time.year(date).getDay(); return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i); }); d3.time[day + "s"] = interval.range; d3.time[day + "s"].utc = interval.utc.range; d3.time[day + "OfYear"] = function(date) { var day = d3.time.year(date).getDay(); return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7); }; }); d3.time.week = d3.time.sunday; d3.time.weeks = d3.time.sunday.range; d3.time.weeks.utc = d3.time.sunday.utc.range; d3.time.weekOfYear = d3.time.sundayOfYear; d3.time.month = d3_time_interval(function(date) { date = d3.time.day(date); date.setDate(1); return date; }, function(date, offset) { date.setMonth(date.getMonth() + offset); }, function(date) { return date.getMonth(); }); d3.time.months = d3.time.month.range; d3.time.months.utc = d3.time.month.utc.range; d3.time.year = d3_time_interval(function(date) { date = d3.time.day(date); date.setMonth(0, 1); return date; }, function(date, offset) { date.setFullYear(date.getFullYear() + offset); }, function(date) { return date.getFullYear(); }); d3.time.years = d3.time.year.range; d3.time.years.utc = d3.time.year.utc.range; function d3_time_scale(linear, methods, format) { function scale(x) { return linear(x); } scale.invert = function(x) { return d3_time_scaleDate(linear.invert(x)); }; scale.domain = function(x) { if (!arguments.length) return linear.domain().map(d3_time_scaleDate); linear.domain(x); return scale; }; scale.nice = function(m) { return scale.domain(d3_scale_nice(scale.domain(), function() { return m; })); }; scale.ticks = function(m, k) { var extent = d3_time_scaleExtent(scale.domain()); if (typeof m !== "function") { var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target); if (i == d3_time_scaleSteps.length) return methods.year(extent, m); if (!i) return linear.ticks(m).map(d3_time_scaleDate); if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i; m = methods[i]; k = m[1]; m = m[0].range; } return m(extent[0], new Date(+extent[1] + 1), k); }; scale.tickFormat = function() { return format; }; scale.copy = function() { return d3_time_scale(linear.copy(), methods, format); }; return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); } function d3_time_scaleExtent(domain) { var start = domain[0], stop = domain[domain.length - 1]; return start < stop ? [ start, stop ] : [ stop, start ]; } function d3_time_scaleDate(t) { return new Date(t); } function d3_time_scaleFormat(formats) { return function(date) { var i = formats.length - 1, f = formats[i]; while (!f[1](date)) f = formats[--i]; return f[0](date); }; } function d3_time_scaleSetYear(y) { var d = new Date(y, 0, 1); d.setFullYear(y); return d; } function d3_time_scaleGetYear(d) { var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1); return y + (d - d0) / (d1 - d0); } var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ]; var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ]; var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), d3_true ], [ d3.time.format("%B"), function(d) { return d.getMonth(); } ], [ d3.time.format("%b %d"), function(d) { return d.getDate() != 1; } ], [ d3.time.format("%a %d"), function(d) { return d.getDay() && d.getDate() != 1; } ], [ d3.time.format("%I %p"), function(d) { return d.getHours(); } ], [ d3.time.format("%I:%M"), function(d) { return d.getMinutes(); } ], [ d3.time.format(":%S"), function(d) { return d.getSeconds(); } ], [ d3.time.format(".%L"), function(d) { return d.getMilliseconds(); } ] ]; var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats); d3_time_scaleLocalMethods.year = function(extent, m) { return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear); }; d3.time.scale = function() { return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); }; var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) { return [ m[0].utc, m[1] ]; }); var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), d3_true ], [ d3.time.format.utc("%B"), function(d) { return d.getUTCMonth(); } ], [ d3.time.format.utc("%b %d"), function(d) { return d.getUTCDate() != 1; } ], [ d3.time.format.utc("%a %d"), function(d) { return d.getUTCDay() && d.getUTCDate() != 1; } ], [ d3.time.format.utc("%I %p"), function(d) { return d.getUTCHours(); } ], [ d3.time.format.utc("%I:%M"), function(d) { return d.getUTCMinutes(); } ], [ d3.time.format.utc(":%S"), function(d) { return d.getUTCSeconds(); } ], [ d3.time.format.utc(".%L"), function(d) { return d.getUTCMilliseconds(); } ] ]; var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats); function d3_time_scaleUTCSetYear(y) { var d = new Date(Date.UTC(y, 0, 1)); d.setUTCFullYear(y); return d; } function d3_time_scaleUTCGetYear(d) { var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1); return y + (d - d0) / (d1 - d0); } d3_time_scaleUTCMethods.year = function(extent, m) { return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear); }; d3.time.scale.utc = function() { return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat); }; return d3; }();
andersem/cdnjs
ajax/libs/d3/3.0.6/d3.js
JavaScript
mit
267,948
/*! * algoliasearch 2.1.0 * https://github.com/algolia/algoliasearch-client-js * Copyright 2013 Algolia SAS; Licensed MIT */ var VERSION = "2.1.0"; var AlgoliaSearch = function(applicationID, apiKey, method, resolveDNS, hostsArray) { this.applicationID = applicationID; this.apiKey = apiKey; if (this._isUndefined(hostsArray)) { hostsArray = [ applicationID + "-1.algolia.io", applicationID + "-2.algolia.io", applicationID + "-3.algolia.io" ]; } this.hosts = []; for (var i = 0; i < hostsArray.length; ++i) { if (Math.random() > .5) { this.hosts.reverse(); } if (this._isUndefined(method) || method == null) { this.hosts.push(("https:" == document.location.protocol ? "https" : "http") + "://" + hostsArray[i]); } else if (method === "https" || method === "HTTPS") { this.hosts.push("https://" + hostsArray[i]); } else { this.hosts.push("http://" + hostsArray[i]); } } if (Math.random() > .5) { this.hosts.reverse(); } if (this._isUndefined(resolveDNS) || resolveDNS) { this._jsonRequest({ method: "GET", url: "/1/isalive" }); } }; AlgoliaSearch.prototype = { deleteIndex: function(indexName, callback) { this._jsonRequest({ method: "DELETE", url: "/1/indexes/" + encodeURIComponent(indexName), callback: callback }); }, moveIndex: function(srcIndexName, dstIndexName, callback) { var postObj = { operation: "move", destination: dstIndexName }; this._jsonRequest({ method: "POST", url: "/1/indexes/" + encodeURIComponent(indexName) + "/operation", body: postObj, callback: callback }); }, copyIndex: function(srcIndexName, dstIndexName, callback) { var postObj = { operation: "copy", destination: dstIndexName }; this._jsonRequest({ method: "POST", url: "/1/indexes/" + encodeURIComponent(indexName) + "/operation", body: postObj, callback: callback }); }, getLogs: function(callback, offset, length) { if (this._isUndefined(offset)) { offset = 0; } if (this._isUndefined(length)) { length = 10; } this._jsonRequest({ method: "GET", url: "/1/logs?offset=" + offset + "&length=" + length, callback: callback }); }, listIndexes: function(callback) { this._jsonRequest({ method: "GET", url: "/1/indexes/", callback: callback }); }, initIndex: function(indexName) { return new this.Index(this, indexName); }, listUserKeys: function(callback) { this._jsonRequest({ method: "GET", url: "/1/keys", callback: callback }); }, getUserKeyACL: function(key, callback) { this._jsonRequest({ method: "GET", url: "/1/keys/" + key, callback: callback }); }, deleteUserKey: function(key, callback) { this._jsonRequest({ method: "DELETE", url: "/1/keys/" + key, callback: callback }); }, addUserKey: function(acls, callback) { var aclsObject = {}; aclsObject.acl = acls; this._jsonRequest({ method: "POST", url: "/1/keys", body: aclsObject, callback: callback }); }, addUserKeyWithValidity: function(acls, validity, callback) { var indexObj = this; var aclsObject = {}; aclsObject.acl = acls; this._jsonRequest({ method: "POST", url: "/1/indexes/" + indexObj.indexName + "/keys", body: aclsObject, callback: callback }); }, startQueriesBatch: function() { this.batch = []; }, addQueryInBatch: function(indexName, query, args) { var params = "query=" + query; if (!this._isUndefined(args) && args != null) { params = this._getSearchParams(args, params); } this.batch.push({ indexName: indexName, params: params }); }, clearCache: function() { this.cache = {}; }, sendQueriesBatch: function(callback, delay) { var as = this; var params = { requests: [], apiKey: this.apiKey, appID: this.applicationID }; for (var i = 0; i < as.batch.length; ++i) { params.requests.push(as.batch[i]); } window.clearTimeout(as.onDelayTrigger); if (!this._isUndefined(delay) && delay != null && delay > 0) { var onDelayTrigger = window.setTimeout(function() { as._sendQueriesBatch(params, callback); }, delay); as.onDelayTrigger = onDelayTrigger; } else { this._sendQueriesBatch(params, callback); } }, Index: function(algoliasearch, indexName) { this.indexName = indexName; this.as = algoliasearch; this.typeAheadArgs = null; this.typeAheadPropertyName = null; }, _sendQueriesBatch: function(params, callback) { this._jsonRequest({ cache: this.cache, method: "POST", url: "/1/indexes/*/queries", body: params, callback: callback }); }, _jsonRequest: function(opts) { var self = this; var callback = opts.callback; var cache = null; var cacheID = opts.url; if (!this._isUndefined(opts.body)) { cacheID = opts.url + "_body_" + JSON.stringify(opts.body); } if (!this._isUndefined(opts.cache)) { cache = opts.cache; if (!this._isUndefined(cache[cacheID])) { if (!this._isUndefined(callback)) { callback(true, cache[cacheID]); } return; } } var impl = function(position) { var idx = 0; if (!self._isUndefined(position)) { idx = position; } if (self.hosts.length <= idx) { if (!self._isUndefined(callback)) { callback(false, { message: "Cannot contact server" }); } return; } opts.callback = function(retry, success, res, body) { if (!success && !self._isUndefined(body)) { console.log("Error: " + body.message); } if (success && !self._isUndefined(opts.cache)) { cache[cacheID] = body; } if (!success && retry && idx + 1 < self.hosts.length) { impl(idx + 1); } else { if (!self._isUndefined(callback)) { callback(success, body); } } }; opts.hostname = self.hosts[idx]; self._jsonRequestByHost(opts); }; impl(); }, _jsonRequestByHost: function(opts) { var body = null; var self = this; if (!this._isUndefined(opts.body)) { body = JSON.stringify(opts.body); } var url = opts.hostname + opts.url; var xmlHttp = null; xmlHttp = new XMLHttpRequest(); if ("withCredentials" in xmlHttp) { xmlHttp.open(opts.method, url, true); xmlHttp.setRequestHeader("X-Algolia-API-Key", this.apiKey); xmlHttp.setRequestHeader("X-Algolia-Application-Id", this.applicationID); if (body != null) { xmlHttp.setRequestHeader("Content-type", "application/json"); } } else if (typeof XDomainRequest != "undefined") { xmlHttp = new XDomainRequest(); xmlHttp.open(opts.method, url); } else { console.log("your browser is too old to support CORS requests"); } xmlHttp.send(body); xmlHttp.onload = function(event) { if (!self._isUndefined(event)) { var retry = event.target.status === 0 || event.target.status === 503; var success = event.target.status === 200 || event.target.status === 201; opts.callback(retry, success, event.target, event.target.response != null ? JSON.parse(event.target.response) : null); } else { opts.callback(false, true, event, JSON.parse(xmlHttp.responseText)); } }; xmlHttp.onerror = function() { opts.callback(true, false, null, { message: "Could not connect to Host" }); }; }, _getSearchParams: function(args, params) { if (this._isUndefined(args) || args == null) { return params; } for (var key in args) { if (key != null && args.hasOwnProperty(key)) { params += params.length === 0 ? "?" : "&"; params += key + "=" + encodeURIComponent(args[key]); } } return params; }, _isUndefined: function(obj) { return obj === void 0; }, applicationID: null, apiKey: null, hosts: [], cache: {} }; AlgoliaSearch.prototype.Index.prototype = { clearCache: function() { this.cache = {}; }, addObject: function(content, callback, objectID) { var indexObj = this; if (this.as._isUndefined(objectID)) { this.as._jsonRequest({ method: "POST", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName), body: content, callback: callback }); } else { this.as._jsonRequest({ method: "PUT", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/" + encodeURIComponent(objectID), body: content, callback: callback }); } }, addObjects: function(objects, callback) { var indexObj = this; var postObj = { requests: [] }; for (var i = 0; i < objects.length; ++i) { var request = { action: "addObject", body: objects[i] }; postObj.requests.push(request); } this.as._jsonRequest({ method: "POST", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/batch", body: postObj, callback: callback }); }, getObject: function(objectID, callback, attributes) { var indexObj = this; var params = ""; if (!this.as._isUndefined(attributes)) { params = "?attributes="; for (var i = 0; i < attributes.length; ++i) { if (i !== 0) { params += ","; } params += attributes[i]; } } this.as._jsonRequest({ method: "GET", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/" + encodeURIComponent(objectID) + params, callback: callback }); }, partialUpdateObject: function(partialObject, callback) { var indexObj = this; this.as._jsonRequest({ method: "POST", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/" + encodeURIComponent(partialObject.objectID) + "/partial", body: partialObject, callback: callback }); }, saveObject: function(object, callback) { var indexObj = this; this.as._jsonRequest({ method: "PUT", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/" + encodeURIComponent(object.objectID), body: object, callback: callback }); }, saveObjects: function(objects, callback) { var indexObj = this; var postObj = { requests: [] }; for (var i = 0; i < objects.length; ++i) { var request = { action: "updateObject", objectID: encodeURIComponent(objects[i].objectID), body: objects[i] }; postObj.requests.push(request); } this.as._jsonRequest({ method: "POST", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/batch", body: postObj, callback: callback }); }, deleteObject: function(objectID, callback) { if (objectID == null || objectID.length === 0) { callback(false, { message: "empty objectID" }); return; } var indexObj = this; this.as._jsonRequest({ method: "DELETE", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/" + encodeURIComponent(objectID), callback: callback }); }, search: function(query, callback, args, delay) { var indexObj = this; var params = "query=" + encodeURIComponent(query); if (!this.as._isUndefined(args) && args != null) { params = this.as._getSearchParams(args, params); } window.clearTimeout(indexObj.onDelayTrigger); if (!this.as._isUndefined(delay) && delay != null && delay > 0) { var onDelayTrigger = window.setTimeout(function() { indexObj._search(params, callback); }, delay); indexObj.onDelayTrigger = onDelayTrigger; } else { this._search(params, callback); } }, getTypeaheadTransport: function(args, propertyName) { this.typeAheadArgs = args; if (typeof propertyName !== "undefined") { this.typeAheadPropertyName = propertyName; } console.log("Set property:" + propertyName); return this; }, get: function(query, processRemoteData, that, cb, suggestions) { self = this; this.search(query, function(success, content) { if (success) { for (var i = 0; i < content.hits.length; ++i) { var obj = content.hits[i]; if (typeof obj.value === "undefined") { console.log(self.typeAheadPropertyName); console.log(obj[self.typeAheadPropertyName]); if (self.typeAheadPropertyName != null && typeof obj[self.typeAheadPropertyName] !== "undefined") { obj.value = obj[self.typeAheadPropertyName]; } else { var found = false; for (var propertyName in obj) { if (!found && obj.hasOwnProperty(propertyName) && typeof obj[propertyName] === "string") { obj.value = obj[propertyName]; found = true; } } } } suggestions.push(that._transformDatum(obj)); } cb && cb(suggestions); } }, self.typeAheadArgs); return true; }, waitTask: function(taskID, callback) { var indexObj = this; this.as._jsonRequest({ method: "GET", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/task/" + taskID, callback: function(success, body) { if (success && body.status === "published") { callback(true, body); } else if (success && body.pendingTask) { return indexObj.waitTask(taskID, callback); } else { callback(false, body); } } }); }, getSettings: function(callback) { var indexObj = this; this.as._jsonRequest({ method: "GET", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/settings", callback: callback }); }, setSettings: function(settings, callback) { var indexObj = this; this.as._jsonRequest({ method: "PUT", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/settings", body: settings, callback: callback }); }, listUserKeys: function(callback) { var indexObj = this; this.as._jsonRequest({ method: "GET", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/keys", callback: callback }); }, getUserKeyACL: function(key, callback) { var indexObj = this; this.as._jsonRequest({ method: "GET", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/keys/" + key, callback: callback }); }, deleteUserKey: function(key, callback) { var indexObj = this; this.as._jsonRequest({ method: "DELETE", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/keys/" + key, callback: callback }); }, addUserKey: function(acls, callback) { var indexObj = this; var aclsObject = {}; aclsObject.acl = acls; this.as._jsonRequest({ method: "POST", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/keys", body: aclsObject, callback: callback }); }, addUserKeyWithValidity: function(acls, validity, callback) { var indexObj = this; var aclsObject = {}; aclsObject.acl = acls; aclsObject.validity = validity; this.as._jsonRequest({ method: "POST", url: "/1/indexes/" + encodeURIComponent(indexObj.indexName) + "/keys", body: aclsObject, callback: callback }); }, _search: function(params, callback) { this.as._jsonRequest({ cache: this.cache, method: "POST", url: "/1/indexes/" + encodeURIComponent(this.indexName) + "/query", body: { params: params, apiKey: this.as.apiKey, appID: this.as.applicationID }, callback: callback }); }, as: null, indexName: null, cache: {}, typeAheadArgs: null, typeAheadPropertyName: null, emptyConstructor: function() {} };
MisatoTremor/cdnjs
ajax/libs/algoliasearch/2.1.0/algoliasearch.js
JavaScript
mit
19,064
/* * Copyright (C) 2010 Google Inc. 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 Google Inc. 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 * OWNER 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. */ WebInspector.DOMSyntaxHighlighter = function(mimeType) { this._tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer(mimeType); } WebInspector.DOMSyntaxHighlighter.prototype = { createSpan: function(content, className) { var span = document.createElement("span"); span.className = "webkit-" + className; span.appendChild(document.createTextNode(content)); return span; }, syntaxHighlightNode: function(node) { this._tokenizer.condition = this._tokenizer.initialCondition; var lines = node.textContent.split("\n"); node.removeChildren(); for (var i = lines[0].length ? 0 : 1; i < lines.length; ++i) { var line = lines[i]; var plainTextStart = 0; this._tokenizer.line = line; var column = 0; do { var newColumn = this._tokenizer.nextToken(column); var tokenType = this._tokenizer.tokenType; if (tokenType) { if (column > plainTextStart) { var plainText = line.substring(plainTextStart, column); node.appendChild(document.createTextNode(plainText)); } var token = line.substring(column, newColumn); node.appendChild(this.createSpan(token, tokenType)); plainTextStart = newColumn; } column = newColumn; } while (column < line.length) if (plainTextStart < line.length) { var plainText = line.substring(plainTextStart, line.length); node.appendChild(document.createTextNode(plainText)); } if (i < lines.length - 1) node.appendChild(document.createElement("br")); } } }
JAMS-ITCR/MyConcert
site/node_modules/weinre/web/client/DOMSyntaxHighlighter.js
JavaScript
mit
3,431
/*! UIkit 2.1.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ .uk-notify{position:fixed;top:10px;left:10px;z-index:1030;-moz-box-sizing:border-box;box-sizing:border-box;width:350px}.uk-notify-top-right,.uk-notify-bottom-right{left:auto;right:10px}.uk-notify-top-center,.uk-notify-bottom-center{left:50%;margin-left:-175px}.uk-notify-bottom-left,.uk-notify-bottom-right,.uk-notify-bottom-center{top:auto;bottom:10px}@media (max-width:479px){.uk-notify{left:10px;right:10px;width:auto;margin:0}}.uk-notify-message{position:relative;margin-bottom:10px;padding:10px;background:#444;color:#fff;font-size:16px;line-height:22px;cursor:pointer;border:1px solid #444;border-radius:4px}.uk-notify-message>.uk-close{visibility:hidden;float:right}.uk-notify-message:hover>.uk-close{visibility:visible}.uk-notify-message-info{background:#ebf7fd;color:#2d7091;border-color:rgba(45,112,145,.3)}.uk-notify-message-success{background:#f2fae3;color:#659f13;border-color:rgba(101,159,19,.3)}.uk-notify-message-warning{background:#fffceb;color:#e28327;border-color:rgba(226,131,39,.3)}.uk-notify-message-danger{background:#fff1f0;color:#d85030;border-color:rgba(216,80,48,.3)}
Blueprint-Marketing/cdnjs
ajax/libs/uikit/2.1.0/addons/css/notify.gradient.min.css
CSS
mit
1,174
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Core\Tests\Authorization; use Symfony\Component\Security\Core\Authorization\ExpressionLanguage; use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver; use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken; use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\User\User; class ExpressionLanguageTest extends \PHPUnit_Framework_TestCase { /** * @dataProvider provider */ public function testIsAuthenticated($token, $expression, $result, array $roles = array()) { $anonymousTokenClass = 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\AnonymousToken'; $rememberMeTokenClass = 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\RememberMeToken'; $expressionLanguage = new ExpressionLanguage(); $trustResolver = new AuthenticationTrustResolver($anonymousTokenClass, $rememberMeTokenClass); $context = array(); $context['trust_resolver'] = $trustResolver; $context['token'] = $token; $context['roles'] = $roles; $this->assertEquals($result, $expressionLanguage->evaluate($expression, $context)); } public function provider() { $roles = array('ROLE_USER', 'ROLE_ADMIN'); $user = new User('username', 'password', $roles); $noToken = null; $anonymousToken = new AnonymousToken('firewall', 'anon.'); $rememberMeToken = new RememberMeToken($user, 'providerkey', 'firewall'); $usernamePasswordToken = new UsernamePasswordToken('username', 'password', 'providerkey', $roles); return array( array($noToken, 'is_anonymous()', false), array($noToken, 'is_authenticated()', false), array($noToken, 'is_fully_authenticated()', false), array($noToken, 'is_remember_me()', false), array($noToken, "has_role('ROLE_USER')", false), array($anonymousToken, 'is_anonymous()', true), array($anonymousToken, 'is_authenticated()', false), array($anonymousToken, 'is_fully_authenticated()', false), array($anonymousToken, 'is_remember_me()', false), array($anonymousToken, "has_role('ROLE_USER')", false), array($rememberMeToken, 'is_anonymous()', false), array($rememberMeToken, 'is_authenticated()', true), array($rememberMeToken, 'is_fully_authenticated()', false), array($rememberMeToken, 'is_remember_me()', true), array($rememberMeToken, "has_role('ROLE_FOO')", false, $roles), array($rememberMeToken, "has_role('ROLE_USER')", true, $roles), array($usernamePasswordToken, 'is_anonymous()', false), array($usernamePasswordToken, 'is_authenticated()', true), array($usernamePasswordToken, 'is_fully_authenticated()', true), array($usernamePasswordToken, 'is_remember_me()', false), array($usernamePasswordToken, "has_role('ROLE_FOO')", false, $roles), array($usernamePasswordToken, "has_role('ROLE_USER')", true, $roles), ); } }
PerChave/LoversLock
vendor/symfony/symfony/src/Symfony/Component/Security/Core/Tests/Authorization/ExpressionLanguageTest.php
PHP
mit
3,528
# This file comes from # https://github.com/martine/ninja/blob/master/misc/ninja_syntax.py # Do not edit! Edit the upstream one instead. """Python module for generating .ninja files. Note that this is emphatically not a required piece of Ninja; it's just a helpful utility for build-file-generation systems that already use Python. """ import textwrap import re def escape_path(word): return word.replace('$ ','$$ ').replace(' ','$ ').replace(':', '$:') class Writer(object): def __init__(self, output, width=78): self.output = output self.width = width def newline(self): self.output.write('\n') def comment(self, text): for line in textwrap.wrap(text, self.width - 2): self.output.write('# ' + line + '\n') def variable(self, key, value, indent=0): if value is None: return if isinstance(value, list): value = ' '.join(filter(None, value)) # Filter out empty strings. self._line('%s = %s' % (key, value), indent) def pool(self, name, depth): self._line('pool %s' % name) self.variable('depth', depth, indent=1) def rule(self, name, command, description=None, depfile=None, generator=False, pool=None, restat=False, rspfile=None, rspfile_content=None, deps=None): self._line('rule %s' % name) self.variable('command', command, indent=1) if description: self.variable('description', description, indent=1) if depfile: self.variable('depfile', depfile, indent=1) if generator: self.variable('generator', '1', indent=1) if pool: self.variable('pool', pool, indent=1) if restat: self.variable('restat', '1', indent=1) if rspfile: self.variable('rspfile', rspfile, indent=1) if rspfile_content: self.variable('rspfile_content', rspfile_content, indent=1) if deps: self.variable('deps', deps, indent=1) def build(self, outputs, rule, inputs=None, implicit=None, order_only=None, variables=None): outputs = self._as_list(outputs) all_inputs = self._as_list(inputs)[:] out_outputs = list(map(escape_path, outputs)) all_inputs = list(map(escape_path, all_inputs)) if implicit: implicit = map(escape_path, self._as_list(implicit)) all_inputs.append('|') all_inputs.extend(implicit) if order_only: order_only = map(escape_path, self._as_list(order_only)) all_inputs.append('||') all_inputs.extend(order_only) self._line('build %s: %s' % (' '.join(out_outputs), ' '.join([rule] + all_inputs))) if variables: if isinstance(variables, dict): iterator = iter(variables.items()) else: iterator = iter(variables) for key, val in iterator: self.variable(key, val, indent=1) return outputs def include(self, path): self._line('include %s' % path) def subninja(self, path): self._line('subninja %s' % path) def default(self, paths): self._line('default %s' % ' '.join(self._as_list(paths))) def _count_dollars_before_index(self, s, i): """Returns the number of '$' characters right in front of s[i].""" dollar_count = 0 dollar_index = i - 1 while dollar_index > 0 and s[dollar_index] == '$': dollar_count += 1 dollar_index -= 1 return dollar_count def _line(self, text, indent=0): """Write 'text' word-wrapped at self.width characters.""" leading_space = ' ' * indent while len(leading_space) + len(text) > self.width: # The text is too wide; wrap if possible. # Find the rightmost space that would obey our width constraint and # that's not an escaped space. available_space = self.width - len(leading_space) - len(' $') space = available_space while True: space = text.rfind(' ', 0, space) if space < 0 or \ self._count_dollars_before_index(text, space) % 2 == 0: break if space < 0: # No such space; just use the first unescaped space we can find. space = available_space - 1 while True: space = text.find(' ', space + 1) if space < 0 or \ self._count_dollars_before_index(text, space) % 2 == 0: break if space < 0: # Give up on breaking. break self.output.write(leading_space + text[0:space] + ' $\n') text = text[space+1:] # Subsequent lines are continuations, so indent them. leading_space = ' ' * (indent+2) self.output.write(leading_space + text + '\n') def _as_list(self, input): if input is None: return [] if isinstance(input, list): return input return [input] def escape(string): """Escape a string such that it can be embedded into a Ninja file without further interpretation.""" assert '\n' not in string, 'Ninja syntax does not allow newlines' # We only have one special metacharacter: '$'. return string.replace('$', '$$')
jonathanmz34/ztransfert
node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py
Python
mit
5,536
!function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; (function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a= b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a<f;++a){var h=b[a];if(/\\[bdsw]/i.test(h))c.push(h);else{var h=d(h),l;a+2<f&&"-"===b[a+1]?(l=d(b[a+2]),a+=2):l=h;e.push([h,l]);l<65||h>122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;a<e.length;++a)h=e[a],h[0]<=f[1]+1?f[1]=Math.max(f[1],h[1]):b.push(f=h);for(a=0;a<b.length;++a)h=b[a],c.push(g(h[0])), h[1]>h[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f<c;++f){var l=a[f];l==="("?++h:"\\"===l.charAt(0)&&(l=+l.substring(1))&&(l<=h?d[l]=-1:a[f]=g(l))}for(f=1;f<d.length;++f)-1===d[f]&&(d[f]=++x);for(h=f=0;f<c;++f)l=a[f],l==="("?(++h,d[h]||(a[f]="(?:")):"\\"===l.charAt(0)&&(l=+l.substring(1))&&l<=h&& (a[f]="\\"+d[l]);for(f=0;f<c;++f)"^"===a[f]&&"^"!==a[f+1]&&(a[f]="");if(e.ignoreCase&&m)for(f=0;f<c;++f)l=a[f],e=l.charAt(0),l.length>=2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k<c;++k){var i=a[k];if(i.ignoreCase)j=!0;else if(/[a-z]/i.test(i.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){m=!0;j=!1;break}}for(var r={b:8,t:9,n:10,v:11, f:12,r:13},n=[],k=0,c=a.length;k<c;++k){i=a[k];if(i.global||i.multiline)throw Error(""+i);n.push("(?:"+s(i)+")")}return RegExp(n.join("|"),j?"gi":"g")}function T(a,d){function g(a){var c=a.nodeType;if(c==1){if(!b.test(a.className)){for(c=a.firstChild;c;c=c.nextSibling)g(c);c=a.nodeName.toLowerCase();if("br"===c||"li"===c)s[j]="\n",m[j<<1]=x++,m[j++<<1|1]=a}}else if(c==3||c==4)c=a.nodeValue,c.length&&(c=d?c.replace(/\r\n?/g,"\n"):c.replace(/[\t\n\r ]+/g," "),s[j]=c,m[j<<1]=x,x+=c.length,m[j++<<1|1]= a)}var b=/(?:^|\s)nocode(?:\s|$)/,s=[],x=0,m=[],j=0;g(a);return{a:s.join("").replace(/\n$/,""),d:m}}function H(a,d,g,b){d&&(a={a:d,e:a},g(a),b.push.apply(b,a.g))}function U(a){for(var d=void 0,g=a.firstChild;g;g=g.nextSibling)var b=g.nodeType,d=b===1?d?a:g:b===3?V.test(g.nodeValue)?a:d:d;return d===a?void 0:d}function C(a,d){function g(a){for(var j=a.e,k=[j,"pln"],c=0,i=a.a.match(s)||[],r={},n=0,e=i.length;n<e;++n){var z=i[n],w=r[z],t=void 0,f;if(typeof w==="string")f=!1;else{var h=b[z.charAt(0)]; if(h)t=z.match(h[1]),w=h[0];else{for(f=0;f<x;++f)if(h=d[f],t=z.match(h[1])){w=h[0];break}t||(w="pln")}if((f=w.length>=5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c<i;++c){var r= g[c],n=r[3];if(n)for(var e=n.length;--e>=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com", /^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+ s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/, q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d= c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i<c.length;++i)b(c[i]);d===(d|0)&&c[0].setAttribute("value",d);var r=j.createElement("ol"); r.className="linenums";for(var d=Math.max(0,d-1|0)||0,i=0,n=c.length;i<n;++i)k=c[i],k.className="L"+(i+d)%10,k.firstChild||k.appendChild(j.createTextNode("\u00a0")),r.appendChild(k);a.appendChild(r)}function p(a,d){for(var g=d.length;--g>=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*</.test(d)?"default-markup":"default-code";return F[a]}function K(a){var d=a.h;try{var g=T(a.c,a.i),b=g.a; a.a=b;a.d=g.d;a.e=0;I(d,b)(a);var s=/\bMSIE\s(\d+)/.exec(navigator.userAgent),s=s&&+s[1]<=8,d=/\n/g,x=a.a,m=x.length,g=0,j=a.d,k=j.length,b=0,c=a.g,i=c.length,r=0;c[i]=m;var n,e;for(e=n=0;e<i;)c[e]!==c[e+2]?(c[n++]=c[e++],c[n++]=c[e++]):e+=2;i=n;for(e=n=0;e<i;){for(var p=c[e],w=c[e+1],t=e+2;t+2<=i&&c[t+1]===w;)t+=2;c[n++]=p;c[n++]=w;e=t}c.length=n;var f=a.c,h;if(f)h=f.style.display,f.style.display="none";try{for(;b<k;){var l=j[b+2]||m,B=c[r+2]||m,t=Math.min(l,B),A=j[b+1],G;if(A.nodeType!==1&&(G=x.substring(g, t))){s&&(G=G.replace(d,"\r"));A.nodeValue=G;var L=A.ownerDocument,o=L.createElement("span");o.className=c[r+1];var v=A.parentNode;v.replaceChild(o,A);o.appendChild(A);g<l&&(j[b+1]=A=L.createTextNode(x.substring(t,l)),v.insertBefore(A,o.nextSibling))}g=t;g>=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"], O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/, V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-", /^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);p(C([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/], ["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);p(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);p(v({keywords:M,hashComments:!0,cStyleComments:!0,types:R}),["c","cc","cpp","cxx","cyc","m"]);p(v({keywords:"null,true,false"}),["json"]);p(v({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:R}), ["cs"]);p(v({keywords:N,cStyleComments:!0}),["java"]);p(v({keywords:y,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);p(v({keywords:P,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);p(v({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);p(v({keywords:Q, hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);p(v({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);p(v({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);p(v({keywords:W,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]); p(C([],[["str",/^[\S\s]+/]]),["regex"]);var Y=D.PR={createSimpleLexer:C,registerLangHandler:p,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:D.prettyPrintOne=function(a,d,g){var b=document.createElement("div");b.innerHTML="<pre>"+a+"</pre>";b=b.firstChild;g&&J(b,g,!0);K({h:d,j:g,c:b,i:1}); return b.innerHTML},prettyPrint:D.prettyPrint=function(a,d){function g(){for(var b=D.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;i<p.length&&c.now()<b;i++){for(var d=p[i],j=h,k=d;k=k.previousSibling;){var m=k.nodeType,o=(m===7||m===8)&&k.nodeValue;if(o?!/^\??prettify\b/.test(o):m!==3||/\S/.test(k.nodeValue))break;if(o){j={};o.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(a,b,c){j[b]=c});break}}k=d.className;if((j!==h||e.test(k))&&!v.test(k)){m=!1;for(o=d.parentNode;o;o=o.parentNode)if(f.test(o.tagName)&& o.className&&e.test(o.className)){m=!0;break}if(!m){d.className+=" prettyprinted";m=j.lang;if(!m){var m=k.match(n),y;if(!m&&(y=U(d))&&t.test(y.tagName))m=y.className.match(n);m&&(m=m[1])}if(w.test(d.tagName))o=1;else var o=d.currentStyle,u=s.defaultView,o=(o=o?o.whiteSpace:u&&u.getComputedStyle?u.getComputedStyle(d,q).getPropertyValue("white-space"):0)&&"pre"===o.substring(0,3);u=j.linenums;if(!(u=u==="true"||+u))u=(u=k.match(/\blinenums\b(?::(\d+))?/))?u[1]&&u[1].length?+u[1]:!0:!1;u&&J(d,u,o);r= {h:m,c:d,j:u,i:o};K(r)}}}i<p.length?setTimeout(g,250):"function"===typeof a&&a()}for(var b=d||document.body,s=b.ownerDocument||document,b=[b.getElementsByTagName("pre"),b.getElementsByTagName("code"),b.getElementsByTagName("xmp")],p=[],m=0;m<b.length;++m)for(var j=0,k=b[m].length;j<k;++j)p.push(b[m][j]);var b=q,c=Date;c.now||(c={now:function(){return+new Date}});var i=0,r,n=/\blang(?:uage)?-([\w.]+)(?!\S)/,e=/\bprettyprint\b/,v=/\bprettyprinted\b/,w=/pre|xmp/i,t=/^code$/i,f=/^(?:pre|code|xmp)$/i, h={};g()}};typeof define==="function"&&define.amd&&define("google-code-prettify",[],function(){return Y})})();}()
como-quesito/angular-xeditable
libs/google-code-prettify/prettify.js
JavaScript
mit
14,551
YUI.add('text-accentfold', function (Y, NAME) { /** * Text utilities. * * @module text * @since 3.3.0 */ /** * Provides a basic accent folding implementation that converts common accented * letters (like "á") to their non-accented forms (like "a"). * * @module text * @submodule text-accentfold */ /** * <p> * Provides a basic accent folding implementation that converts common accented * letters (like "á") to their non-accented forms (like "a"). * </p> * * <p> * This implementation is not comprehensive, and should only be used as a last * resort when accent folding can't be done on the server. A comprehensive * accent folding implementation would require much more character data to be * sent to the browser, resulting in a significant performance penalty. This * implementation strives for a compromise between usefulness and performance. * </p> * * <p> * Accent folding is a destructive operation that can't be reversed, and may * change or destroy the actual meaning of the text depending on the language. * It should not be used on strings that will later be displayed to a user, * unless this is done with the understanding that linguistic meaning may be * lost and that you may in fact confuse or insult the user by doing so. * </p> * * <p> * When used for matching, accent folding is likely to produce erroneous matches * for languages in which characters with diacritics are considered different * from their base characters, or where correct folding would map to other * character sequences than just stripped characters. For example, in German * "ü" is a character that's clearly different from "u" and should match "ue" * instead. The word "betrügen" means "to defraud", while "betrugen" is the past * tense of "to behave". The name "Müller" is expected to match "Mueller", but * not "Muller". On the other hand, accent folding falls short for languages * where different base characters are expected to match. In Japanese, for * example, hiragana and katakana characters with the same pronunciation ("あ" * and "ア") are commonly treated as equivalent for lookups, but accent folding * treats them as different. * </p> * * @class Text.AccentFold * @static */ var YArray = Y.Array, Text = Y.Text, FoldData = Text.Data.AccentFold, AccentFold = { // -- Public Static Methods ------------------------------------------------ /** * Returns <code>true</code> if the specified string contains one or more * characters that can be folded, <code>false</code> otherwise. * * @method canFold * @param {String} string String to test. * @return {Boolean} * @static */ canFold: function (string) { var letter; for (letter in FoldData) { if (FoldData.hasOwnProperty(letter) && string.search(FoldData[letter]) !== -1) { return true; } } return false; }, /** * Compares the accent-folded versions of two strings and returns * <code>true</code> if they're the same, <code>false</code> otherwise. If * a custom comparison function is supplied, the accent-folded strings will * be passed to that function for comparison. * * @method compare * @param {String} a First string to compare. * @param {String} b Second string to compare. * @param {Function} func (optional) Custom comparison function. Should * return a truthy or falsy value. * @return {Boolean} Results of the comparison. * @static */ compare: function (a, b, func) { var aFolded = AccentFold.fold(a), bFolded = AccentFold.fold(b); return func ? !!func(aFolded, bFolded) : aFolded === bFolded; }, /** * <p> * Returns a copy of <em>haystack</em> containing only the strings for which * the supplied function returns <code>true</code>. * </p> * * <p> * While comparisons will be made using accent-folded strings, the returned * array of matches will contain the original strings that were passed in. * </p> * * @method filter * @param {Array} haystack Array of strings to filter. * @param {Function} func Comparison function. Will receive an accent-folded * haystack string as an argument, and should return a truthy or falsy * value. * @return {Array} Filtered copy of <em>haystack</em>. * @static */ filter: function (haystack, func) { return YArray.filter(haystack, function (item) { return func(AccentFold.fold(item)); }); }, /** * Accent-folds the specified string or array of strings and returns a copy * in which common accented letters have been converted to their closest * non-accented, lowercase forms. * * @method fold * @param {String|Array} input String or array of strings to be folded. * @return {String|Array} Folded string or array of strings. * @static */ fold: function (input) { if (Y.Lang.isArray(input)) { return YArray.map(input, AccentFold.fold); } input = input.toLowerCase(); Y.Object.each(FoldData, function (regex, letter) { input = input.replace(regex, letter); }); return input; } }; Text.AccentFold = AccentFold; }, '@VERSION@', {"requires": ["array-extras", "text-data-accentfold"]});
Dervisevic/cdnjs
ajax/libs/yui/3.7.0/text-accentfold/text-accentfold.js
JavaScript
mit
5,483
YUI.add('highlight-base', function (Y, NAME) { /** Provides methods for highlighting strings within other strings by wrapping them in HTML. @module highlight @submodule highlight-base @main @since 3.3.0 **/ /** Provides methods for highlighting strings within other strings by wrapping them in HTML. The highlight methods first escape any special HTML characters in the input strings and then highlight the appropriate substrings by wrapping them in a `<b class="yui3-highlight"></b>` element. The `<b>` element is used rather than `<strong>` in accordance with HTML5's definition of `<b>` as being purely presentational, which is exactly what highlighting is. @class Highlight @static **/ var YArray = Y.Array, Escape = Y.Escape, WordBreak = Y.Text.WordBreak, isArray = Y.Lang.isArray, EMPTY_OBJECT = {}, // Regex string that captures zero or one unclosed HTML entities. Used in // the static regex template properties below. The entity matching is // intentionally loose here, since there's a world of complexity involved in // doing strict matching for this use case. UNCLOSED_ENTITY = '(&[^;\\s]*)?', Highlight = { // -- Protected Static Properties ------------------------------------------ /** Regular expression template for highlighting a match that occurs anywhere in a string. The placeholder `%needles` will be replaced with a list of needles to match, joined by `|` characters. This regex should have two capturing subpatterns: 1. Zero or one unclosed HTML entity (e.g. "&amp" without a ";" at the end). 2. The `%needles` placeholder. The first subpattern match is used to emulate a negative lookbehind assertion in order to prevent highlighting inside HTML entities. @property _REGEX @type String @protected @static @final **/ _REGEX: UNCLOSED_ENTITY + '(%needles)', /** Regex replacer function or string for normal matches. @property _REPLACER @type Function|String @protected @static @final **/ _REPLACER: function (match, p1, p2) { // Mimicking a negative lookbehind assertion to prevent matches inside // HTML entities. Hat tip to Steven Levithan for the technique: // http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript return p1 && !(/\s/).test(p2) ? match : Highlight._TEMPLATE.replace(/\{s\}/g, p2); }, /** Regular expression template for highlighting start-of-string matches (i.e., only matches that occur at the beginning of a string). The placeholder `%needles` will be replaced with a list of needles to match, joined by `|` characters. See `_REGEX` for a description of the capturing subpatterns this regex string should contain. @property _START_REGEX @type String @protected @static @final */ _START_REGEX: '^' + UNCLOSED_ENTITY + '(%needles)', /** Highlight template which will be used as a replacement for matched substrings. The placeholder `{s}` will be replaced with the matched substring. @property _TEMPLATE @type String @default '<b class="yui3-highlight">{s}</b>' @protected @static @final **/ _TEMPLATE: '<b class="' + Y.ClassNameManager.getClassName('highlight') + '">{s}</b>', // -- Public Static Methods ------------------------------------------------ /** Highlights all occurrences in the _haystack_ string of the items in the _needles_ array, regardless of where they occur. The returned string will have all HTML characters escaped except for the highlighting markup. @method all @param {String} haystack String to apply highlighting to. @param {String|String[]} needles String or array of strings that should be highlighted. @param {Object} [options] Options object. @param {Boolean} [options.caseSensitive=false] If `true`, matching will be case-sensitive. @param {Boolean} [options.startsWith=false] If `true`, matches must be anchored to the beginning of the string. @return {String} Escaped and highlighted copy of _haystack_. @static **/ all: function (haystack, needles, options) { var validNeedles = [], esc, i, len, needle, regex, replacer; if (!options) { options = EMPTY_OBJECT; } // TODO: document options.replacer esc = options.escapeHTML !== false; regex = options.startsWith ? Highlight._START_REGEX : Highlight._REGEX; replacer = options.replacer || Highlight._REPLACER; needles = isArray(needles) ? needles : [needles]; // Escape HTML characters and special regular expression characters in // the needles so they can be used in a regex and matched against the // escaped haystack. for (i = 0, len = needles.length; i < len; ++i) { needle = needles[i]; if (needle) { validNeedles.push(Escape.regex(esc ? Escape.html(needle) : needle)); } } // Escape HTML characters in the haystack to prevent HTML injection. if (esc) { haystack = Escape.html(haystack); } // No point continuing if there are no needles. if (!validNeedles.length) { return haystack; } return haystack.replace( new RegExp( regex.replace('%needles', validNeedles.join('|')), options.caseSensitive ? 'g' : 'gi' ), replacer ); }, /** Same as `all()`, but case-sensitive by default. @method allCase @param {String} haystack String to apply highlighting to. @param {String|String[]} needles String or array of strings that should be highlighted. @param {Object} [options] Options object. See `all()` for details. @return {String} Escaped and highlighted copy of _haystack_. @static **/ allCase: function (haystack, needles, options) { return Highlight.all(haystack, needles, Y.merge(options || EMPTY_OBJECT, {caseSensitive: true})); }, /** Highlights _needles_ that occur at the start of _haystack_. The returned string will have all HTML characters escaped except for the highlighting markup. @method start @param {String} haystack String to apply highlighting to. @param {String|String[]} needles String or array of strings that should be highlighted. @param {Object} [options] Options object. @param {Boolean} [options.caseSensitive=false] If `true`, matching will be case-sensitive. @return {String} Escaped and highlighted copy of _haystack_. @static **/ start: function (haystack, needles, options) { return Highlight.all(haystack, needles, Y.merge(options || EMPTY_OBJECT, {startsWith: true})); }, /** Same as `start()`, but case-sensitive by default. @method startCase @param {String} haystack String to apply highlighting to. @param {String|String[]} needles String or array of strings that should be highlighted. @return {String} Escaped and highlighted copy of _haystack_. @static **/ startCase: function (haystack, needles) { // No options passthru for now, since it would be redundant. If start() // ever supports more options than caseSensitive, then we'll start // passing the options through. return Highlight.start(haystack, needles, {caseSensitive: true}); }, /** Highlights complete words in the _haystack_ string that are also in the _needles_ array. The returned string will have all HTML characters escaped except for the highlighting markup. @method words @param {String} haystack String to apply highlighting to. @param {String|String[]} needles String or array of strings containing words that should be highlighted. If a string is passed, it will be split into words; if an array is passed, it is assumed to have already been split. @param {Object} [options] Options object. @param {Boolean} [options.caseSensitive=false] If `true`, matching will be case-sensitive. @return {String} Escaped and highlighted copy of _haystack_. @static **/ words: function (haystack, needles, options) { var caseSensitive, mapper, template = Highlight._TEMPLATE, words; if (!options) { options = EMPTY_OBJECT; } caseSensitive = !!options.caseSensitive; // Convert needles to a hash for faster lookups. needles = YArray.hash( isArray(needles) ? needles : WordBreak.getUniqueWords(needles, { ignoreCase: !caseSensitive }) ); // The default word mapping function can be overridden with a custom // one. This is used to implement accent-folded highlighting in the // highlight-accentfold module. mapper = options.mapper || function (word, needles) { if (needles.hasOwnProperty(caseSensitive ? word : word.toLowerCase())) { return template.replace(/\{s\}/g, Escape.html(word)); } return Escape.html(word); }; // Split the haystack into an array of words, including punctuation and // whitespace so we can rebuild the string later. words = WordBreak.getWords(haystack, { includePunctuation: true, includeWhitespace : true }); return YArray.map(words, function (word) { return mapper(word, needles); }).join(''); }, /** Same as `words()`, but case-sensitive by default. @method wordsCase @param {String} haystack String to apply highlighting to. @param {String|String[]} needles String or array of strings containing words that should be highlighted. If a string is passed, it will be split into words; if an array is passed, it is assumed to have already been split. @return {String} Escaped and highlighted copy of _haystack_. @static **/ wordsCase: function (haystack, needles) { // No options passthru for now, since it would be redundant. If words() // ever supports more options than caseSensitive, then we'll start // passing the options through. return Highlight.words(haystack, needles, {caseSensitive: true}); } }; Y.Highlight = Highlight; }, '@VERSION@', {"requires": ["array-extras", "classnamemanager", "escape", "text-wordbreak"]});
magoni/cdnjs
ajax/libs/yui/3.10.0pr1/highlight-base/highlight-base-debug.js
JavaScript
mit
10,734
YUI.add('highlight-base', function (Y, NAME) { /** Provides methods for highlighting strings within other strings by wrapping them in HTML. @module highlight @submodule highlight-base @main @since 3.3.0 **/ /** Provides methods for highlighting strings within other strings by wrapping them in HTML. The highlight methods first escape any special HTML characters in the input strings and then highlight the appropriate substrings by wrapping them in a `<b class="yui3-highlight"></b>` element. The `<b>` element is used rather than `<strong>` in accordance with HTML5's definition of `<b>` as being purely presentational, which is exactly what highlighting is. @class Highlight @static **/ var YArray = Y.Array, Escape = Y.Escape, WordBreak = Y.Text.WordBreak, isArray = Y.Lang.isArray, EMPTY_OBJECT = {}, // Regex string that captures zero or one unclosed HTML entities. Used in // the static regex template properties below. The entity matching is // intentionally loose here, since there's a world of complexity involved in // doing strict matching for this use case. UNCLOSED_ENTITY = '(&[^;\\s]*)?', Highlight = { // -- Protected Static Properties ------------------------------------------ /** Regular expression template for highlighting a match that occurs anywhere in a string. The placeholder `%needles` will be replaced with a list of needles to match, joined by `|` characters. This regex should have two capturing subpatterns: 1. Zero or one unclosed HTML entity (e.g. "&amp" without a ";" at the end). 2. The `%needles` placeholder. The first subpattern match is used to emulate a negative lookbehind assertion in order to prevent highlighting inside HTML entities. @property _REGEX @type String @protected @static @final **/ _REGEX: UNCLOSED_ENTITY + '(%needles)', /** Regex replacer function or string for normal matches. @property _REPLACER @type Function|String @protected @static @final **/ _REPLACER: function (match, p1, p2) { // Mimicking a negative lookbehind assertion to prevent matches inside // HTML entities. Hat tip to Steven Levithan for the technique: // http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript return p1 && !(/\s/).test(p2) ? match : Highlight._TEMPLATE.replace(/\{s\}/g, p2); }, /** Regular expression template for highlighting start-of-string matches (i.e., only matches that occur at the beginning of a string). The placeholder `%needles` will be replaced with a list of needles to match, joined by `|` characters. See `_REGEX` for a description of the capturing subpatterns this regex string should contain. @property _START_REGEX @type String @protected @static @final */ _START_REGEX: '^' + UNCLOSED_ENTITY + '(%needles)', /** Highlight template which will be used as a replacement for matched substrings. The placeholder `{s}` will be replaced with the matched substring. @property _TEMPLATE @type String @default '<b class="yui3-highlight">{s}</b>' @protected @static @final **/ _TEMPLATE: '<b class="' + Y.ClassNameManager.getClassName('highlight') + '">{s}</b>', // -- Public Static Methods ------------------------------------------------ /** Highlights all occurrences in the _haystack_ string of the items in the _needles_ array, regardless of where they occur. The returned string will have all HTML characters escaped except for the highlighting markup. @method all @param {String} haystack String to apply highlighting to. @param {String|String[]} needles String or array of strings that should be highlighted. @param {Object} [options] Options object. @param {Boolean} [options.caseSensitive=false] If `true`, matching will be case-sensitive. @param {Boolean} [options.startsWith=false] If `true`, matches must be anchored to the beginning of the string. @return {String} Escaped and highlighted copy of _haystack_. @static **/ all: function (haystack, needles, options) { var validNeedles = [], esc, i, len, needle, regex, replacer; if (!options) { options = EMPTY_OBJECT; } // TODO: document options.replacer esc = options.escapeHTML !== false; regex = options.startsWith ? Highlight._START_REGEX : Highlight._REGEX; replacer = options.replacer || Highlight._REPLACER; needles = isArray(needles) ? needles : [needles]; // Escape HTML characters and special regular expression characters in // the needles so they can be used in a regex and matched against the // escaped haystack. for (i = 0, len = needles.length; i < len; ++i) { needle = needles[i]; if (needle) { validNeedles.push(Escape.regex(esc ? Escape.html(needle) : needle)); } } // Escape HTML characters in the haystack to prevent HTML injection. if (esc) { haystack = Escape.html(haystack); } // No point continuing if there are no needles. if (!validNeedles.length) { return haystack; } return haystack.replace( new RegExp( regex.replace('%needles', validNeedles.join('|')), options.caseSensitive ? 'g' : 'gi' ), replacer ); }, /** Same as `all()`, but case-sensitive by default. @method allCase @param {String} haystack String to apply highlighting to. @param {String|String[]} needles String or array of strings that should be highlighted. @param {Object} [options] Options object. See `all()` for details. @return {String} Escaped and highlighted copy of _haystack_. @static **/ allCase: function (haystack, needles, options) { return Highlight.all(haystack, needles, Y.merge(options || EMPTY_OBJECT, {caseSensitive: true})); }, /** Highlights _needles_ that occur at the start of _haystack_. The returned string will have all HTML characters escaped except for the highlighting markup. @method start @param {String} haystack String to apply highlighting to. @param {String|String[]} needles String or array of strings that should be highlighted. @param {Object} [options] Options object. @param {Boolean} [options.caseSensitive=false] If `true`, matching will be case-sensitive. @return {String} Escaped and highlighted copy of _haystack_. @static **/ start: function (haystack, needles, options) { return Highlight.all(haystack, needles, Y.merge(options || EMPTY_OBJECT, {startsWith: true})); }, /** Same as `start()`, but case-sensitive by default. @method startCase @param {String} haystack String to apply highlighting to. @param {String|String[]} needles String or array of strings that should be highlighted. @return {String} Escaped and highlighted copy of _haystack_. @static **/ startCase: function (haystack, needles) { // No options passthru for now, since it would be redundant. If start() // ever supports more options than caseSensitive, then we'll start // passing the options through. return Highlight.start(haystack, needles, {caseSensitive: true}); }, /** Highlights complete words in the _haystack_ string that are also in the _needles_ array. The returned string will have all HTML characters escaped except for the highlighting markup. @method words @param {String} haystack String to apply highlighting to. @param {String|String[]} needles String or array of strings containing words that should be highlighted. If a string is passed, it will be split into words; if an array is passed, it is assumed to have already been split. @param {Object} [options] Options object. @param {Boolean} [options.caseSensitive=false] If `true`, matching will be case-sensitive. @return {String} Escaped and highlighted copy of _haystack_. @static **/ words: function (haystack, needles, options) { var caseSensitive, mapper, template = Highlight._TEMPLATE, words; if (!options) { options = EMPTY_OBJECT; } caseSensitive = !!options.caseSensitive; // Convert needles to a hash for faster lookups. needles = YArray.hash( isArray(needles) ? needles : WordBreak.getUniqueWords(needles, { ignoreCase: !caseSensitive }) ); // The default word mapping function can be overridden with a custom // one. This is used to implement accent-folded highlighting in the // highlight-accentfold module. mapper = options.mapper || function (word, needles) { if (needles.hasOwnProperty(caseSensitive ? word : word.toLowerCase())) { return template.replace(/\{s\}/g, Escape.html(word)); } return Escape.html(word); }; // Split the haystack into an array of words, including punctuation and // whitespace so we can rebuild the string later. words = WordBreak.getWords(haystack, { includePunctuation: true, includeWhitespace : true }); return YArray.map(words, function (word) { return mapper(word, needles); }).join(''); }, /** Same as `words()`, but case-sensitive by default. @method wordsCase @param {String} haystack String to apply highlighting to. @param {String|String[]} needles String or array of strings containing words that should be highlighted. If a string is passed, it will be split into words; if an array is passed, it is assumed to have already been split. @return {String} Escaped and highlighted copy of _haystack_. @static **/ wordsCase: function (haystack, needles) { // No options passthru for now, since it would be redundant. If words() // ever supports more options than caseSensitive, then we'll start // passing the options through. return Highlight.words(haystack, needles, {caseSensitive: true}); } }; Y.Highlight = Highlight; }, '@VERSION@', {"requires": ["array-extras", "classnamemanager", "escape", "text-wordbreak"]});
cgvarela/cdnjs
ajax/libs/yui/3.9.0pr2/highlight-base/highlight-base-debug.js
JavaScript
mit
10,734
YUI.add('intl', function (Y, NAME) { var _mods = {}, ROOT_LANG = "yuiRootLang", ACTIVE_LANG = "yuiActiveLang", NONE = []; /** * Provides utilities to support the management of localized resources (strings and formatting patterns). * * @module intl */ /** * The Intl utility provides a central location for managing sets of localized resources (strings and formatting patterns). * * @class Intl * @uses EventTarget * @static */ Y.mix(Y.namespace("Intl"), { /** * Private method to retrieve the language hash for a given module. * * @method _mod * @private * * @param {String} module The name of the module * @return {Object} The hash of localized resources for the module, keyed by BCP language tag */ _mod : function(module) { if (!_mods[module]) { _mods[module] = {}; } return _mods[module]; }, /** * Sets the active language for the given module. * * Returns false on failure, which would happen if the language had not been registered through the <a href="#method_add">add()</a> method. * * @method setLang * * @param {String} module The module name. * @param {String} lang The BCP 47 language tag. * @return boolean true if successful, false if not. */ setLang : function(module, lang) { var langs = this._mod(module), currLang = langs[ACTIVE_LANG], exists = !!langs[lang]; if (exists && lang !== currLang) { langs[ACTIVE_LANG] = lang; this.fire("intl:langChange", {module: module, prevVal: currLang, newVal: (lang === ROOT_LANG) ? "" : lang}); } return exists; }, /** * Get the currently active language for the given module. * * @method getLang * * @param {String} module The module name. * @return {String} The BCP 47 language tag. */ getLang : function(module) { var lang = this._mod(module)[ACTIVE_LANG]; return (lang === ROOT_LANG) ? "" : lang; }, /** * Register a hash of localized resources for the given module and language * * @method add * * @param {String} module The module name. * @param {String} lang The BCP 47 language tag. * @param {Object} strings The hash of localized values, keyed by the string name. */ add : function(module, lang, strings) { lang = lang || ROOT_LANG; this._mod(module)[lang] = strings; this.setLang(module, lang); }, /** * Gets the module's localized resources for the currently active language (as provided by the <a href="#method_getLang">getLang</a> method). * <p> * Optionally, the localized resources for alternate languages which have been added to Intl (see the <a href="#method_add">add</a> method) can * be retrieved by providing the BCP 47 language tag as the lang parameter. * </p> * @method get * * @param {String} module The module name. * @param {String} key Optional. A single resource key. If not provided, returns a copy (shallow clone) of all resources. * @param {String} lang Optional. The BCP 47 language tag. If not provided, the module's currently active language is used. * @return String | Object A copy of the module's localized resources, or a single value if key is provided. */ get : function(module, key, lang) { var mod = this._mod(module), strs; lang = lang || mod[ACTIVE_LANG]; strs = mod[lang] || {}; return (key) ? strs[key] : Y.merge(strs); }, /** * Gets the list of languages for which localized resources are available for a given module, based on the module * meta-data (part of loader). If loader is not on the page, returns an empty array. * * @method getAvailableLangs * @param {String} module The name of the module * @return {Array} The array of languages available. */ getAvailableLangs : function(module) { var loader = Y.Env._loader, mod = loader && loader.moduleInfo[module], langs = mod && mod.lang; return (langs) ? langs.concat() : NONE; } }); Y.augment(Y.Intl, Y.EventTarget); /** * Notification event to indicate when the lang for a module has changed. There is no default behavior associated with this event, * so the on and after moments are equivalent. * * @event intl:langChange * @param {EventFacade} e The event facade * <p>The event facade contains:</p> * <dl> * <dt>module</dt><dd>The name of the module for which the language changed</dd> * <dt>newVal</dt><dd>The new language tag</dd> * <dt>prevVal</dt><dd>The current language tag</dd> * </dl> */ Y.Intl.publish("intl:langChange", {emitFacade:true}); }, '@VERSION@', {"requires": ["intl-base", "event-custom"]});
arasmussen/cdnjs
ajax/libs/yui/3.14.0/intl/intl-debug.js
JavaScript
mit
4,908
YUI.add('autocomplete-filters', function (Y, NAME) { /** Provides pre-built result matching filters for AutoComplete. @module autocomplete @submodule autocomplete-filters @class AutoCompleteFilters @static **/ var YArray = Y.Array, YObject = Y.Object, WordBreak = Y.Text.WordBreak, Filters = Y.mix(Y.namespace('AutoCompleteFilters'), { // -- Public Methods ------------------------------------------------------- /** Returns an array of results that contain all of the characters in the query, in any order (not necessarily consecutive). Case-insensitive. @method charMatch @param {String} query Query to match @param {Array} results Results to filter @return {Array} Filtered results @static **/ charMatch: function (query, results, caseSensitive) { // The caseSensitive parameter is only intended for use by // charMatchCase(). It's intentionally undocumented. if (!query) { return results; } var queryChars = YArray.unique((caseSensitive ? query : query.toLowerCase()).split('')); return YArray.filter(results, function (result) { result = result.text; if (!caseSensitive) { result = result.toLowerCase(); } return YArray.every(queryChars, function (chr) { return result.indexOf(chr) !== -1; }); }); }, /** Case-sensitive version of `charMatch()`. @method charMatchCase @param {String} query Query to match @param {Array} results Results to filter @return {Array} Filtered results @static **/ charMatchCase: function (query, results) { return Filters.charMatch(query, results, true); }, /** Returns an array of results that contain the complete query as a phrase. Case-insensitive. @method phraseMatch @param {String} query Query to match @param {Array} results Results to filter @return {Array} Filtered results @static **/ phraseMatch: function (query, results, caseSensitive) { // The caseSensitive parameter is only intended for use by // phraseMatchCase(). It's intentionally undocumented. if (!query) { return results; } if (!caseSensitive) { query = query.toLowerCase(); } return YArray.filter(results, function (result) { return (caseSensitive ? result.text : result.text.toLowerCase()).indexOf(query) !== -1; }); }, /** Case-sensitive version of `phraseMatch()`. @method phraseMatchCase @param {String} query Query to match @param {Array} results Results to filter @return {Array} Filtered results @static **/ phraseMatchCase: function (query, results) { return Filters.phraseMatch(query, results, true); }, /** Returns an array of results that start with the complete query as a phrase. Case-insensitive. @method startsWith @param {String} query Query to match @param {Array} results Results to filter @return {Array} Filtered results @static **/ startsWith: function (query, results, caseSensitive) { // The caseSensitive parameter is only intended for use by // startsWithCase(). It's intentionally undocumented. if (!query) { return results; } if (!caseSensitive) { query = query.toLowerCase(); } return YArray.filter(results, function (result) { return (caseSensitive ? result.text : result.text.toLowerCase()).indexOf(query) === 0; }); }, /** Case-sensitive version of `startsWith()`. @method startsWithCase @param {String} query Query to match @param {Array} results Results to filter @return {Array} Filtered results @static **/ startsWithCase: function (query, results) { return Filters.startsWith(query, results, true); }, /** Returns an array of results in which all the words of the query match either whole words or parts of words in the result. Non-word characters like whitespace and certain punctuation are ignored. Case-insensitive. This is basically a combination of `wordMatch()` (by ignoring whitespace and word order) and `phraseMatch()` (by allowing partial matching instead of requiring the entire word to match). Example use case: Trying to find personal names independently of name order (Western or Eastern order) and supporting immediate feedback by allowing partial occurences. So queries like "J. Doe", "Doe, John", and "J. D." would all match "John Doe". @method subWordMatch @param {String} query Query to match @param {Array} results Results to filter @return {Array} Filtered results @static **/ subWordMatch: function (query, results, caseSensitive) { // The caseSensitive parameter is only intended for use by // subWordMatchCase(). It's intentionally undocumented. if (!query) { return results; } var queryWords = WordBreak.getUniqueWords(query, { ignoreCase: !caseSensitive }); return YArray.filter(results, function (result) { var resultText = caseSensitive ? result.text : result.text.toLowerCase(); return YArray.every(queryWords, function (queryWord) { return resultText.indexOf(queryWord) !== -1; }); }); }, /** Case-sensitive version of `subWordMatch()`. @method subWordMatchCase @param {String} query Query to match @param {Array} results Results to filter @return {Array} Filtered results @static **/ subWordMatchCase: function (query, results) { return Filters.subWordMatch(query, results, true); }, /** Returns an array of results that contain all of the words in the query, in any order. Non-word characters like whitespace and certain punctuation are ignored. Case-insensitive. @method wordMatch @param {String} query Query to match @param {Array} results Results to filter @return {Array} Filtered results @static **/ wordMatch: function (query, results, caseSensitive) { // The caseSensitive parameter is only intended for use by // wordMatchCase(). It's intentionally undocumented. if (!query) { return results; } var options = {ignoreCase: !caseSensitive}, queryWords = WordBreak.getUniqueWords(query, options); return YArray.filter(results, function (result) { // Convert resultWords array to a hash for fast lookup. var resultWords = YArray.hash(WordBreak.getUniqueWords(result.text, options)); return YArray.every(queryWords, function (word) { return YObject.owns(resultWords, word); }); }); }, /** Case-sensitive version of `wordMatch()`. @method wordMatchCase @param {String} query Query to match @param {Array} results Results to filter @return {Array} Filtered results @static **/ wordMatchCase: function (query, results) { return Filters.wordMatch(query, results, true); } }); }, '@VERSION@', {"requires": ["array-extras", "text-wordbreak"]});
dhenson02/cdnjs
ajax/libs/yui/3.8.0pr2/autocomplete-filters/autocomplete-filters-debug.js
JavaScript
mit
7,395
/** * @author zz85 / http://www.lab4games.net/zz85/blog * * Two pass Gaussian blur filter (horizontal and vertical blur shaders) * - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/ * and used in http://www.cake23.de/traveling-wavefronts-lit-up.html * * - 9 samples per pass * - standard deviation 2.7 * - "h" and "v" parameters should be set to "1 / width" and "1 / height" */ THREE.HorizontalBlurShader = { uniforms: { "tDiffuse": { value: null }, "h": { value: 1.0 / 512.0 } }, vertexShader: [ "varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" ].join( "\n" ), fragmentShader: [ "uniform sampler2D tDiffuse;", "uniform float h;", "varying vec2 vUv;", "void main() {", "vec4 sum = vec4( 0.0 );", "sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;", "sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;", "sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;", "sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;", "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;", "sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;", "sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;", "sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;", "sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;", "gl_FragColor = sum;", "}" ].join( "\n" ) };
MichaelHazani/Dropbox-3D
bower_components/three.js/examples/js/shaders/HorizontalBlurShader.js
JavaScript
mit
1,617
/*! UIkit 2.13.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ .uk-htmleditor-navbar{background:#f5f5f5;border:1px solid rgba(0,0,0,.06);border-top-left-radius:4px;border-top-right-radius:4px}.uk-htmleditor-navbar:after,.uk-htmleditor-navbar:before{content:" ";display:table}.uk-htmleditor-navbar:after{clear:both}.uk-htmleditor-navbar-nav{margin:0;padding:0;list-style:none;float:left}.uk-htmleditor-navbar-nav>li{float:left}.uk-htmleditor-navbar-nav>li>a{display:block;-moz-box-sizing:border-box;box-sizing:border-box;text-decoration:none;height:41px;padding:0 15px;line-height:40px;color:#444;font-size:11px;cursor:pointer;margin-top:-1px;margin-left:-1px;border:1px solid transparent;border-bottom-width:0;text-shadow:0 1px 0 #fff}.uk-htmleditor-navbar-nav>li:hover>a,.uk-htmleditor-navbar-nav>li>a:focus{background-color:#fafafa;color:#444;outline:0;position:relative;z-index:1;border-left-color:rgba(0,0,0,.1);border-right-color:rgba(0,0,0,.1);border-top-color:rgba(0,0,0,.1)}.uk-htmleditor-navbar-nav>li>a:active{background-color:#eee;color:#444;border-left-color:rgba(0,0,0,.1);border-right-color:rgba(0,0,0,.1);border-top-color:rgba(0,0,0,.2)}.uk-htmleditor-navbar-nav>li.uk-active>a{background-color:#fafafa;color:#444;border-left-color:rgba(0,0,0,.1);border-right-color:rgba(0,0,0,.1);border-top-color:rgba(0,0,0,.1)}.uk-htmleditor-navbar-flip{float:right}[data-mode=split] .uk-htmleditor-button-code,[data-mode=split] .uk-htmleditor-button-preview{display:none}.uk-htmleditor-content{border-left:1px solid #ddd;border-right:1px solid #ddd;border-bottom:1px solid #ddd;background:#fff;border-bottom-left-radius:4px;border-bottom-right-radius:4px}.uk-htmleditor-content:after,.uk-htmleditor-content:before{content:" ";display:table}.uk-htmleditor-content:after{clear:both}.uk-htmleditor-fullscreen{position:fixed;top:0;left:0;right:0;bottom:0;z-index:990}.uk-htmleditor-fullscreen .uk-htmleditor-content{position:absolute;top:41px;left:0;right:0;bottom:0}.uk-htmleditor-fullscreen .uk-icon-expand:before{content:"\f066"}.uk-htmleditor-code,.uk-htmleditor-preview{-moz-box-sizing:border-box;box-sizing:border-box}.uk-htmleditor-preview{padding:20px;overflow-y:scroll;position:relative}[data-mode=tab][data-active-tab=code] .uk-htmleditor-preview,[data-mode=tab][data-active-tab=preview] .uk-htmleditor-code{display:none}[data-mode=split] .uk-htmleditor-code,[data-mode=split] .uk-htmleditor-preview{float:left;width:50%}[data-mode=split] .uk-htmleditor-code{border-right:1px solid #eee}.uk-htmleditor-iframe{position:absolute;top:0;left:0;width:100%;height:100%}.uk-htmleditor .CodeMirror{padding:10px;-moz-box-sizing:border-box;box-sizing:border-box}.uk-htmleditor-navbar-nav:first-child>li:first-child>a{border-top-left-radius:4px}.uk-htmleditor-navbar-flip .uk-htmleditor-navbar-nav>li>a{margin-left:0;margin-right:-1px}.uk-htmleditor-navbar-flip .uk-htmleditor-navbar-nav:first-child>li:first-child>a{border-top-left-radius:0}.uk-htmleditor-navbar-flip .uk-htmleditor-navbar-nav:last-child>li:last-child>a{border-top-right-radius:4px}.uk-htmleditor-fullscreen .uk-htmleditor-navbar{border-top:none;border-left:none;border-right:none;border-radius:0}.uk-htmleditor-fullscreen .uk-htmleditor-content{border:none;border-radius:0}.uk-htmleditor-fullscreen .uk-htmleditor-navbar-nav>li>a{border-radius:0!important}
tunnckoCore/jsdelivr
files/uikit/2.13.0/css/components/htmleditor.almost-flat.min.css
CSS
mit
3,339
!function(){var e="undefined"!=typeof process&&process.versions&&process.versions.node,t=!e&&("undefined"!=typeof window||"undefined"!=typeof self);t&&"undefined"==typeof global&&("undefined"!=typeof window?global=window:"undefined"!=typeof self?global=self:"undefined"!=typeof $&&(global=$));var n=function(n){function r(){}function a(e){for(var t=[],n=Object.keys(e).sort(),r=0;r<n.length;++r){var a=n[r],o=e[a];_(o)||(o=[o]);for(var i=0;i<o.length;++i){var l=o[i];if(!F(l))throw new Ct("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:e});t.push({"@value":l,"@language":a.toLowerCase()})}}return t}function o(e,t){if(_(t))for(var n=0;n<t.length;++n)t[n]=o(e,t[n]);else if(G(t))t["@list"]=o(e,t["@list"]);else if(J(t)){Y(t)&&(t["@id"]=e.getName(t["@id"]));for(var r=Object.keys(t).sort(),a=0;a<r.length;++a){var i=r[a];"@id"!==i&&(t[i]=o(e,t[i]))}}return t}function i(e,t,r){if(null===r)return null;var a=E(e,t,{vocab:!0});if("@id"===a)return E(e,r,{base:!0});if("@type"===a)return E(e,r,{vocab:!0,base:!0});var o=n.getContextValue(e,t,"@type");if("@id"===o||"@graph"===a&&F(r))return{"@id":E(e,r,{base:!0})};if("@vocab"===o)return{"@id":E(e,r,{vocab:!0,base:!0})};if(U(a))return r;if(rval={},null!==o)rval["@type"]=o;else if(F(r)){var i=n.getContextValue(e,t,"@language");null!==i&&(rval["@language"]=i)}return rval["@value"]=r,rval}function l(e,t,n){for(var r=[],a=Object.keys(e).sort(),o=0;o<a.length;++o)for(var i=a[o],l=e[i],c=Object.keys(l).sort(),d=0;d<c.length;++d){var f=c[d],p=l[f];if("@type"===f)f=jt;else if(U(f))continue;for(var v=0;v<p.length;++v){var h=p[v],g={};if(g.type=0===i.indexOf("_:")?"blank node":"IRI",g.value=i,Z(i)){var m={};if(m.type=0===f.indexOf("_:")?"blank node":"IRI",m.value=f,Z(f)&&("blank node"!==m.type||n.produceGeneralizedRdf))if(G(h))u(h["@list"],t,g,m,r);else{var y=s(h);y&&r.push({subject:g,predicate:m,object:y})}}}}return r}function u(e,t,n,r,a){for(var o={type:"IRI",value:xt},i={type:"IRI",value:bt},l={type:"IRI",value:wt},u=0;u<e.length;++u){var c=e[u],d={type:"blank node",value:t.getName()};a.push({subject:n,predicate:r,object:d}),n=d,r=o;var f=s(c);f&&a.push({subject:n,predicate:r,object:f}),r=i}a.push({subject:n,predicate:r,object:l})}function s(e){var t={};if($(e)){t.type="literal";var n=e["@value"],r=e["@type"]||null;M(n)?(t.value=n.toString(),t.datatype=r||pt):z(n)||r===vt?(t.value=n.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),t.datatype=r||vt):P(n)?(t.value=n.toFixed(0),t.datatype=r||ht):"@language"in e?(t.value=n,t.datatype=r||St,t.language=e["@language"]):(t.value=n,t.datatype=r||gt)}else{var a=J(e)?e["@id"]:e;t.type=0===a.indexOf("_:")?"blank node":"IRI",t.value=a}return"IRI"!==t.type||Z(t.value)?t:null}function c(e,t){if("IRI"===e.type||"blank node"===e.type)return{"@id":e.value};var n={"@value":e.value};if("language"in e)n["@language"]=e.language;else{var r=e.datatype;if(t){if(r===pt)"true"===n["@value"]?n["@value"]=!0:"false"===n["@value"]&&(n["@value"]=!1);else if(q(n["@value"]))if(r===ht){var a=parseInt(n["@value"]);a.toFixed(0)===n["@value"]&&(n["@value"]=a)}else r===vt&&(n["@value"]=parseFloat(n["@value"]));-1===[pt,ht,vt,gt].indexOf(r)&&(n["@type"]=r)}else r!==gt&&(n["@type"]=r)}return n}function d(e,t){for(var n=["subject","predicate","object"],r=0;r<n.length;++r){var a=n[r];if(e[a].type!==t[a].type||e[a].value!==t[a].value)return!1}return e.object.language!==t.object.language?!1:e.object.datatype!==t.object.datatype?!1:!0}function f(e,t){if("hash"in t[e])return t[e].hash;for(var n=t[e].quads,r=[],a=0;a<n.length;++a)r.push(nt(n[a],n[a].name?n[a].name.value:null,e));r.sort();var o=t[e].hash=kt.hash(r);return o}function p(e,t,r,a,o){function i(o){if(o===d.length)return u=Object.keys(c).sort(),l(0);var s=d[o],p=v(s.subject,e),h=null;if(null!==p?h="p":(p=v(s.object,e),null!==p&&(h="r")),null!==p){var g;g=r.isNamed(p)?r.getName(p):a.isNamed(p)?a.getName(p):f(p,t,r);var m=kt.create();m.update(h),m.update(s.predicate.value),m.update(g);var y=m.digest();y in c?c[y].push(p):c[y]=[p]}n.setImmediate(function(){i(o+1)})}function l(e){function i(){function u(e){if(e===y.length)return c(!1);var n=y[e];p(n,t,r,g,function(t,r){return t?o(t):(m+=g.getName(n)+"<"+r.hash+">",g=r.pathNamer,null!==f&&m.length>=f.length&&m>f?c(!0):void u(e+1))})}function c(t){!t&&(null===f||f>m)&&(f=m,v=g),h.hasNext()?n.setImmediate(function(){i()}):(s.update(f),a=v,l(e+1))}var d=h.next(),g=a.clone(),m="",y=[];for(var x in d){var b=d[x];if(r.isNamed(b)?m+=r.getName(b):(g.isNamed(b)||y.push(b),m+=g.getName(b)),null!==f&&m.length>=f.length&&m>f)return c(!0)}u(0)}if(e===u.length)return o(null,{hash:s.digest(),pathNamer:a});var d=u[e];s.update(d);var f=null,v=null,h=new Permutator(c[d]);n.setImmediate(function(){i()})}var u,s=kt.create(),c={},d=t[e].quads;n.setImmediate(function(){i(0)})}function v(e,t){return"blank node"===e.type&&e.value!==t?e.value:null}function h(e,t,r,a,o,i){if(_(e))for(var l=0;l<e.length;++l)h(e[l],t,r,a,void 0,i);else{if(!J(e))return void(i&&i.push(e));if($(e)){if("@type"in e){var u=e["@type"];0===u.indexOf("_:")&&(e["@type"]=u=a.getName(u))}return void(i&&i.push(e))}if("@type"in e)for(var s=e["@type"],l=0;l<s.length;++l){var u=s[l];0===u.indexOf("_:")&&a.getName(u)}H(o)&&(o=Y(e)?a.getName(e["@id"]):e["@id"]),i&&i.push({"@id":o});var c=t[r],d=c[o]=c[o]||{};d["@id"]=o;for(var f=Object.keys(e).sort(),p=0;p<f.length;++p){var v=f[p];if("@id"!==v)if("@reverse"!==v)if("@graph"!==v)if("@type"!==v&&U(v)){if("@index"===v&&"@index"in d)throw new Ct("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:d});d[v]=e[v]}else{var g=e[v];if(0===v.indexOf("_:")&&(v=a.getName(v)),0!==g.length)for(var m=0;m<g.length;++m){var y=g[m];if("@type"===v&&(y=0===y.indexOf("_:")?a.getName(y):y),B(y)||X(y)){var x=Y(y)?a.getName(y["@id"]):y["@id"];n.addValue(d,v,{"@id":x},{propertyIsArray:!0,allowDuplicate:!1}),h(y,t,r,a,x)}else if(G(y)){var b=[];h(y["@list"],t,r,a,o,b),y={"@list":b},n.addValue(d,v,y,{propertyIsArray:!0,allowDuplicate:!1})}else h(y,t,r,a,o),n.addValue(d,v,y,{propertyIsArray:!0,allowDuplicate:!1})}else n.addValue(d,v,[],{propertyIsArray:!0})}else{o in t||(t[o]={});var w="@merged"===r?r:o;h(e[v],t,w,a)}else{var j={"@id":o},I=e["@reverse"];for(var O in I)for(var L=I[O],S=0;S<L.length;++S){var D=L[S];n.addValue(D,O,j,{propertyIsArray:!0,allowDuplicate:!1}),h(D,t,r,a)}}}}}function g(e,t,r,a,o){y(e,r),r=r[0];var i=x(e,t,r),l=e.options,u=m(r,l,"embed"),s=m(r,l,"explicit"),c=Object.keys(i).sort();for(var d in c){var f=c[d];null===o&&(e.embeds={});var p={};p["@id"]=f;var v={parent:a,property:o};if(u&&f in e.embeds){u=!1;var h=e.embeds[f];if(_(h.parent)){for(var b=0;b<h.parent.length;++b)if(n.compareValues(p,h.parent[b])){u=!0;break}}else n.hasValue(h.parent,h.property,p)&&(u=!0);u&&j(e,f)}if(u){e.embeds[f]=v;for(var O=i[f],L=Object.keys(O).sort(),b=0;b<L.length;b++){var S=L[b];if(U(S))p[S]=Q(O[S]);else if(S in r)for(var D=O[S],N=0;N<D.length;++N){var C=D[N];if(G(C)){var E={"@list":[]};I(e,p,S,E);var k=C["@list"];for(var R in k)C=k[R],X(C)?g(e,[C["@id"]],r[S][0]["@list"],E,"@list"):I(e,E,"@list",Q(C))}else X(C)?g(e,[C["@id"]],r[S],p,S):I(e,p,S,Q(C))}else s||w(e,O,S,p)}for(var L=Object.keys(r).sort(),b=0;b<L.length;++b){var S=L[b];if(!U(S)){var T=r[S][0],J=m(T,l,"omitDefault");if(!(J||S in p)){var A="@null";"@default"in T&&(A=Q(T["@default"])),_(A)||(A=[A]),p[S]=[{"@preserve":A}]}}}I(e,a,o,p)}else I(e,a,o,p)}}function m(e,t,n){var r="@"+n;return r in e?e[r][0]:t[n]}function y(e,t){if(!_(t)||1!==t.length||!J(t[0]))throw new Ct("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:t})}function x(e,t,n){for(var r={},a=0;a<t.length;++a){var o=t[a],i=e.subjects[o];b(i,n)&&(r[o]=i)}return r}function b(e,t){if("@type"in t&&(1!==t["@type"].length||!J(t["@type"][0]))){for(var r=t["@type"],a=0;a<r.length;++a)if(n.hasValue(e,"@type",r[a]))return!0;return!1}for(var o in t)if(!("@id"!==o&&U(o)||o in e))return!1;return!0}function w(e,t,n,r){for(var a=t[n],o=0;o<a.length;++o){var i=a[o];if(G(i)){var l={"@list":[]};return I(e,r,n,l),w(e,i,"@list",l["@list"])}if(X(i)){var u=i["@id"];if(!(u in e.embeds)){var s={parent:r,property:n};e.embeds[u]=s,i={};var c=e.subjects[u];for(var d in c)U(d)?i[d]=Q(c[d]):w(e,c,d,i)}I(e,r,n,i)}else I(e,r,n,Q(i))}}function j(e,t){var r=e.embeds,a=r[t],o=a.parent,i=a.property,l={"@id":t};if(_(o)){for(var u=0;u<o.length;++u)if(n.compareValues(o[u],l)){o[u]=l;break}}else{var s=_(o[i]);n.removeValue(o,i,l,{propertyIsArray:s}),n.addValue(o,i,l,{propertyIsArray:s})}var c=function(e){for(var t=Object.keys(r),n=0;n<t.length;++n){var a=t[n];a in r&&J(r[a].parent)&&r[a].parent["@id"]===e&&(delete r[a],c(a))}};c(t)}function I(e,t,r,a){J(t)?n.addValue(t,r,a,{propertyIsArray:!0}):t.push(a)}function O(e,t,r){if(_(t)){for(var a=[],o=0;o<t.length;++o){var i=O(e,t[o],r);null!==i&&a.push(i)}t=a}else if(J(t)){if("@preserve"in t)return"@null"===t["@preserve"]?null:t["@preserve"];if($(t))return t;if(G(t))return t["@list"]=O(e,t["@list"],r),t;for(var l in t){var i=O(e,t[l],r),u=n.getContextValue(e,l,"@container");r.compactArrays&&_(i)&&1===i.length&&null===u&&(i=i[0]),t[l]=i}}return t}function L(e,t){return e.length<t.length?-1:t.length<e.length?1:e===t?0:t>e?-1:1}function S(e,t,n,r,a,o){null===o&&(o="@null");var i=[];if("@id"!==o&&"@reverse"!==o||!X(n))i.push(o);else{"@reverse"===o&&i.push("@reverse");var l=D(e,n["@id"],null,{vocab:!0});l in e.mappings&&e.mappings[l]&&e.mappings[l]["@id"]===n["@id"]?i.push.apply(i,["@vocab","@id"]):i.push.apply(i,["@id","@vocab"])}i.push("@none");for(var u=e.inverse[t],s=0;s<r.length;++s){var c=r[s];if(c in u)for(var d=u[c][a],f=0;f<i.length;++f){var p=i[f];if(p in d)return d[p]}}return null}function D(e,t,n,r,a){if(null===t)return t;if(H(n)&&(n=null),H(a)&&(a=!1),r=r||{},U(t)&&(r.vocab=!0),r.vocab&&t in e.getInverse()){var o=e["@language"]||"@none",i=[];J(n)&&"@index"in n&&i.push("@index");var l="@language",u="@null";if(a)l="@type",u="@reverse",i.push("@set");else if(G(n)){"@index"in n||i.push("@list");for(var s=n["@list"],c=0===s.length?o:null,d=null,f=0;f<s.length;++f){var p=s[f],v="@none",h="@none";if($(p)?"@language"in p?v=p["@language"]:"@type"in p?h=p["@type"]:v="@null":h="@id",null===c?c=v:v!==c&&$(p)&&(c="@none"),null===d?d=h:h!==d&&(d="@none"),"@none"===c&&"@none"===d)break}c=c||"@none",d=d||"@none","@none"!==d?(l="@type",u=d):u=c}else $(n)?"@language"in n&&!("@index"in n)?(i.push("@language"),u=n["@language"]):"@type"in n&&(l="@type",u=n["@type"]):(l="@type",u="@id"),i.push("@set");i.push("@none");var g=S(e,t,n,i,l,u);if(null!==g)return g}if(r.vocab&&"@vocab"in e){var m=e["@vocab"];if(0===t.indexOf(m)&&t!==m){var y=t.substr(m.length);if(!(y in e.mappings))return y}}var x=null;for(var g in e.mappings)if(-1===g.indexOf(":")){var b=e.mappings[g];if(b&&b["@id"]!==t&&0===t.indexOf(b["@id"])){var w=g+":"+t.substr(b["@id"].length),j=!(w in e.mappings)||null===n&&e.mappings[w]&&e.mappings[w]["@id"]===t;j&&(null===x||L(w,x)<0)&&(x=w)}}return null!==x?x:r.vocab?t:R(e["@base"],t)}function N(e,t,r){if($(r)){var a=n.getContextValue(e,t,"@type"),o=n.getContextValue(e,t,"@language"),i=n.getContextValue(e,t,"@container"),l="@index"in r&&"@index"!==i;if(!l&&(r["@type"]===a||r["@language"]===o))return r["@value"];var u=Object.keys(r).length,s=1===u||2===u&&"@index"in r&&!l,c="@language"in e,d=F(r["@value"]),f=e.mappings[t]&&null===e.mappings[t]["@language"];if(s&&(!c||!d||f))return r["@value"];var p={};return l&&(p[D(e,"@index")]=r["@index"]),"@type"in r?p[D(e,"@type")]=D(e,r["@type"],null,{vocab:!0}):"@language"in r&&(p[D(e,"@language")]=r["@language"]),p[D(e,"@value")]=r["@value"],p}var v=E(e,t,{vocab:!0}),a=n.getContextValue(e,t,"@type"),h=D(e,r["@id"],null,{vocab:"@vocab"===a});if("@id"===a||"@vocab"===a||"@graph"===v)return h;var p={};return p[D(e,"@id")]=h,p}function C(e,t,n,r){if(n in r){if(r[n])return;throw new Ct("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:t,term:n})}if(r[n]=!1,U(n))throw new Ct("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t});e.mappings[n]&&delete e.mappings[n];var a=t[n];if(null===a||J(a)&&null===a["@id"])return e.mappings[n]=null,void(r[n]=!0);if(F(a)&&(a={"@id":a}),!J(a))throw new Ct("Invalid JSON-LD syntax; @context property values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:t});var o=e.mappings[n]={};if(o.reverse=!1,"@reverse"in a){if("@id"in a)throw new Ct("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});var i=a["@reverse"];if(!F(i))throw new Ct("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});var l=E(e,i,{vocab:!0,base:!1},t,r);if(!Z(l))throw new Ct("Invalid JSON-LD syntax; a @context @reverse value must be an IRI or a blank node identifier.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});o["@id"]=l,o.reverse=!0}else if("@id"in a){var l=a["@id"];if(!F(l))throw new Ct("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});l!==n&&(o["@id"]=E(e,l,{vocab:!0,base:!1},t,r))}if(!("@id"in o)){var u=n.indexOf(":");if(-1!==u){var s=n.substr(0,u);if(s in t&&C(e,t,s,r),e.mappings[s]){var c=n.substr(u+1);o["@id"]=e.mappings[s]["@id"]+c}else o["@id"]=n}else{if(!("@vocab"in e))throw new Ct("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t,term:n});o["@id"]=e["@vocab"]+n}}if(r[n]=!0,"@type"in a){var d=a["@type"];if(!F(d))throw new Ct("Invalid JSON-LD syntax; an @context @type values must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if("@id"!==d&&"@vocab"!==d){if(d=E(e,d,{vocab:!0,base:!1},t,r),!Z(d))throw new Ct("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if(0===d.indexOf("_:"))throw new Ct("Invalid JSON-LD syntax; an @context @type values must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}o["@type"]=d}if("@container"in a){var f=a["@container"];if("@list"!==f&&"@set"!==f&&"@index"!==f&&"@language"!==f)throw new Ct("Invalid JSON-LD syntax; @context @container value must be one of the following: @list, @set, @index, or @language.","jsonld.SyntaxError",{code:"invalid container mapping",context:t});if(o.reverse&&"@index"!==f&&"@set"!==f&&null!==f)throw new Ct("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});o["@container"]=f}if("@language"in a&&!("@type"in a)){var p=a["@language"];if(null!==p&&!F(p))throw new Ct("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:t});null!==p&&(p=p.toLowerCase()),o["@language"]=p}var l=o["@id"];if("@context"===l||"@preserve"===l)throw new Ct("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:t})}function E(e,t,n,r,a){if(null===t||U(t))return t;if(r&&t in r&&a[t]!==!0&&C(e,r,t,a),n=n||{},n.vocab){var o=e.mappings[t];if(null===o)return null;if(o)return o["@id"]}var i=t.indexOf(":");if(-1!==i){var l=t.substr(0,i),u=t.substr(i+1);if("_"===l||0===u.indexOf("//"))return t;r&&l in r&&C(e,r,l,a);var o=e.mappings[l];return o?o["@id"]+u:t}if(n.vocab&&"@vocab"in e)return e["@vocab"]+t;var s=t;if(n.base&&(s=k(e["@base"],s)),r&&!Z(s))throw new Ct("Invalid JSON-LD syntax; a @context value does not expand to an absolute IRI.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:r,value:t});return s}function k(e,t){if(-1!==t.indexOf(":"))return t;F(e)&&(e=n.url.parse(e||""));var r=n.url.parse(t),a=e.protocol||"";r.authority?a+="//"+r.authority:""!==e.href&&(a+="//"+e.authority);var o;0===r.pathname.indexOf("/")?o=r.pathname:(o=e.pathname,""!==r.pathname&&(o=o.substr(0,o.lastIndexOf("/")+1),o.length>0&&"/"!==o.substr(-1)&&(o+="/"),o+=r.pathname)),o=lt(o,""!==a),r.query&&(o+="?"+r.query),r.hash&&(o+=r.hash);var i=a+o;return""===i&&(i="./"),i}function R(e,t){F(e)&&(e=n.url.parse(e||""));var r="";if(""!==e.href?r+=(e.protocol||"")+"//"+e.authority:t.indexOf("//")&&(r+="//"),0!==t.indexOf(r))return t;for(var a=n.url.parse(t.substr(r.length)),o=e.normalizedPath.split("/"),i=a.normalizedPath.split("/");o.length>0&&i.length>0&&o[0]===i[0];)o.shift(),i.shift();var l="";if(o.length>0){("/"!==e.normalizedPath.substr(-1)||""===o[0])&&o.pop();for(var u=0;u<o.length;++u)l+="../"}return l+=i.join("/"),a.query&&(l+="?"+a.query),a.hash&&(l+=a.hash),""===l&&(l="./"),l}function T(e){function t(){var e=this;if(e.inverse)return e.inverse;for(var t=e.inverse={},n=e["@language"]||"@none",a=e.mappings,o=Object.keys(a).sort(L),i=0;i<o.length;++i){var l=o[i],u=a[l];if(null!==u){var s=u["@container"]||"@none",c=u["@id"];_(c)||(c=[c]);for(var d=0;d<c.length;++d){var f=c[d],p=t[f];if(p||(t[f]=p={}),p[s]||(p[s]={"@language":{},"@type":{}}),p=p[s],u.reverse)r(u,l,p["@type"],"@reverse");else if("@type"in u)r(u,l,p["@type"],u["@type"]);else if("@language"in u){var v=u["@language"]||"@null";r(u,l,p["@language"],v)}else r(u,l,p["@language"],n),r(u,l,p["@type"],"@none"),r(u,l,p["@language"],"@none")}}}return t}function r(e,t,n,r){r in n||(n[r]=t)}function a(){var e={};return e["@base"]=this["@base"],e.mappings=Q(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,"@language"in this&&(e["@language"]=this["@language"]),"@vocab"in this&&(e["@vocab"]=this["@vocab"]),e}var o=n.url.parse(e.base||"");return{"@base":o,mappings:{},inverse:null,getInverse:t,clone:a}}function U(e){if(!F(e))return!1;switch(e){case"@base":case"@context":case"@container":case"@default":case"@embed":case"@explicit":case"@graph":case"@id":case"@index":case"@language":case"@list":case"@omitDefault":case"@preserve":case"@reverse":case"@set":case"@type":case"@value":case"@vocab":return!0}return!1}function J(e){return"[object Object]"===Object.prototype.toString.call(e)}function A(e){return J(e)&&0===Object.keys(e).length}function _(e){return Array.isArray(e)}function V(e){if(!F(e)&&!A(e)){var t=!1;if(_(e)){t=!0;for(var n=0;n<e.length;++n)if(!F(e[n])){t=!1;break}}if(!t)throw new Ct('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, or an empty object.',"jsonld.SyntaxError",{code:"invalid type value",value:e})}}function F(e){return"string"==typeof e||"[object String]"===Object.prototype.toString.call(e)}function P(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function z(e){return P(e)&&-1!==String(e).indexOf(".")}function q(e){return!isNaN(parseFloat(e))&&isFinite(e)}function M(e){return"boolean"==typeof e||"[object Boolean]"===Object.prototype.toString.call(e)}function H(e){return"undefined"==typeof e}function B(e){var t=!1;if(J(e)&&!("@value"in e||"@set"in e||"@list"in e)){var n=Object.keys(e).length;t=n>1||!("@id"in e)}return t}function X(e){return J(e)&&1===Object.keys(e).length&&"@id"in e}function $(e){return J(e)&&"@value"in e}function G(e){return J(e)&&"@list"in e}function Y(e){var t=!1;return J(e)&&(t="@id"in e?0===e["@id"].indexOf("_:"):0===Object.keys(e).length||!("@value"in e||"@set"in e||"@list"in e)),t}function Z(e){return F(e)&&-1!==e.indexOf(":")}function Q(e){if(e&&"object"==typeof e){var t;if(_(e)){t=[];for(var n=0;n<e.length;++n)t[n]=Q(e[n])}else{t={};for(var r in e)t[r]=Q(e[r])}return t}return e}function K(e,t,n,r){var a=Object.keys(t).length;if(_(e)){for(var o=0;o<e.length;++o)K(e[o],t,n,r);return a<Object.keys(t).length}if(J(e)){for(var i in e)if("@context"===i){var l=e[i];if(_(l))for(var u=l.length,o=0;u>o;++o){var s=l[o];F(s)&&(s=k(r,s),n?(s=t[s],_(s)?(Array.prototype.splice.apply(l,[o,1].concat(s)),o+=s.length,u+=s.length):l[o]=s):s in t||(t[s]=!1))}else F(l)&&(l=k(r,l),n?e[i]=t[l]:l in t||(t[l]=!1))}else K(e[i],t,n,r);return a<Object.keys(t).length}return!1}function W(e,t,n){var r=null,a=/(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/,o=t.documentLoader,i=function(e,t,n,o,l){if(Object.keys(t).length>Nt)return r=new Ct("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"loading remote context failed",max:Nt}),l(r);var u={},s=function(){K(e,u,!0,o),l(null,e)};K(e,u,!1,o)||s();var c=[];for(var d in u)if(u[d]===!1){if(!a.test(d))return r=new Ct("Malformed URL.","jsonld.InvalidUrl",{code:"loading remote context failed",url:d}),l(r);c.push(d)}for(var f=c.length,p=0;p<c.length;++p)!function(e){if(e in t)return r=new Ct("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"recursive context inclusion",url:e}),l(r);var a=Q(t);a[e]=!0,n(e,function(t,o){if(!r){var c=o.document;if(!t&&F(c))try{c=JSON.parse(c)}catch(d){t=d}if(t?t=new Ct("Derefencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.","jsonld.InvalidUrl",{code:"loading remote context failed",url:e,cause:t}):J(c)||(t=new Ct("Derefencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.","jsonld.InvalidUrl",{code:"invalid remote context",url:e,cause:t})),t)return r=t,l(r);c="@context"in c?{"@context":c["@context"]}:{"@context":{}},o.contextUrl&&(_(c["@context"])||(c["@context"]=[c["@context"]]),c["@context"].push(o.contextUrl)),i(c,a,n,e,function(t,n){return t?l(t):(u[e]=n["@context"],f-=1,void(0===f&&s()))})}})}(c[p])};i(e,{},o,t.base,n)}function et(e){for(var t="(?:<([^:]+:[^>]*)>)",n="(_:(?:[A-Za-z][A-Za-z0-9]*))",r='"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"',a="(?:\\^\\^"+t+")",o="(?:@([a-z]+(?:-[a-z0-9]+)*))",i="(?:"+r+"(?:"+a+"|"+o+")?)",l="[ \\t]+",u="[ \\t]*",s=/(?:\r\n)|(?:\n)|(?:\r)/g,c=new RegExp("^"+u+"$"),f="(?:"+t+"|"+n+")"+l,p=t+l,v="(?:"+t+"|"+n+"|"+i+")"+u,h="(?:\\.|(?:(?:"+t+"|"+n+")"+u+"\\.))",g=new RegExp("^"+u+f+p+v+h+u+"$"),m={},y=e.split(s),x=0,b=0;b<y.length;++b){var w=y[b];if(x++,!c.test(w)){var j=w.match(g);if(null===j)throw new Ct("Error while parsing N-Quads; invalid quad.","jsonld.ParseError",{line:x});var I={};if(I.subject=H(j[1])?{type:"blank node",value:j[2]}:{type:"IRI",value:j[1]},I.predicate={type:"IRI",value:j[3]},H(j[4]))if(H(j[5])){I.object={type:"literal"},H(j[7])?H(j[8])?I.object.datatype=gt:(I.object.datatype=St,I.object.language=j[8]):I.object.datatype=j[7];var O=j[6].replace(/\\"/g,'"').replace(/\\t/g," ").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\\\/g,"\\");I.object.value=O}else I.object={type:"blank node",value:j[5]};else I.object={type:"IRI",value:j[4]};var L="@default";if(H(j[9])?H(j[10])||(L=j[10]):L=j[9],L in m){for(var S=!0,D=m[L],N=0;S&&N<D.length;++N)d(D[N],I)&&(S=!1);S&&D.push(I)}else m[L]=[I]}}return m}function tt(e){var t=[];for(var n in e)for(var r=e[n],a=0;a<r.length;++a){var o=r[a];"@default"===n&&(n=null),t.push(nt(o,n))}return t.sort(),t.join("")}function nt(e,t,n){var r=e.subject,a=e.predicate,o=e.object,i=t,l="";if(l+="IRI"===r.type?"<"+r.value+">":n?r.value===n?"_:a":"_:z":r.value,l+=" ",l+="IRI"===a.type?"<"+a.value+">":n?"_:p":a.value,l+=" ","IRI"===o.type)l+="<"+o.value+">";else if("blank node"===o.type)l+=n?o.value===n?"_:a":"_:z":o.value;else{var u=o.value.replace(/\\/g,"\\\\").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\"/g,'\\"');l+='"'+u+'"',o.datatype===St?o.language&&(l+="@"+o.language):o.datatype!==gt&&(l+="^^<"+o.datatype+">")}return null!==i&&(l+=0!==i.indexOf("_:")?" <"+i+">":n?" _:g":" "+i),l+=" .\n"}function rt(e){var t={};t["@default"]=[];for(var n=e.getSubjects(),r=0;r<n.length;++r){var a=n[r];if(null!==a){var o=e.getSubjectTriples(a);if(null!==o){var i=o.predicates;for(var l in i)for(var u=i[l].objects,s=0;s<u.length;++s){var c=u[s],d={};d.subject=0===a.indexOf("_:")?{type:"blank node",value:a}:{type:"IRI",value:a},d.predicate=0===l.indexOf("_:")?{type:"blank node",value:l}:{type:"IRI",value:l};var f=c.value;if(c.type===Ot){dt||ot();var p=new dt;f="";for(var v=0;v<c.value.length;v++)c.value[v].nodeType===ft.ELEMENT_NODE?f+=p.serializeToString(c.value[v]):c.value[v].nodeType===ft.TEXT_NODE&&(f+=c.value[v].nodeValue)}d.object={},c.type===Lt?d.object.type=0===c.value.indexOf("_:")?"blank node":"IRI":(d.object.type="literal",c.type===It?c.language?(d.object.datatype=St,d.object.language=c.language):d.object.datatype=gt:d.object.datatype=c.type),d.object.value=f,t["@default"].push(d)}}}}return t}function at(e){this.prefix=e,this.counter=0,this.existing={}}function ot(){dt=require("xmldom").XMLSerializer}function it(e){if(-1!==e.href.indexOf(":")||0!==e.href.indexOf("//")||e.host)e.authority=e.host||"",e.auth&&(e.authority=e.auth+"@"+e.authority);else{e.pathname=e.pathname.substr(2);var t=e.pathname.indexOf("/");-1===t?(e.authority=e.pathname,e.pathname=""):(e.authority=e.pathname.substr(0,t),e.pathname=e.pathname.substr(t))}}function lt(e,t){var n="";0===e.indexOf("/")&&(n="/");for(var r=e.split("/"),a=[];r.length>0;)"."===r[0]||""===r[0]&&r.length>1?r.shift():".."!==r[0]?a.push(r.shift()):(r.shift(),t||a.length>0&&".."!==a[a.length-1]?a.pop():a.push(".."));return n+a.join("/")}n.compact=function(e,t,r,a){function o(e,n,r,o){if(e)return a(e);o.compactArrays&&!o.graph&&_(n)?1===n.length?n=n[0]:0===n.length&&(n={}):o.graph&&J(n)&&(n=[n]),J(t)&&"@context"in t&&(t=t["@context"]),t=Q(t),_(t)||(t=[t]);var i=t;t=[];for(var l=0;l<i.length;++l)(!J(i[l])||Object.keys(i[l]).length>0)&&t.push(i[l]);var u=t.length>0;if(1===t.length&&(t=t[0]),_(n)){var s=D(r,"@graph"),c=n;n={},u&&(n["@context"]=t),n[s]=c}else if(J(n)&&u){var c=n;n={"@context":t};for(var d in c)n[d]=c[d]}a(null,n,r)}if(arguments.length<2)return n.nextTick(function(){a(new TypeError("Could not compact, too few arguments."))});if("function"==typeof r&&(a=r,r={}),r=r||{},null===t)return n.nextTick(function(){a(new Ct("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"}))});if(null===e)return n.nextTick(function(){a(null,null)});"base"in r||(r.base="string"==typeof e?e:""),"compactArrays"in r||(r.compactArrays=!0),"graph"in r||(r.graph=!1),"skipExpansion"in r||(r.skipExpansion=!1),"documentLoader"in r||(r.documentLoader=n.loadDocument);var i=function(e,t,r){n.nextTick(function(){return t.skipExpansion?r(null,e):void n.expand(e,t,r)})};i(e,r,function(e,i){if(e)return a(new Ct("Could not expand input before compaction.","jsonld.CompactError",{cause:e}));var l=T(r);n.processContext(l,t,r,function(e,t){if(e)return a(new Ct("Could not process context before compaction.","jsonld.CompactError",{cause:e}));try{var n=(new Et).compact(t,null,i,r)}catch(l){return a(l)}o(null,n,t,r)})})},n.expand=function(e,t,r){function a(e){"base"in t||(t.base=e.documentUrl||"");var n={document:Q(e.document),remoteContext:{"@context":e.contextUrl}};if("expandContext"in t){var a=Q(t.expandContext);n.expandContext="object"==typeof a&&"@context"in a?a:{"@context":a}}W(n,t,function(e,n){if(e)return r(e);try{var a=new Et,o=T(t),i=n.document,l=n.remoteContext["@context"];n.expandContext&&(o=a.processContext(o,n.expandContext["@context"],t)),l&&(o=a.processContext(o,l,t));var u=a.expand(o,null,i,t,!1);J(u)&&"@graph"in u&&1===Object.keys(u).length?u=u["@graph"]:null===u&&(u=[]),_(u)||(u=[u])}catch(s){return r(s)}r(null,u)})}return arguments.length<1?n.nextTick(function(){r(new TypeError("Could not expand, too few arguments."))}):("function"==typeof t&&(r=t,t={}),t=t||{},"documentLoader"in t||(t.documentLoader=n.loadDocument),"keepFreeFloatingNodes"in t||(t.keepFreeFloatingNodes=!1),void n.nextTick(function(){return"string"==typeof e?t.documentLoader(e,function(e,t){if(e)return r(e);try{if(!t.document)throw new Ct("No remote document found at the given URL.","jsonld.NullRemoteDocument");"string"==typeof t.document&&(t.document=JSON.parse(t.document))}catch(n){return r(new Ct("Could not retrieve a JSON-LD document from the URL. URL derefencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",cause:n,remoteDoc:t}))}a(t)}):void a({contextUrl:null,documentUrl:null,document:e})}))},n.flatten=function(e,t,r,a){return arguments.length<1?n.nextTick(function(){a(new TypeError("Could not flatten, too few arguments."))}):("function"==typeof r&&(a=r,r={}),r=r||{},"base"in r||(r.base="string"==typeof e?e:""),"documentLoader"in r||(r.documentLoader=n.loadDocument),void n.expand(e,r,function(e,o){if(e)return a(new Ct("Could not expand input before flattening.","jsonld.FlattenError",{cause:e}));try{var i=(new Et).flatten(o)}catch(l){return a(l)}return null===t?a(null,i):(r.graph=!0,r.skipExpansion=!0,void n.compact(i,t,r,function(e,t){return e?a(new Ct("Could not compact flattened output.","jsonld.FlattenError",{cause:e})):void a(null,t)}))}))},n.frame=function(e,t,r,a){function o(t){var o=t.document;if(o){var i=o["@context"]||{};t.contextUrl&&(i?_(i)?i.push[t.contextUrl]:i=[i,t.contextUrl]:i=t.contextUrl,o["@context"]=i)}else i={};n.expand(e,r,function(e,t){if(e)return a(new Ct("Could not expand input before framing.","jsonld.FrameError",{cause:e}));var l=Q(r);l.isFrame=!0,l.keepFreeFloatingNodes=!0,n.expand(o,l,function(e,r){if(e)return a(new Ct("Could not expand frame before framing.","jsonld.FrameError",{cause:e}));try{var o=(new Et).frame(t,r,l)}catch(u){return a(u)}l.graph=!0,l.skipExpansion=!0,n.compact(o,i,l,function(e,t,n){if(e)return a(new Ct("Could not compact framed output.","jsonld.FrameError",{cause:e}));var r=D(n,"@graph");t[r]=O(n,t[r],l),a(null,t)})})})}return arguments.length<2?n.nextTick(function(){a(new TypeError("Could not frame, too few arguments."))}):("function"==typeof r&&(a=r,r={}),r=r||{},"base"in r||(r.base="string"==typeof e?e:""),"documentLoader"in r||(r.documentLoader=n.loadDocument),"embed"in r||(r.embed=!0),r.explicit=r.explicit||!1,r.omitDefault=r.omitDefault||!1,void n.nextTick(function(){return"string"==typeof t?r.documentLoader(t,function(e,t){if(e)return a(e);try{if(!t.document)throw new Ct("No remote document found at the given URL.","jsonld.NullRemoteDocument");"string"==typeof t.document&&(t.document=JSON.parse(t.document))}catch(n){return a(new Ct("Could not retrieve a JSON-LD document from the URL. URL derefencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",cause:n,remoteDoc:t}))}o(t)}):void o({contextUrl:null,documentUrl:null,document:t})}))},n.objectify=function(e,t,r,a){"function"==typeof r&&(a=r,r={}),r=r||{},"base"in r||(r.base="string"==typeof e?e:""),"documentLoader"in r||(r.documentLoader=n.loadDocument),n.expand(e,r,function(e,o){if(e)return a(new Ct("Could not expand input before framing.","jsonld.FrameError",{cause:e}));try{var i=(new Et).flatten(o)}catch(l){return a(l)}r.graph=!0,r.skipExpansion=!0,n.compact(i,t,r,function(e,t,o){if(e)return a(new Ct("Could not compact flattened output.","jsonld.FrameError",{cause:e}));var i=D(o,"@graph");t[i]=O(o,t[i],r);var l=t[i][0],u=function(e){if(J(e)||_(e)){if(J(e)){if(u.visited[e["@id"]])return;u.visited[e["@id"]]=!0}for(var t in e){var r=e[t],a="@id"===n.getContextValue(o,t,"@type");if(_(r)||J(r)||a)if(F(r)&&a)e[t]=r=l[r],u(r);else if(_(r))for(var i=0;i<r.length;++i)F(r[i])&&a?r[i]=l[r[i]]:J(r[i])&&"@id"in r[i]&&(r[i]=l[r[i]["@id"]]),u(r[i]);else if(J(r)){var s=r["@id"];e[t]=r=l[s],u(r)}}}};u.visited={},u(l),t.of_type={};for(var s in l)if("@type"in l[s]){var c=l[s]["@type"];_(c)||(c=[c]);for(var d in c)c[d]in t.of_type||(t.of_type[c[d]]=[]),t.of_type[c[d]].push(l[s])}a(null,t)})})},n.normalize=function(e,t,r){if(arguments.length<1)return n.nextTick(function(){r(new TypeError("Could not normalize, too few arguments.")) });"function"==typeof t&&(r=t,t={}),t=t||{},"base"in t||(t.base="string"==typeof e?e:""),"documentLoader"in t||(t.documentLoader=n.loadDocument);var a=Q(t);delete a.format,a.produceGeneralizedRdf=!1,n.toRDF(e,a,function(e,n){return e?r(new Ct("Could not convert input to RDF dataset before normalization.","jsonld.NormalizeError",{cause:e})):void(new Et).normalize(n,t,r)})},n.fromRDF=function(e,t,r){return arguments.length<1?n.nextTick(function(){r(new TypeError("Could not convert from RDF, too few arguments."))}):("function"==typeof t&&(r=t,t={}),t=t||{},"useRdfType"in t||(t.useRdfType=!1),"useNativeTypes"in t||(t.useNativeTypes=!1),"format"in t||!F(e)||"format"in t||(t.format="application/nquads"),void n.nextTick(function(){if(t.format){if(!(t.format in ct))throw new Ct("Unknown input format.","jsonld.UnknownFormat",{format:t.format});e=ct[t.format](e)}(new Et).fromRDF(e,t,r)}))},n.toRDF=function(e,t,r){return arguments.length<1?n.nextTick(function(){r(new TypeError("Could not convert to RDF, too few arguments."))}):("function"==typeof t&&(r=t,t={}),t=t||{},"base"in t||(t.base="string"==typeof e?e:""),"documentLoader"in t||(t.documentLoader=n.loadDocument),void n.expand(e,t,function(e,n){if(e)return r(new Ct("Could not expand input before serialization to RDF.","jsonld.RdfError",{cause:e}));try{var a=Et.prototype.toRDF(n,t);if(t.format){if("application/nquads"===t.format)return r(null,tt(a));throw new Ct("Unknown output format.","jsonld.UnknownFormat",{format:t.format})}}catch(o){return r(o)}r(null,a)}))},n.relabelBlankNodes=function(e){o(new at("_:b",e))},n.documentLoader=function(e,t){return t(new Ct("Could not retrieve a JSON-LD document from the URL. URL derefencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed"}),{contextUrl:null,documentUrl:e,document:null})},n.loadDocument=function(e,t){n.documentLoader(e,t)},n.promises=function(){function t(e){var t=o.call(arguments,1);return new a(function(n){e.apply(null,t.concat(function(e,t){e?n.reject(e):n.resolve(t)}))})}function r(e){return function(t,n){e(t).then(function(e){n(null,e)},n)}}var a=e?require("./Promise").Promise:global.Promise,o=Array.prototype.slice,i={};return i.expand=function(){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");var e=arguments.length>1?arguments[1]:{};return"documentLoader"in e&&(e.documentLoader=r(e.documentLoader)),t.apply(null,[n.expand].concat(o.call(arguments)))},i.compact=function(){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");var e=arguments.length>2?arguments[2]:{};"documentLoader"in e&&(e.documentLoader=r(e.documentLoader));var a=function(e,t,r,a){n.compact(e,t,r,function(e,t){a(e,t)})};return t.apply(null,[a].concat(o.call(arguments)))},i.flatten=function(){if(arguments.length<1)throw new TypeError("Could not flatten, too few arguments.");var e=arguments.length>2?arguments[2]:{};return"documentLoader"in e&&(e.documentLoader=r(e.documentLoader)),t.apply(null,[n.flatten].concat(o.call(arguments)))},i.frame=function(){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");var e=arguments.length>2?arguments[2]:{};return"documentLoader"in e&&(e.documentLoader=r(e.documentLoader)),t.apply(null,[n.frame].concat(o.call(arguments)))},i.fromRDF=function(){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");return t.apply(null,[n.fromRDF].concat(o.call(arguments)))},i.toRDF=function(){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");var e=arguments.length>1?arguments[1]:{};return"documentLoader"in e&&(e.documentLoader=r(e.documentLoader)),t.apply(null,[n.toRDF].concat(o.call(arguments)))},i.normalize=function(){if(arguments.length<1)throw new TypeError("Could not normalize, too few arguments.");var e=arguments.length>1?arguments[1]:{};return"documentLoader"in e&&(e.documentLoader=r(e.documentLoader)),t.apply(null,[n.normalize].concat(o.call(arguments)))},i},r.prototype=n.promises(),r.prototype.toString=function(){return this instanceof r?"[object JsonLdProcessor]":"[object JsonLdProcessorPrototype]"},n.JsonLdProcessor=r;var ut=!!Object.defineProperty;if(ut)try{Object.defineProperty({},"x",{})}catch(st){ut=!1}ut&&(Object.defineProperty(r,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(r.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:r})),t&&"undefined"==typeof global.JsonLdProcessor&&(ut?Object.defineProperty(global,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:r}):global.JsonLdProcessor=r),"undefined"!=typeof process&&process.nextTick?(n.nextTick=process.nextTick,n.setImmediate="function"==typeof setImmediate?setImmediate:n.nextTick):"function"==typeof setImmediate?(n.setImmediate=setImmediate,n.nextTick=function(e){return setImmediate(e)}):(n.setImmediate=function(e){setTimeout(e,0)},n.nextTick=n.setImmediate),n.parseLinkHeader=function(e){for(var t={},n=e.match(/(?:<[^>]*?>|"[^"]*?"|[^,])+/g),r=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,a=0;a<n.length;++a){var o=n[a].match(r);if(o){for(var i={target:o[1]},l=o[2],u=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g;o=u.exec(l);)i[o[1]]=void 0===o[2]?o[3]:o[2];var s=i.rel||"";_(t[s])?t[s].push(i):t[s]=s in t?[t[s],i]:i}}return t},n.DocumentCache=function(e){this.order=[],this.cache={},this.size=e||50,this.expires=3e4},n.DocumentCache.prototype.get=function(e){if(e in this.cache){var t=this.cache[e];if(t.expires>=+new Date)return t.ctx;delete this.cache[e],this.order.splice(this.order.indexOf(e),1)}return null},n.DocumentCache.prototype.set=function(e,t){this.order.length===this.size&&delete this.cache[this.order.shift()],this.order.push(e),this.cache[e]={ctx:t,expires:+new Date+this.expires}},n.ActiveContextCache=function(e){this.order=[],this.cache={},this.size=e||100},n.ActiveContextCache.prototype.get=function(e,t){var n=JSON.stringify(e),r=JSON.stringify(t),a=this.cache[n];return a&&r in a?a[r]:null},n.ActiveContextCache.prototype.set=function(e,t,n){if(this.order.length===this.size){var r=this.order.shift();delete this.cache[r.activeCtx][r.localCtx]}var a=JSON.stringify(e),o=JSON.stringify(t);this.order.push({activeCtx:a,localCtx:o}),a in this.cache||(this.cache[a]={}),this.cache[a][o]=n},n.cache={activeCtx:new n.ActiveContextCache},n.documentLoaders={},n.documentLoaders.jquery=function(e,t){t=t||{};var r=new n.DocumentCache;return function(a,o){if(t.secure&&0!==a.indexOf("https"))return o(new Ct('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:a}),{contextUrl:null,documentUrl:a,document:null});var i=r.get(a);return null!==i?o(null,i):void e.ajax({url:a,dataType:"json",crossDomain:!0,success:function(e,t,i){var l={contextUrl:null,documentUrl:a,document:e},u=i.getResponseHeader("Content-Type"),s=i.getResponseHeader("Link");if(s&&"application/ld+json"!==u){if(s=n.parseLinkHeader(s)[Dt],_(s))return o(new Ct("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:a}),l);s&&(l.contextUrl=s.target)}r.set(a,l),o(null,l)},error:function(e,t,n){o(new Ct("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:a,cause:n}),{contextUrl:null,documentUrl:a,document:null})}})}},n.documentLoaders.node=function(e){function t(l,u,s){if(e.secure&&0!==l.indexOf("https"))return s(new Ct('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:l}),{contextUrl:null,documentUrl:l,document:null});var c=i.get(l);return null!==c?s(null,c):void a({url:l,strictSSL:!0,followRedirect:!1},function(e,a,d){if(c={contextUrl:null,documentUrl:l,document:d||null},e)return s(new Ct("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:l,cause:e}),c);var f=o.STATUS_CODES[a.statusCode];if(a.statusCode>=400)return s(new Ct("URL could not be dereferenced: "+f,"jsonld.InvalidUrl",{code:"loading document failed",url:l,httpStatusCode:a.statusCode}),c);if(a.headers.link&&"application/ld+json"!==a.headers["content-type"]){var p=n.parseLinkHeader(a.headers.link)[Dt];if(_(p))return s(new Ct("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:l}),c);p&&(c.contextUrl=p.target)}if(a.statusCode>=300&&a.statusCode<400&&a.headers.location)return u.length===r?s(new Ct("URL could not be dereferenced; there were too many redirects.","jsonld.TooManyRedirects",{code:"loading document failed",url:l,httpStatusCode:a.statusCode,redirects:u}),c):-1!==u.indexOf(l)?s(new Ct("URL could not be dereferenced; infinite redirection was detected.","jsonld.InfiniteRedirectDetected",{code:"recursive context inclusion",url:l,httpStatusCode:a.statusCode,redirects:u}),c):(u.push(l),t(a.headers.location,u,s));u.push(l);for(var v=0;v<u.length;++v)i.set(u[v],{contextUrl:null,documentUrl:u[v],document:d});s(e,c)})}e=e||{};var r="maxRedirects"in e?e.maxRedirects:-1,a=require("request"),o=require("http"),i=new n.DocumentCache;return function(e,n){t(e,[],n)}},n.useDocumentLoader=function(e){if(!(e in n.documentLoaders))throw new Ct('Unknown document loader type: "'+e+'"',"jsonld.UnknownDocumentLoader",{type:e});n.documentLoader=n.documentLoaders[e].apply(n,Array.prototype.slice.call(arguments,1))},n.processContext=function(e,t){var r={},a=2;arguments.length>3&&(r=arguments[2]||{},a+=1);var o=arguments[a];return"base"in r||(r.base=""),"documentLoader"in r||(r.documentLoader=n.loadDocument),null===t?o(null,T(r)):(t=Q(t),(F(t)||J(t)&&!("@context"in t))&&(t={"@context":t}),void W(t,r,function(t,n){if(t)return o(t);try{n=(new Et).processContext(e,n,r)}catch(a){return o(a)}o(null,n)}))},n.hasProperty=function(e,t){var n=!1;if(t in e){var r=e[t];n=!_(r)||r.length>0}return n},n.hasValue=function(e,t,r){var a=!1;if(n.hasProperty(e,t)){var o=e[t],i=G(o);if(_(o)||i){i&&(o=o["@list"]);for(var l=0;l<o.length;++l)if(n.compareValues(r,o[l])){a=!0;break}}else _(r)||(a=n.compareValues(r,o))}return a},n.addValue=function(e,t,r,a){if(a=a||{},"propertyIsArray"in a||(a.propertyIsArray=!1),"allowDuplicate"in a||(a.allowDuplicate=!0),_(r)){0!==r.length||!a.propertyIsArray||t in e||(e[t]=[]);for(var o=0;o<r.length;++o)n.addValue(e,t,r[o],a)}else if(t in e){var i=!a.allowDuplicate&&n.hasValue(e,t,r);_(e[t])||i&&!a.propertyIsArray||(e[t]=[e[t]]),i||e[t].push(r)}else e[t]=a.propertyIsArray?[r]:r},n.getValues=function(e,t){var n=e[t]||[];return _(n)||(n=[n]),n},n.removeProperty=function(e,t){delete e[t]},n.removeValue=function(e,t,r,a){a=a||{},"propertyIsArray"in a||(a.propertyIsArray=!1);var o=n.getValues(e,t).filter(function(e){return!n.compareValues(e,r)});0===o.length?n.removeProperty(e,t):e[t]=1!==o.length||a.propertyIsArray?o:o[0]},n.compareValues=function(e,t){return e===t?!0:$(e)&&$(t)&&e["@value"]===t["@value"]&&e["@type"]===t["@type"]&&e["@language"]===t["@language"]&&e["@index"]===t["@index"]?!0:J(e)&&"@id"in e&&J(t)&&"@id"in t?e["@id"]===t["@id"]:!1},n.getContextValue=function(e,t,n){var r=null;if(null===t)return r;if("@language"===n&&n in e&&(r=e[n]),e.mappings[t]){var a=e.mappings[t];H(n)?r=a:n in a&&(r=a[n])}return r};var ct={};if(n.registerRDFParser=function(e,t){ct[e]=t},n.unregisterRDFParser=function(e){delete ct[e]},e){if("undefined"==typeof dt)var dt=null;if("undefined"==typeof ft)var ft={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12}}var pt="http://www.w3.org/2001/XMLSchema#boolean",vt="http://www.w3.org/2001/XMLSchema#double",ht="http://www.w3.org/2001/XMLSchema#integer",gt="http://www.w3.org/2001/XMLSchema#string",mt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",yt=mt+"List",xt=mt+"first",bt=mt+"rest",wt=mt+"nil",jt=mt+"type",It=mt+"PlainLiteral",Ot=mt+"XMLLiteral",Lt=mt+"object",St=mt+"langString",Dt="http://www.w3.org/ns/json-ld#context",Nt=10,Ct=function(t,n,r){e&&(Error.call(this),Error.captureStackTrace(this,this.constructor)),this.name=n||"jsonld.Error",this.message=t||"An unspecified JSON-LD error occurred.",this.details=r||{}};e&&require("util").inherits(Ct,Error);var Et=function(){};Et.prototype.compact=function(e,t,r,a){if(_(r)){for(var o=[],i=0;i<r.length;++i){var l=this.compact(e,t,r[i],a);null!==l&&o.push(l)}if(a.compactArrays&&1===o.length){var u=n.getContextValue(e,t,"@container");null===u&&(o=o[0])}return o}if(J(r)){if($(r)||X(r))return N(e,t,r);for(var s="@reverse"===t,c=Object.keys(r).sort(),o={},d=0;d<c.length;++d){var f=c[d],p=r[f];if("@id"!==f&&"@type"!==f)if("@reverse"!==f)if("@index"!==f){if(0===p.length){var v=D(e,f,p,{vocab:!0},s);n.addValue(o,v,p,{propertyIsArray:!0})}for(var h=0;h<p.length;++h){var g=p[h],v=D(e,f,g,{vocab:!0},s),u=n.getContextValue(e,v,"@container"),m=G(g),y=null;m&&(y=g["@list"]);var x=this.compact(e,v,m?y:g,a);if(m)if(_(x)||(x=[x]),"@list"!==u){var b={};b[D(e,"@list")]=x,x=b,"@index"in g&&(x[D(e,"@index")]=g["@index"])}else if(v in o)throw new Ct('JSON-LD compact error; property has a "@list" @container rule but there is more than a single @list that matches the compacted term in the document. Compaction might mix unwanted items into the list.',"jsonld.SyntaxError",{code:"compaction to list of lists"});if("@language"===u||"@index"===u){var w;v in o?w=o[v]:o[v]=w={},"@language"===u&&$(x)&&(x=x["@value"]),n.addValue(w,g[u],x)}else{var j=!a.compactArrays||"@set"===u||"@list"===u||_(x)&&0===x.length||"@list"===f||"@graph"===f;n.addValue(o,v,x,{propertyIsArray:j})}}}else{var u=n.getContextValue(e,t,"@container");if("@index"===u)continue;var I=D(e,f);n.addValue(o,I,p)}else{var O=this.compact(e,"@reverse",p,a);for(var L in O)if(e.mappings[L]&&e.mappings[L].reverse){var S=O[L],u=n.getContextValue(e,L,"@container"),C="@set"===u||!a.compactArrays;n.addValue(o,L,S,{propertyIsArray:C}),delete O[L]}if(Object.keys(O).length>0){var I=D(e,f);n.addValue(o,I,O)}}else{var O;if(F(p))O=D(e,p,null,{vocab:"@type"===f});else{O=[];for(var h=0;h<p.length;++h)O.push(D(e,p[h],null,{vocab:!0}))}var I=D(e,f),j=_(O)&&0===p.length;n.addValue(o,I,O,{propertyIsArray:j})}}return o}return r},Et.prototype.expand=function(e,t,r,o,l){var u=this;if(null===r||void 0===r)return null;if(!_(r)&&!J(r))return l||null!==t&&"@graph"!==E(e,t,{vocab:!0})?i(e,t,r):null;if(_(r)){var s=[],c=n.getContextValue(e,t,"@container");l=l||"@list"===c;for(var d=0;d<r.length;++d){var f=u.expand(e,t,r[d],o);if(l&&(_(f)||G(f)))throw new Ct("Invalid JSON-LD syntax; lists of lists are not permitted.","jsonld.SyntaxError",{code:"list of lists"});null!==f&&(_(f)?s=s.concat(f):s.push(f))}return s}"@context"in r&&(e=u.processContext(e,r["@context"],o));for(var p=E(e,t,{vocab:!0}),s={},v=Object.keys(r).sort(),h=0;h<v.length;++h){var g,m=v[h],y=r[m];if("@context"!==m){var x=E(e,m,{vocab:!0});if(null!==x&&(Z(x)||U(x))){if(U(x)){if("@reverse"===p)throw new Ct("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:y});if(x in s)throw new Ct("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:x})}if("@id"===x&&!F(y)){if(!o.isFrame)throw new Ct('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:y});if(!J(y))throw new Ct('Invalid JSON-LD syntax; "@id" value must be a string or an object.',"jsonld.SyntaxError",{code:"invalid @id value",value:y})}if("@type"===x&&V(y),"@graph"===x&&!J(y)&&!_(y))throw new Ct('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:y});if("@value"===x&&(J(y)||_(y)))throw new Ct('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:y});if("@language"===x){if(!F(y))throw new Ct('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:y});y=y.toLowerCase()}if("@index"===x&&!F(y))throw new Ct('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:y});if("@reverse"!==x){var c=n.getContextValue(e,m,"@container");if("@language"===c&&J(y))g=a(y);else if("@index"===c&&J(y))g=function(t){for(var n=[],r=Object.keys(y).sort(),a=0;a<r.length;++a){var i=r[a],l=y[i];_(l)||(l=[l]),l=u.expand(e,t,l,o,!1);for(var s=0;s<l.length;++s){var c=l[s];"@index"in c||(c["@index"]=i),n.push(c)}}return n}(m);else{var b="@list"===x;if(b||"@set"===x){var w=t;if(b&&"@graph"===p&&(w=null),g=u.expand(e,w,y,o,b),b&&G(g))throw new Ct("Invalid JSON-LD syntax; lists of lists are not permitted.","jsonld.SyntaxError",{code:"list of lists"})}else g=u.expand(e,m,y,o,!1)}if(null!==g||"@value"===x)if("@list"===x||G(g)||"@list"!==c||(g=_(g)?g:[g],g={"@list":g}),e.mappings[m]&&e.mappings[m].reverse){var j=s["@reverse"]={};_(g)||(g=[g]);for(var I=0;I<g.length;++I){var O=g[I];if($(O)||G(O))throw new Ct('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:g});n.addValue(j,x,O,{propertyIsArray:!0})}}else{var L=-1===["@index","@id","@type","@value","@language"].indexOf(x);n.addValue(s,x,g,{propertyIsArray:L})}}else{if(!J(y))throw new Ct('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:y});if(g=u.expand(e,"@reverse",y,o),"@reverse"in g)for(var S in g["@reverse"])n.addValue(s,S,g["@reverse"][S],{propertyIsArray:!0});var j=s["@reverse"]||null;for(var S in g)if("@reverse"!==S){null===j&&(j=s["@reverse"]={}),n.addValue(j,S,[],{propertyIsArray:!0});for(var D=g[S],I=0;I<D.length;++I){var O=D[I];if($(O)||G(O))throw new Ct('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:g});n.addValue(j,S,O,{propertyIsArray:!0})}}}}}}v=Object.keys(s);var N=v.length;if("@value"in s){if("@type"in s&&"@language"in s)throw new Ct('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and "@language".',"jsonld.SyntaxError",{code:"invalid value object",element:s});var C=N-1;if("@type"in s&&(C-=1),"@index"in s&&(C-=1),"@language"in s&&(C-=1),0!==C)throw new Ct('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and at most one other property which can be "@type" or "@language".',"jsonld.SyntaxError",{code:"invalid value object",element:s});if(null===s["@value"])s=null;else{if("@language"in s&&!F(s["@value"]))throw new Ct("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:s});if("@type"in s&&(!Z(s["@type"])||0===s["@type"].indexOf("_:")))throw new Ct('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:s})}}else if("@type"in s&&!_(s["@type"]))s["@type"]=[s["@type"]];else if("@set"in s||"@list"in s){if(N>1&&!(2===N&&"@index"in s))throw new Ct('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:s});"@set"in s&&(s=s["@set"],v=Object.keys(s),N=v.length)}else 1===N&&"@language"in s&&(s=null);return!J(s)||o.keepFreeFloatingNodes||l||null!==t&&"@graph"!==p||(0===N||"@value"in s||"@list"in s||1===N&&"@id"in s)&&(s=null),s},Et.prototype.flatten=function(e){var t=new at("_:b"),n={"@default":{}};h(e,n,"@default",t);for(var r=n["@default"],a=Object.keys(n).sort(),o=0;o<a.length;++o){var i=a[o];if("@default"!==i){var l=n[i],u=r[i];u?"@graph"in u||(u["@graph"]=[]):r[i]=u={"@id":i,"@graph":[]};for(var s=u["@graph"],c=Object.keys(l).sort(),d=0;d<c.length;++d){var f=l[c[d]];X(f)||s.push(f)}}}for(var p=[],v=Object.keys(r).sort(),g=0;g<v.length;++g){var f=r[v[g]];X(f)||p.push(f)}return p},Et.prototype.frame=function(e,t,n){var r={options:n,graphs:{"@default":{},"@merged":{}}},a=new at("_:b");h(e,r.graphs,"@merged",a),r.subjects=r.graphs["@merged"];var o=[];return g(r,Object.keys(r.subjects).sort(),t,o,null),o},Et.prototype.normalize=function(e,t,r){function a(e){function t(l){if(l===e.length)return o(i,a,r);var u=e[l],c=f(u,s,b);c in a?(a[c].push(u),r.push(u)):c in i?(a[c]=[i[c],u],r.push(i[c]),r.push(u),delete i[c]):i[c]=u,n.setImmediate(function(){t(l+1)})}var r=[],a={},i={};n.setImmediate(function(){t(0)})}function o(e,t,n){for(var r=!1,o=Object.keys(e).sort(),l=0;l<o.length;++l){var u=e[o[l]];b.getName(u),r=!0}r?a(n):i(t)}function i(e){function t(a){function o(e,n){if(n===e.length){u.sort(function(e,t){return e=e.hash,t=t.hash,t>e?-1:e>t?1:0});for(var i in u)for(var l in u[i].pathNamer.existing)b.getName(l);return t(a+1)}var c=e[n];if(b.isNamed(c))return o(e,n+1);var d=new at("_:b");d.getName(c),p(c,s,b,d,function(t,a){return t?r(t):(u.push(a),void o(e,n+1))})}if(a===n.length)return l();var i=e[n[a]],u=[];o(i,0)}var n=Object.keys(e).sort();t(0)}function l(){for(var e=[],n=0;n<u.length;++n){for(var a=u[n],o=["subject","object","name"],i=0;i<o.length;++i){var l=o[i];a[l]&&"blank node"===a[l].type&&0!==a[l].value.indexOf("_:c14n")&&(a[l].value=b.getName(a[l].value))}e.push(nt(a,a.name?a.name.value:null))}return e.sort(),t.format?"application/nquads"===t.format?r(null,e.join("")):r(new Ct("Unknown output format.","jsonld.UnknownFormat",{format:t.format})):void r(null,et(e.join("")))}var u=[],s={};for(var c in e){var d=e[c];"@default"===c&&(c=null);for(var v=0;v<d.length;++v){var h=d[v];null!==c&&(h.name=0===c.indexOf("_:")?{type:"blank node",value:c}:{type:"IRI",value:c}),u.push(h);for(var g=["subject","object","name"],m=0;m<g.length;++m){var y=g[m];if(h[y]&&"blank node"===h[y].type){var x=h[y].value;x in s?s[x].quads.push(h):s[x]={quads:[h]}}}}}var b=new at("_:c14n");return a(Object.keys(s))},Et.prototype.fromRDF=function(e,t,r){var a={},o={"@default":a};for(var i in e){var l=e[i];i in o||(o[i]={}),"@default"===i||i in a||(a[i]={"@id":i});for(var u=o[i],s=0;s<l.length;++s){var d=l[s],f=d.subject.value,p=d.predicate.value,v=d.object;f in u||(u[f]={"@id":f});var h=u[f],g="IRI"===v.type||"blank node"===v.type;if(!g||v.value in u||(u[v.value]={"@id":v.value}),p===jt&&g)n.addValue(h,"@type",v.value,{propertyIsArray:!0});else{var m=c(v,t.useNativeTypes);if(n.addValue(h,p,m,{propertyIsArray:!0}),g){var y=u[v.value];"usages"in y||(y.usages=[]),y.usages.push({node:h,property:p,value:m})}}}}for(var i in o){var x=o[i];if(wt in x)for(var b=x[wt],w=0;w<b.usages.length;++w){for(var j=b.usages[w],h=j.node,I=j.property,O=j.value,L=[],S=[],D=Object.keys(h).length;I===bt&&1===h.usages.length&&_(h[xt])&&1===h[xt].length&&_(h[bt])&&1===h[bt].length&&(4===D||5===D&&_(h["@type"])&&1===h["@type"].length&&h["@type"][0]===yt)&&(L.push(h[xt][0]),S.push(h["@id"]),j=h.usages[0],h=j.node,I=j.property,O=j.value,D=Object.keys(h).length,0===h["@id"].indexOf("_:")););if(I===xt){if(h["@id"]===wt)continue;O=x[O["@id"]][bt][0],L.pop(),S.pop()}delete O["@id"],O["@list"]=L.reverse();for(var N=0;N<S.length;++N)delete x[S[N]]}}for(var C=[],E=Object.keys(a).sort(),w=0;w<E.length;++w){var k=E[w],h=a[k];if(k in o)for(var l=h["@graph"]=[],x=o[k],R=Object.keys(x).sort(),T=0;T<R.length;++T){var U=x[R[T]];delete U.usages,X(U)||l.push(U)}delete h.usages,X(h)||C.push(h)}r(null,C)},Et.prototype.toRDF=function(e,t){var n=new at("_:b"),r={"@default":{}};h(e,r,"@default",n);for(var a={},o=Object.keys(r).sort(),i=0;i<o.length;++i){var u=o[i];("@default"===u||Z(u))&&(a[u]=l(r[u],n,t))}return a},Et.prototype.processContext=function(e,t,r){J(t)&&"@context"in t&&_(t["@context"])&&(t=t["@context"]);var a=_(t)?t:[t];if(0===a.length)return e.clone();for(var o=e,i=!0,l=0;l<a.length;++l){var u=a[l];if(null!==u){if(J(u)&&"@context"in u&&(u=u["@context"]),!J(u))throw new Ct("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:u});if(n.cache.activeCtx){var s=n.cache.activeCtx.get(e,u);if(s){o=s,i=!0;continue}}i&&(o=o.clone(),i=!1);var c={};if("@base"in u){var d=u["@base"];if(null===d)d=null;else{if(!F(d))throw new Ct('Invalid JSON-LD syntax; the value of "@base" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:u});if(""!==d&&!Z(d))throw new Ct('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI or the empty string.',"jsonld.SyntaxError",{code:"invalid base IRI",context:u})}d=n.url.parse(d||""),o["@base"]=d,c["@base"]=!0}if("@vocab"in u){var f=u["@vocab"];if(null===f)delete o["@vocab"];else{if(!F(f))throw new Ct('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:u});if(!Z(f))throw new Ct('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:u});o["@vocab"]=f}c["@vocab"]=!0}if("@language"in u){var f=u["@language"];if(null===f)delete o["@language"];else{if(!F(f))throw new Ct('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:u});o["@language"]=f.toLowerCase()}c["@language"]=!0}for(var p in u)C(o,u,p,c);n.cache.activeCtx&&n.cache.activeCtx.set(e,u,o)}else o=T(r),i=!1}return o},Object.keys||(Object.keys=function(e){if(e!==Object(e))throw new TypeError("Object.keys called on non-object");var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}),n.registerRDFParser("application/nquads",et),n.registerRDFParser("rdfa-api",rt),at.prototype.clone=function(){var e=new at(this.prefix);return e.counter=this.counter,e.existing=Q(this.existing),e},at.prototype.getName=function(e){if(e&&e in this.existing)return this.existing[e];var t=this.prefix+this.counter;return this.counter+=1,e&&(this.existing[e]=t),t},at.prototype.isNamed=function(e){return e in this.existing},Permutator=function(e){this.list=e.sort(),this.done=!1,this.left={};for(var t=0;t<e.length;++t)this.left[e[t]]=!0},Permutator.prototype.hasNext=function(){return!this.done},Permutator.prototype.next=function(){for(var e=this.list.slice(),t=null,n=0,r=this.list.length,a=0;r>a;++a){var o=this.list[a],i=this.left[o];(null===t||o>t)&&(i&&a>0&&o>this.list[a-1]||!i&&r-1>a&&o>this.list[a+1])&&(t=o,n=a)}if(null===t)this.done=!0;else{var l=this.left[t]?n-1:n+1;this.list[n]=this.list[l],this.list[l]=t;for(var a=0;r>a;++a)this.list[a]>t&&(this.left[this.list[a]]=!this.left[this.list[a]])}return e};var kt=n.sha1={};if(e){var Rt=require("crypto");kt.create=function(){var e=Rt.createHash("sha1");return{update:function(t){e.update(t,"utf8")},digest:function(){return e.digest("hex")}}}}else kt.create=function(){return new kt.MessageDigest};if(kt.hash=function(e){for(var t=kt.create(),n=0;n<e.length;++n)t.update(e[n]);return t.digest()},!e){kt.Buffer=function(){this.data="",this.read=0},kt.Buffer.prototype.putInt32=function(e){this.data+=String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)},kt.Buffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},kt.Buffer.prototype.bytes=function(){return this.data.slice(this.read)},kt.Buffer.prototype.length=function(){return this.data.length-this.read},kt.Buffer.prototype.compact=function(){this.data=this.data.slice(this.read),this.read=0},kt.Buffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var n=this.data.charCodeAt(t);16>n&&(e+="0"),e+=n.toString(16)}return e},kt.MessageDigest=function(){Tt.initialized||Tt.init(),this.blockLength=64,this.digestLength=20,this.messageLength=0,this.input=new kt.Buffer,this.words=new Array(80),this.state={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520}},kt.MessageDigest.prototype.update=function(e){e=unescape(encodeURIComponent(e)),this.messageLength+=e.length,this.input.data+=e,Tt.update(this.state,this.words,this.input),(this.input.read>2048||0===this.input.length())&&this.input.compact()},kt.MessageDigest.prototype.digest=function(){var e=this.messageLength,t=new kt.Buffer;t.data+=this.input.bytes(),t.data+=Tt.padding.substr(0,64-(e+8)%64),t.putInt32(e>>>29&255),t.putInt32(e<<3&4294967295),Tt.update(this.state,this.words,t);var n=new kt.Buffer;return n.putInt32(this.state.h0),n.putInt32(this.state.h1),n.putInt32(this.state.h2),n.putInt32(this.state.h3),n.putInt32(this.state.h4),n.toHex()};var Tt={padding:null,initialized:!1};Tt.init=function(){Tt.padding=String.fromCharCode(128);for(var e=String.fromCharCode(0),t=64;t>0;)1&t&&(Tt.padding+=e),t>>>=1,t>0&&(e+=e);Tt.initialized=!0},Tt.update=function(e,t,n){for(var r,a,o,i,l,u,s,c,d=n.length();d>=64;){for(a=e.h0,o=e.h1,i=e.h2,l=e.h3,u=e.h4,c=0;16>c;++c)r=n.getInt32(),t[c]=r,s=l^o&(i^l),r=(a<<5|a>>>27)+s+u+1518500249+r,u=l,l=i,i=o<<30|o>>>2,o=a,a=r;for(;20>c;++c)r=t[c-3]^t[c-8]^t[c-14]^t[c-16],r=r<<1|r>>>31,t[c]=r,s=l^o&(i^l),r=(a<<5|a>>>27)+s+u+1518500249+r,u=l,l=i,i=o<<30|o>>>2,o=a,a=r;for(;32>c;++c)r=t[c-3]^t[c-8]^t[c-14]^t[c-16],r=r<<1|r>>>31,t[c]=r,s=o^i^l,r=(a<<5|a>>>27)+s+u+1859775393+r,u=l,l=i,i=o<<30|o>>>2,o=a,a=r;for(;40>c;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,s=o^i^l,r=(a<<5|a>>>27)+s+u+1859775393+r,u=l,l=i,i=o<<30|o>>>2,o=a,a=r;for(;60>c;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,s=o&i|l&(o^i),r=(a<<5|a>>>27)+s+u+2400959708+r,u=l,l=i,i=o<<30|o>>>2,o=a,a=r;for(;80>c;++c)r=t[c-6]^t[c-16]^t[c-28]^t[c-32],r=r<<2|r>>>30,t[c]=r,s=o^i^l,r=(a<<5|a>>>27)+s+u+3395469782+r,u=l,l=i,i=o<<30|o>>>2,o=a,a=r;e.h0+=a,e.h1+=o,e.h2+=i,e.h3+=l,e.h4+=u,d-=64}}}if(n.url={},e){var Ut=require("url").parse;n.url.parse=function(e){var t=Ut(e);return t.pathname=t.pathname||"",it(t),t.normalizedPath=lt(t.pathname,""!==t.authority),t}}else{var Jt={};Jt.options={key:["href","protocol","host","auth","user","password","hostname","port","relative","path","directory","file","query","hash"],parser:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/},n.url.parse=function(e){for(var t=Jt.options,n=t.parser.exec(e),r={},a=14;a--;)r[t.key[a]]=n[a]||"";return r.host&&""===r.path&&(r.path="/"),r.pathname=r.path||"",it(r),r.normalizedPath=lt(r.pathname,""!==r.authority),r.query&&(r.path=r.path+"?"+r.query),r.protocol&&(r.protocol+=":"),r.hash&&(r.hash="#"+r.hash),r}}return e&&n.useDocumentLoader("node"),e&&(n.use=function(e){switch(e){case"request":n.request=require("./request");break;default:throw new Ct("Unknown extension.","jsonld.UnknownExtension",{extension:e})}}),n},r=function(){return n(function(){return r()})};n(r),e?module.exports=r:"function"==typeof define&&define.amd?define([],function(){return r}):t&&("undefined"==typeof jsonld?jsonld=jsonldjs=r:jsonldjs=r)}();
sitic/cdnjs
ajax/libs/jsonld/0.1.9/jsonld.min.js
JavaScript
mit
63,585
!function(e){var a=/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g;e.languages.handlebars=e.languages.extend("markup",{handlebars:{pattern:a,inside:{delimiter:{pattern:/^\{\{\{?|\}\}\}?$/i,alias:"punctuation"},string:/(["'])(\\?.)*?\1/,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?)\b/,"boolean":/\b(true|false)\b/,block:{pattern:/^(\s*~?\s*)[#\/]\S+?(?=\s*~?\s*$|\s)/i,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/,variable:/[\w\W]+/}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~\s]+/}}}),e.languages.insertBefore("handlebars","tag",{"handlebars-comment":{pattern:/\{\{![\w\W]*?\}\}/,alias:["handlebars","comment"]}}),e.hooks.add("before-highlight",function(e){"handlebars"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(a,function(a){return e.tokenStack.push(a),"___HANDLEBARS"+e.tokenStack.length+"___"}))}),e.hooks.add("before-insert",function(e){"handlebars"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),e.hooks.add("after-highlight",function(a){if("handlebars"===a.language){for(var n,t=0;n=a.tokenStack[t];t++)a.highlightedCode=a.highlightedCode.replace("___HANDLEBARS"+(t+1)+"___",e.highlight(n,a.grammar,"handlebars").replace(/\$/g,"$$$$"));a.element.innerHTML=a.highlightedCode}})}(Prism);
boneskull/cdnjs
ajax/libs/prism/1.5.1/components/prism-handlebars.min.js
JavaScript
mit
1,329
/*! Sizzle v1.10.19 | (c) 2013 jQuery Foundation, Inc. | jquery.org/license */ !function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),"function"==typeof define&&define.amd?define(function(){return fb}):"undefined"!=typeof module&&module.exports?module.exports=fb:a.Sizzle=fb}(window); //# sourceMappingURL=dist/sizzle.min.map
GuzmanPI/AngularEs
bower_components/jquery/src/sizzle/dist/sizzle.min.js
JavaScript
mit
18,574
(function(global) { var define, requireModule; (function() { var registry = {}, seen = {}; define = function(name, deps, callback) { registry[name] = { deps: deps, callback: callback }; }; requireModule = function(name) { if (seen.hasOwnProperty(name)) { return seen[name]; } seen[name] = {}; if (!registry[name]) { throw new Error("Could not find module " + name); } var mod = registry[name], deps = mod.deps, callback = mod.callback, reified = [], exports; for (var i=0, l=deps.length; i<l; i++) { if (deps[i] === 'exports') { reified.push(exports = {}); } else { reified.push(requireModule(resolve(deps[i]))); } } var value = callback.apply(this, reified); return seen[name] = exports || value; function resolve(child) { if (child.charAt(0) !== '.') { return child; } var parts = child.split("/"); var parentBase = name.split("/").slice(0, -1); for (var i=0, l=parts.length; i<l; i++) { var part = parts[i]; if (part === '..') { parentBase.pop(); } else if (part === '.') { continue; } else { parentBase.push(part); } } return parentBase.join("/"); } }; requireModule.registry = registry; })(); define("simple-auth-devise/authenticators/devise", ["simple-auth/authenticators/base","simple-auth/utils/is-secure-url","simple-auth/utils/get-global-config","exports"], function(__dependency1__, __dependency2__, __dependency3__, __exports__) { "use strict"; var Base = __dependency1__["default"]; var isSecureUrl = __dependency2__["default"]; var getGlobalConfig = __dependency3__["default"]; var global = (typeof window !== 'undefined') ? window : {}, Ember = global.Ember; /** Authenticator that works with the Ruby gem [Devise](https://github.com/plataformatec/devise). __As token authentication is not actually part of devise anymore, the server needs to implement some customizations__ to work with this authenticator - see the README and [discussion here](https://gist.github.com/josevalim/fb706b1e933ef01e4fb6). _The factory for this authenticator is registered as `'simple-auth-authenticator:devise'` in Ember's container._ @class Devise @namespace SimpleAuth.Authenticators @module simple-auth-devise/authenticators/devise @extends Base */ __exports__["default"] = Base.extend({ /** The endpoint on the server the authenticator acquires the auth token and email from. This value can be configured via the global environment object: ```js window.ENV = window.ENV || {}; window.ENV['simple-auth-devise'] = { serverTokenEndpoint: '/some/other/endpoint' } ``` @property serverTokenEndpoint @type String @default '/users/sign_in' */ serverTokenEndpoint: '/users/sign_in', /** The devise resource name This value can be configured via the global environment object: ```js window.ENV = window.ENV || {}; window.ENV['simple-auth-devise'] = { resourceName: 'account' } ``` @property resourceName @type String @default 'user' */ resourceName: 'user', /** @method init @private */ init: function() { var globalConfig = getGlobalConfig('simple-auth-devise'); this.serverTokenEndpoint = globalConfig.serverTokenEndpoint || this.serverTokenEndpoint; this.resourceName = globalConfig.resourceName || this.resourceName; }, /** Restores the session from a set of session properties; __will return a resolving promise when there's a non-empty `user_token` and a non-empty `user_email` in the `properties`__ and a rejecting promise otherwise. @method restore @param {Object} properties The properties to restore the session from @return {Ember.RSVP.Promise} A promise that when it resolves results in the session being authenticated */ restore: function(properties) { return new Ember.RSVP.Promise(function(resolve, reject) { if (!Ember.isEmpty(properties.user_token) && !Ember.isEmpty(properties.user_email)) { resolve(properties); } else { reject(); } }); }, /** Authenticates the session with the specified `credentials`; the credentials are `POST`ed to the [`Authenticators.Devise#serverTokenEndpoint`](#SimpleAuth-Authenticators-Devise-serverTokenEndpoint) and if they are valid the server returns an auth token and email in response. __If the credentials are valid and authentication succeeds, a promise that resolves with the server's response is returned__, otherwise a promise that rejects with the server error is returned. @method authenticate @param {Object} options The credentials to authenticate the session with @return {Ember.RSVP.Promise} A promise that resolves when an auth token and email is successfully acquired from the server and rejects otherwise */ authenticate: function(credentials) { var _this = this; return new Ember.RSVP.Promise(function(resolve, reject) { var data = {}; data[_this.resourceName] = { email: credentials.identification, password: credentials.password }; _this.makeRequest(data).then(function(response) { Ember.run(function() { resolve(response); }); }, function(xhr, status, error) { Ember.run(function() { reject(xhr.responseJSON || xhr.responseText); }); }); }); }, /** Does nothing @method invalidate @return {Ember.RSVP.Promise} A resolving promise */ invalidate: function() { return Ember.RSVP.resolve(); }, /** @method makeRequest @private */ makeRequest: function(data, resolve, reject) { if (!isSecureUrl(this.serverTokenEndpoint)) { Ember.Logger.warn('Credentials are transmitted via an insecure connection - use HTTPS to keep them secure.'); } return Ember.$.ajax({ url: this.serverTokenEndpoint, type: 'POST', data: data, dataType: 'json', beforeSend: function(xhr, settings) { xhr.setRequestHeader('Accept', settings.accepts.json); } }); } }); }); define("simple-auth-devise/authorizers/devise", ["simple-auth/authorizers/base","simple-auth/utils/is-secure-url","exports"], function(__dependency1__, __dependency2__, __exports__) { "use strict"; var Base = __dependency1__["default"]; var isSecureUrl = __dependency2__["default"]; var global = (typeof window !== 'undefined') ? window : {}, Ember = global.Ember; /** Authenticator that works with the Ruby gem [Devise](https://github.com/plataformatec/devise) by sending the `user_token` and `user_email` properties from the session in the `Authorization` header. __As token authentication is not actually part of devise anymore, the server needs to implement some customizations__ to work with this authenticator - see the README for more information. _The factory for this authorizer is registered as `'simple-auth-authorizer:devise'` in Ember's container._ @class Devise @namespace SimpleAuth.Authorizers @module simple-auth-devise/authorizers/devise @extends Base */ __exports__["default"] = Base.extend({ /** Authorizes an XHR request by sending the `user_token` and `user_email` properties from the session in the `Authorization` header: ``` Authorization: Token token="<user_token>", user_email="<user_email>" ``` @method authorize @param {jqXHR} jqXHR The XHR request to authorize (see http://api.jquery.com/jQuery.ajax/#jqXHR) @param {Object} requestOptions The options as provided to the `$.ajax` method (see http://api.jquery.com/jQuery.ajaxPrefilter/) */ authorize: function(jqXHR, requestOptions) { var userToken = this.get('session.user_token'); var userEmail = this.get('session.user_email'); if (this.get('session.isAuthenticated') && !Ember.isEmpty(userToken) && !Ember.isEmpty(userEmail)) { if (!isSecureUrl(requestOptions.url)) { Ember.Logger.warn('Credentials are transmitted via an insecure connection - use HTTPS to keep them secure.'); } var authData = 'token="' + userToken + '", user_email="' + userEmail + '"'; jqXHR.setRequestHeader('Authorization', 'Token ' + authData); } } }); }); define("simple-auth-devise/ember", ["./initializer"], function(__dependency1__) { "use strict"; var global = (typeof window !== 'undefined') ? window : {}, Ember = global.Ember; var initializer = __dependency1__["default"]; Ember.onLoad('Ember.Application', function(Application) { Application.initializer(initializer); }); }); define("simple-auth-devise/initializer", ["simple-auth-devise/authenticators/devise","simple-auth-devise/authorizers/devise","exports"], function(__dependency1__, __dependency2__, __exports__) { "use strict"; var global = (typeof window !== 'undefined') ? window : {}, Ember = global.Ember; var Authenticator = __dependency1__["default"]; var Authorizer = __dependency2__["default"]; __exports__["default"] = { name: 'simple-auth-devise', before: 'simple-auth', initialize: function(container, application) { container.register('simple-auth-authorizer:devise', Authorizer); container.register('simple-auth-authenticator:devise', Authenticator); } }; }); define('simple-auth/authenticators/base', ['exports'], function(__exports__) { __exports__['default'] = global.SimpleAuth.Authenticators.Base; }); define('simple-auth/authorizers/base', ['exports'], function(__exports__) { __exports__['default'] = global.SimpleAuth.Authorizers.Base; }); define('simple-auth/utils/is-secure-url', ['exports'], function(__exports__) { __exports__['default'] = global.SimpleAuth.Utils.isSecureUrl; }); define('simple-auth/utils/get-global-config', ['exports'], function(__exports__) { __exports__['default'] = global.SimpleAuth.Utils.getGlobalConfig; }); var initializer = requireModule('simple-auth-devise/initializer').default; var Authenticator = requireModule('simple-auth-devise/authenticators/devise').default; var Authorizer = requireModule('simple-auth-devise/authorizers/devise').default; global.SimpleAuth.Authenticators.Devise = Authenticator; global.SimpleAuth.Authorizers.Devise = Authorizer; requireModule('simple-auth-devise/ember'); })((typeof global !== 'undefined') ? global : window);
wallin/cdnjs
ajax/libs/ember-simple-auth/0.6.2/simple-auth-devise.js
JavaScript
mit
11,324
/* * Copyright GoInstant, Inc. and other contributors. All rights reserved. * 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 net = require('net'); var urlParse = require('url').parse; var pubsuffix = require('./pubsuffix'); var Store = require('./store').Store; var punycode; try { punycode = require('punycode'); } catch(e) { console.warn("cookie: can't load punycode; won't use punycode for domain normalization"); } var DATE_DELIM = /[\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]/; // From RFC2616 S2.2: var TOKEN = /[\x21\x23-\x26\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7A\x7C\x7E]/; // From RFC6265 S4.1.1 // note that it excludes \x3B ";" var COOKIE_OCTET = /[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]/; var COOKIE_OCTETS = new RegExp('^'+COOKIE_OCTET.source+'$'); // The name/key cannot be empty but the value can (S5.2): var COOKIE_PAIR_STRICT = new RegExp('^('+TOKEN.source+'+)=("?)('+COOKIE_OCTET.source+'*)\\2$'); var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/; // RFC6265 S4.1.1 defines extension-av as 'any CHAR except CTLs or ";"' // Note ';' is \x3B var NON_CTL_SEMICOLON = /[\x20-\x3A\x3C-\x7E]+/; var EXTENSION_AV = NON_CTL_SEMICOLON; var PATH_VALUE = NON_CTL_SEMICOLON; // Used for checking whether or not there is a trailing semi-colon var TRAILING_SEMICOLON = /;+$/; /* RFC6265 S5.1.1.5: * [fail if] the day-of-month-value is less than 1 or greater than 31 */ var DAY_OF_MONTH = /^(0?[1-9]|[12][0-9]|3[01])$/; /* RFC6265 S5.1.1.5: * [fail if] * * the hour-value is greater than 23, * * the minute-value is greater than 59, or * * the second-value is greater than 59. */ var TIME = /(0?[0-9]|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])/; var STRICT_TIME = /^(0?[0-9]|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/; var MONTH = /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)$/i; var MONTH_TO_NUM = { jan:0, feb:1, mar:2, apr:3, may:4, jun:5, jul:6, aug:7, sep:8, oct:9, nov:10, dec:11 }; var NUM_TO_MONTH = [ 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec' ]; var NUM_TO_DAY = [ 'Sun','Mon','Tue','Wed','Thu','Fri','Sat' ]; var YEAR = /^([1-9][0-9]{1,3})$/; // 2 to 4 digits var MAX_TIME = 2147483647000; // 31-bit max var MIN_TIME = 0; // 31-bit min // RFC6265 S5.1.1 date parser: function parseDate(str,strict) { if (!str) { return; } var found_time, found_dom, found_month, found_year; /* RFC6265 S5.1.1: * 2. Process each date-token sequentially in the order the date-tokens * appear in the cookie-date */ var tokens = str.split(DATE_DELIM); if (!tokens) { return; } var date = new Date(); date.setMilliseconds(0); for (var i=0; i<tokens.length; i++) { var token = tokens[i].trim(); if (!token.length) { continue; } var result; /* 2.1. If the found-time flag is not set and the token matches the time * production, set the found-time flag and set the hour- value, * minute-value, and second-value to the numbers denoted by the digits in * the date-token, respectively. Skip the remaining sub-steps and continue * to the next date-token. */ if (!found_time) { result = (strict ? STRICT_TIME : TIME).exec(token); if (result) { found_time = true; date.setUTCHours(result[1]); date.setUTCMinutes(result[2]); date.setUTCSeconds(result[3]); continue; } } /* 2.2. If the found-day-of-month flag is not set and the date-token matches * the day-of-month production, set the found-day-of- month flag and set * the day-of-month-value to the number denoted by the date-token. Skip * the remaining sub-steps and continue to the next date-token. */ if (!found_dom) { result = DAY_OF_MONTH.exec(token); if (result) { found_dom = true; date.setUTCDate(result[1]); continue; } } /* 2.3. If the found-month flag is not set and the date-token matches the * month production, set the found-month flag and set the month-value to * the month denoted by the date-token. Skip the remaining sub-steps and * continue to the next date-token. */ if (!found_month) { result = MONTH.exec(token); if (result) { found_month = true; date.setUTCMonth(MONTH_TO_NUM[result[1].toLowerCase()]); continue; } } /* 2.4. If the found-year flag is not set and the date-token matches the year * production, set the found-year flag and set the year-value to the number * denoted by the date-token. Skip the remaining sub-steps and continue to * the next date-token. */ if (!found_year) { result = YEAR.exec(token); if (result) { var year = result[0]; /* From S5.1.1: * 3. If the year-value is greater than or equal to 70 and less * than or equal to 99, increment the year-value by 1900. * 4. If the year-value is greater than or equal to 0 and less * than or equal to 69, increment the year-value by 2000. */ if (70 <= year && year <= 99) { year += 1900; } else if (0 <= year && year <= 69) { year += 2000; } if (year < 1601) { return; // 5. ... the year-value is less than 1601 } found_year = true; date.setUTCFullYear(year); continue; } } } if (!(found_time && found_dom && found_month && found_year)) { return; // 5. ... at least one of the found-day-of-month, found-month, found- // year, or found-time flags is not set, } return date; } function formatDate(date) { var d = date.getUTCDate(); d = d >= 10 ? d : '0'+d; var h = date.getUTCHours(); h = h >= 10 ? h : '0'+h; var m = date.getUTCMinutes(); m = m >= 10 ? m : '0'+m; var s = date.getUTCSeconds(); s = s >= 10 ? s : '0'+s; return NUM_TO_DAY[date.getUTCDay()] + ', ' + d+' '+ NUM_TO_MONTH[date.getUTCMonth()] +' '+ date.getUTCFullYear() +' '+ h+':'+m+':'+s+' GMT'; } // S5.1.2 Canonicalized Host Names function canonicalDomain(str) { if (str == null) { return null; } str = str.trim().replace(/^\./,''); // S4.1.2.3 & S5.2.3: ignore leading . // convert to IDN if any non-ASCII characters if (punycode && /[^\u0001-\u007f]/.test(str)) { str = punycode.toASCII(str); } return str.toLowerCase(); } // S5.1.3 Domain Matching function domainMatch(str, domStr, canonicalize) { if (str == null || domStr == null) { return null; } if (canonicalize !== false) { str = canonicalDomain(str); domStr = canonicalDomain(domStr); } /* * "The domain string and the string are identical. (Note that both the * domain string and the string will have been canonicalized to lower case at * this point)" */ if (str == domStr) { return true; } /* "All of the following [three] conditions hold:" (order adjusted from the RFC) */ /* "* The string is a host name (i.e., not an IP address)." */ if (net.isIP(str)) { return false; } /* "* The domain string is a suffix of the string" */ var idx = str.indexOf(domStr); if (idx <= 0) { return false; // it's a non-match (-1) or prefix (0) } // e.g "a.b.c".indexOf("b.c") === 2 // 5 === 3+2 if (str.length !== domStr.length + idx) { // it's not a suffix return false; } /* "* The last character of the string that is not included in the domain * string is a %x2E (".") character." */ if (str.substr(idx-1,1) !== '.') { return false; } return true; } // RFC6265 S5.1.4 Paths and Path-Match /* * "The user agent MUST use an algorithm equivalent to the following algorithm * to compute the default-path of a cookie:" * * Assumption: the path (and not query part or absolute uri) is passed in. */ function defaultPath(path) { // "2. If the uri-path is empty or if the first character of the uri-path is not // a %x2F ("/") character, output %x2F ("/") and skip the remaining steps. if (!path || path.substr(0,1) !== "/") { return "/"; } // "3. If the uri-path contains no more than one %x2F ("/") character, output // %x2F ("/") and skip the remaining step." if (path === "/") { return path; } var rightSlash = path.lastIndexOf("/"); if (rightSlash === 0) { return "/"; } // "4. Output the characters of the uri-path from the first character up to, // but not including, the right-most %x2F ("/")." return path.slice(0, rightSlash); } /* * "A request-path path-matches a given cookie-path if at least one of the * following conditions holds:" */ function pathMatch(reqPath,cookiePath) { // "o The cookie-path and the request-path are identical." if (cookiePath === reqPath) { return true; } var idx = reqPath.indexOf(cookiePath); if (idx === 0) { // "o The cookie-path is a prefix of the request-path, and the last // character of the cookie-path is %x2F ("/")." if (cookiePath.substr(-1) === "/") { return true; } // " o The cookie-path is a prefix of the request-path, and the first // character of the request-path that is not included in the cookie- path // is a %x2F ("/") character." if (reqPath.substr(cookiePath.length,1) === "/") { return true; } } return false; } function parse(str, strict) { str = str.trim(); // S4.1.1 Trailing semi-colons are not part of the specification. // If we are not in strict mode we remove the trailing semi-colons. var semiColonCheck = TRAILING_SEMICOLON.exec(str); if (semiColonCheck) { if (strict) { return; } str = str.slice(0, semiColonCheck.index); } // We use a regex to parse the "name-value-pair" part of S5.2 var firstSemi = str.indexOf(';'); // S5.2 step 1 var pairRx = strict ? COOKIE_PAIR_STRICT : COOKIE_PAIR; var result = pairRx.exec(firstSemi === -1 ? str : str.substr(0,firstSemi)); // Rx satisfies the "the name string is empty" and "lacks a %x3D ("=")" // constraints as well as trimming any whitespace. if (!result) { return; } var c = new Cookie(); c.key = result[1]; // the regexp should trim() already c.value = result[3]; // [2] is quotes or empty-string if (firstSemi === -1) { return c; } // S5.2.3 "unparsed-attributes consist of the remainder of the set-cookie-string // (including the %x3B (";") in question)." plus later on in the same section // "discard the first ";" and trim". var unparsed = str.slice(firstSemi).replace(/^\s*;\s*/,'').trim(); // "If the unparsed-attributes string is empty, skip the rest of these // steps." if (unparsed.length === 0) { return c; } /* * S5.2 says that when looping over the items "[p]rocess the attribute-name * and attribute-value according to the requirements in the following * subsections" for every item. Plus, for many of the individual attributes * in S5.3 it says to use the "attribute-value of the last attribute in the * cookie-attribute-list". Therefore, in this implementation, we overwrite * the previous value. */ var cookie_avs = unparsed.split(/\s*;\s*/); while (cookie_avs.length) { var av = cookie_avs.shift(); if (strict && !EXTENSION_AV.test(av)) { return; } var av_sep = av.indexOf('='); var av_key, av_value; if (av_sep === -1) { av_key = av; av_value = null; } else { av_key = av.substr(0,av_sep); av_value = av.substr(av_sep+1); } av_key = av_key.trim().toLowerCase(); if (av_value) { av_value = av_value.trim(); } switch(av_key) { case 'expires': // S5.2.1 if (!av_value) {if(strict){return;}else{break;} } var exp = parseDate(av_value,strict); // "If the attribute-value failed to parse as a cookie date, ignore the // cookie-av." if (exp == null) { if(strict){return;}else{break;} } c.expires = exp; // over and underflow not realistically a concern: V8's getTime() seems to // store something larger than a 32-bit time_t (even with 32-bit node) break; case 'max-age': // S5.2.2 if (!av_value) { if(strict){return;}else{break;} } // "If the first character of the attribute-value is not a DIGIT or a "-" // character ...[or]... If the remainder of attribute-value contains a // non-DIGIT character, ignore the cookie-av." if (!/^-?[0-9]+$/.test(av_value)) { if(strict){return;}else{break;} } var delta = parseInt(av_value,10); if (strict && delta <= 0) { return; // S4.1.1 } // "If delta-seconds is less than or equal to zero (0), let expiry-time // be the earliest representable date and time." c.setMaxAge(delta); break; case 'domain': // S5.2.3 // "If the attribute-value is empty, the behavior is undefined. However, // the user agent SHOULD ignore the cookie-av entirely." if (!av_value) { if(strict){return;}else{break;} } // S5.2.3 "Let cookie-domain be the attribute-value without the leading %x2E // (".") character." var domain = av_value.trim().replace(/^\./,''); if (!domain) { if(strict){return;}else{break;} } // see "is empty" above // "Convert the cookie-domain to lower case." c.domain = domain.toLowerCase(); break; case 'path': // S5.2.4 /* * "If the attribute-value is empty or if the first character of the * attribute-value is not %x2F ("/"): * Let cookie-path be the default-path. * Otherwise: * Let cookie-path be the attribute-value." * * We'll represent the default-path as null since it depends on the * context of the parsing. */ if (!av_value || av_value.substr(0,1) != "/") { if(strict){return;}else{break;} } c.path = av_value; break; case 'secure': // S5.2.5 /* * "If the attribute-name case-insensitively matches the string "Secure", * the user agent MUST append an attribute to the cookie-attribute-list * with an attribute-name of Secure and an empty attribute-value." */ if (av_value != null) { if(strict){return;} } c.secure = true; break; case 'httponly': // S5.2.6 -- effectively the same as 'secure' if (av_value != null) { if(strict){return;} } c.httpOnly = true; break; default: c.extensions = c.extensions || []; c.extensions.push(av); break; } } // ensure a default date for sorting: c.creation = new Date(); return c; } function fromJSON(str) { if (!str) { return null; } var obj; try { obj = JSON.parse(str); } catch (e) { return null; } var c = new Cookie(); for (var i=0; i<numCookieProperties; i++) { var prop = cookieProperties[i]; if (obj[prop] == null) { continue; } if (prop === 'expires' || prop === 'creation' || prop === 'lastAccessed') { c[prop] = obj[prop] == "Infinity" ? "Infinity" : new Date(obj[prop]); } else { c[prop] = obj[prop]; } } // ensure a default date for sorting: c.creation = c.creation || new Date(); return c; } /* Section 5.4 part 2: * "* Cookies with longer paths are listed before cookies with * shorter paths. * * * Among cookies that have equal-length path fields, cookies with * earlier creation-times are listed before cookies with later * creation-times." */ function cookieCompare(a,b) { // descending for length: b CMP a var deltaLen = (b.path ? b.path.length : 0) - (a.path ? a.path.length : 0); if (deltaLen !== 0) { return deltaLen; } // ascending for time: a CMP b return (a.creation ? a.creation.getTime() : MAX_TIME) - (b.creation ? b.creation.getTime() : MAX_TIME); } // Gives the permutation of all possible domainMatch()es of a given domain. The // array is in shortest-to-longest order. Handy for indexing. function permuteDomain(domain) { var pubSuf = pubsuffix.getPublicSuffix(domain); if (!pubSuf) { return null; } if (pubSuf == domain) { return [domain]; } var prefix = domain.slice(0,-(pubSuf.length+1)); // ".example.com" var parts = prefix.split('.').reverse(); var cur = pubSuf; var permutations = [cur]; while (parts.length) { cur = parts.shift()+'.'+cur; permutations.push(cur); } return permutations; } // Gives the permutation of all possible pathMatch()es of a given path. The // array is in longest-to-shortest order. Handy for indexing. function permutePath(path) { if (path === '/') { return ['/']; } if (path.lastIndexOf('/') === path.length-1) { path = path.substr(0,path.length-1); } var permutations = [path]; while (path.length > 1) { var lindex = path.lastIndexOf('/'); if (lindex === 0) { break; } path = path.substr(0,lindex); permutations.push(path); } permutations.push('/'); return permutations; } function Cookie (opts) { if (typeof opts !== "object") { return; } Object.keys(opts).forEach(function (key) { if (Cookie.prototype.hasOwnProperty(key)) { this[key] = opts[key] || Cookie.prototype[key]; } }.bind(this)); } Cookie.parse = parse; Cookie.fromJSON = fromJSON; Cookie.prototype.key = ""; Cookie.prototype.value = ""; // the order in which the RFC has them: Cookie.prototype.expires = "Infinity"; // coerces to literal Infinity Cookie.prototype.maxAge = null; // takes precedence over expires for TTL Cookie.prototype.domain = null; Cookie.prototype.path = null; Cookie.prototype.secure = false; Cookie.prototype.httpOnly = false; Cookie.prototype.extensions = null; // set by the CookieJar: Cookie.prototype.hostOnly = null; // boolean when set Cookie.prototype.pathIsDefault = null; // boolean when set Cookie.prototype.creation = null; // Date when set; defaulted by Cookie.parse Cookie.prototype.lastAccessed = null; // Date when set var cookieProperties = Object.freeze(Object.keys(Cookie.prototype).map(function(p) { if (p instanceof Function) { return; } return p; })); var numCookieProperties = cookieProperties.length; Cookie.prototype.inspect = function inspect() { var now = Date.now(); return 'Cookie="'+this.toString() + '; hostOnly='+(this.hostOnly != null ? this.hostOnly : '?') + '; aAge='+(this.lastAccessed ? (now-this.lastAccessed.getTime())+'ms' : '?') + '; cAge='+(this.creation ? (now-this.creation.getTime())+'ms' : '?') + '"'; }; Cookie.prototype.validate = function validate() { if (!COOKIE_OCTETS.test(this.value)) { return false; } if (this.expires != Infinity && !(this.expires instanceof Date) && !parseDate(this.expires,true)) { return false; } if (this.maxAge != null && this.maxAge <= 0) { return false; // "Max-Age=" non-zero-digit *DIGIT } if (this.path != null && !PATH_VALUE.test(this.path)) { return false; } var cdomain = this.cdomain(); if (cdomain) { if (cdomain.match(/\.$/)) { return false; // S4.1.2.3 suggests that this is bad. domainMatch() tests confirm this } var suffix = pubsuffix.getPublicSuffix(cdomain); if (suffix == null) { // it's a public suffix return false; } } return true; }; Cookie.prototype.setExpires = function setExpires(exp) { if (exp instanceof Date) { this.expires = exp; } else { this.expires = parseDate(exp) || "Infinity"; } }; Cookie.prototype.setMaxAge = function setMaxAge(age) { if (age === Infinity || age === -Infinity) { this.maxAge = age.toString(); // so JSON.stringify() works } else { this.maxAge = age; } }; // gives Cookie header format Cookie.prototype.cookieString = function cookieString() { var val = this.value; if (val == null) { val = ''; } return this.key+'='+val; }; // gives Set-Cookie header format Cookie.prototype.toString = function toString() { var str = this.cookieString(); if (this.expires != Infinity) { if (this.expires instanceof Date) { str += '; Expires='+formatDate(this.expires); } else { str += '; Expires='+this.expires; } } if (this.maxAge != null && this.maxAge != Infinity) { str += '; Max-Age='+this.maxAge; } if (this.domain && !this.hostOnly) { str += '; Domain='+this.domain; } if (this.path) { str += '; Path='+this.path; } if (this.secure) { str += '; Secure'; } if (this.httpOnly) { str += '; HttpOnly'; } if (this.extensions) { this.extensions.forEach(function(ext) { str += '; '+ext; }); } return str; }; // TTL() partially replaces the "expiry-time" parts of S5.3 step 3 (setCookie() // elsewhere) // S5.3 says to give the "latest representable date" for which we use Infinity // For "expired" we use 0 Cookie.prototype.TTL = function TTL(now) { /* RFC6265 S4.1.2.2 If a cookie has both the Max-Age and the Expires * attribute, the Max-Age attribute has precedence and controls the * expiration date of the cookie. * (Concurs with S5.3 step 3) */ if (this.maxAge != null) { return this.maxAge<=0 ? 0 : this.maxAge*1000; } var expires = this.expires; if (expires != Infinity) { if (!(expires instanceof Date)) { expires = parseDate(expires) || Infinity; } if (expires == Infinity) { return Infinity; } return expires.getTime() - (now || Date.now()); } return Infinity; }; // expiryTime() replaces the "expiry-time" parts of S5.3 step 3 (setCookie() // elsewhere) Cookie.prototype.expiryTime = function expiryTime(now) { if (this.maxAge != null) { var relativeTo = this.creation || now || new Date(); var age = (this.maxAge <= 0) ? -Infinity : this.maxAge*1000; return relativeTo.getTime() + age; } if (this.expires == Infinity) { return Infinity; } return this.expires.getTime(); }; // expiryDate() replaces the "expiry-time" parts of S5.3 step 3 (setCookie() // elsewhere), except it returns a Date Cookie.prototype.expiryDate = function expiryDate(now) { var millisec = this.expiryTime(now); if (millisec == Infinity) { return new Date(MAX_TIME); } else if (millisec == -Infinity) { return new Date(MIN_TIME); } else { return new Date(millisec); } }; // This replaces the "persistent-flag" parts of S5.3 step 3 Cookie.prototype.isPersistent = function isPersistent() { return (this.maxAge != null || this.expires != Infinity); }; // Mostly S5.1.2 and S5.2.3: Cookie.prototype.cdomain = Cookie.prototype.canonicalizedDomain = function canonicalizedDomain() { if (this.domain == null) { return null; } return canonicalDomain(this.domain); }; var memstore; function CookieJar(store, rejectPublicSuffixes) { if (rejectPublicSuffixes != null) { this.rejectPublicSuffixes = rejectPublicSuffixes; } if (!store) { memstore = memstore || require('./memstore'); store = new memstore.MemoryCookieStore(); } this.store = store; } CookieJar.prototype.store = null; CookieJar.prototype.rejectPublicSuffixes = true; var CAN_BE_SYNC = []; CAN_BE_SYNC.push('setCookie'); CookieJar.prototype.setCookie = function(cookie, url, options, cb) { var err; var context = (url instanceof Object) ? url : urlParse(url); if (options instanceof Function) { cb = options; options = {}; } var host = canonicalDomain(context.hostname); // S5.3 step 1 if (!(cookie instanceof Cookie)) { cookie = Cookie.parse(cookie, options.strict === true); } if (!cookie) { err = new Error("Cookie failed to parse"); return cb(options.ignoreError ? null : err); } // S5.3 step 2 var now = options.now || new Date(); // will assign later to save effort in the face of errors // S5.3 step 3: NOOP; persistent-flag and expiry-time is handled by getCookie() // S5.3 step 4: NOOP; domain is null by default // S5.3 step 5: public suffixes if (this.rejectPublicSuffixes && cookie.domain) { var suffix = pubsuffix.getPublicSuffix(cookie.cdomain()); if (suffix == null) { // e.g. "com" err = new Error("Cookie has domain set to a public suffix"); return cb(options.ignoreError ? null : err); } } // S5.3 step 6: if (cookie.domain) { if (!domainMatch(host, cookie.cdomain(), false)) { err = new Error("Cookie not in this host's domain. Cookie:"+cookie.cdomain()+" Request:"+host); return cb(options.ignoreError ? null : err); } if (cookie.hostOnly == null) { // don't reset if already set cookie.hostOnly = false; } } else { cookie.hostOnly = true; cookie.domain = host; } // S5.3 step 7: "Otherwise, set the cookie's path to the default-path of the // request-uri" if (!cookie.path) { cookie.path = defaultPath(context.pathname); cookie.pathIsDefault = true; } else { if (cookie.path.length > 1 && cookie.path.substr(-1) == '/') { cookie.path = cookie.path.slice(0,-1); } } // S5.3 step 8: NOOP; secure attribute // S5.3 step 9: NOOP; httpOnly attribute // S5.3 step 10 if (options.http === false && cookie.httpOnly) { err = new Error("Cookie is HttpOnly and this isn't an HTTP API"); return cb(options.ignoreError ? null : err); } var store = this.store; if (!store.updateCookie) { store.updateCookie = function(oldCookie, newCookie, cb) { this.putCookie(newCookie, cb); }; } function withCookie(err, oldCookie) { if (err) { return cb(err); } var next = function(err) { if (err) { return cb(err); } else { cb(null, cookie); } }; if (oldCookie) { // S5.3 step 11 - "If the cookie store contains a cookie with the same name, // domain, and path as the newly created cookie:" if (options.http === false && oldCookie.httpOnly) { // step 11.2 err = new Error("old Cookie is HttpOnly and this isn't an HTTP API"); return cb(options.ignoreError ? null : err); } cookie.creation = oldCookie.creation; // step 11.3 cookie.lastAccessed = now; // Step 11.4 (delete cookie) is implied by just setting the new one: store.updateCookie(oldCookie, cookie, next); // step 12 } else { cookie.creation = cookie.lastAccessed = now; store.putCookie(cookie, next); // step 12 } } store.findCookie(cookie.domain, cookie.path, cookie.key, withCookie); }; // RFC6365 S5.4 CAN_BE_SYNC.push('getCookies'); CookieJar.prototype.getCookies = function(url, options, cb) { var context = (url instanceof Object) ? url : urlParse(url); if (options instanceof Function) { cb = options; options = {}; } var host = canonicalDomain(context.hostname); var path = context.pathname || '/'; var secure = options.secure; if (secure == null && context.protocol && (context.protocol == 'https:' || context.protocol == 'wss:')) { secure = true; } var http = options.http; if (http == null) { http = true; } var now = options.now || Date.now(); var expireCheck = options.expire !== false; var allPaths = !!options.allPaths; var store = this.store; function matchingCookie(c) { // "Either: // The cookie's host-only-flag is true and the canonicalized // request-host is identical to the cookie's domain. // Or: // The cookie's host-only-flag is false and the canonicalized // request-host domain-matches the cookie's domain." if (c.hostOnly) { if (c.domain != host) { return false; } } else { if (!domainMatch(host, c.domain, false)) { return false; } } // "The request-uri's path path-matches the cookie's path." if (!allPaths && !pathMatch(path, c.path)) { return false; } // "If the cookie's secure-only-flag is true, then the request-uri's // scheme must denote a "secure" protocol" if (c.secure && !secure) { return false; } // "If the cookie's http-only-flag is true, then exclude the cookie if the // cookie-string is being generated for a "non-HTTP" API" if (c.httpOnly && !http) { return false; } // deferred from S5.3 // non-RFC: allow retention of expired cookies by choice if (expireCheck && c.expiryTime() <= now) { store.removeCookie(c.domain, c.path, c.key, function(){}); // result ignored return false; } return true; } store.findCookies(host, allPaths ? null : path, function(err,cookies) { if (err) { return cb(err); } cookies = cookies.filter(matchingCookie); // sorting of S5.4 part 2 if (options.sort !== false) { cookies = cookies.sort(cookieCompare); } // S5.4 part 3 var now = new Date(); cookies.forEach(function(c) { c.lastAccessed = now; }); // TODO persist lastAccessed cb(null,cookies); }); }; CAN_BE_SYNC.push('getCookieString'); CookieJar.prototype.getCookieString = function(/*..., cb*/) { var args = Array.prototype.slice.call(arguments,0); var cb = args.pop(); var next = function(err,cookies) { if (err) { cb(err); } else { cb(null, cookies.map(function(c){ return c.cookieString(); }).join('; ')); } }; args.push(next); this.getCookies.apply(this,args); }; CAN_BE_SYNC.push('getSetCookieStrings'); CookieJar.prototype.getSetCookieStrings = function(/*..., cb*/) { var args = Array.prototype.slice.call(arguments,0); var cb = args.pop(); var next = function(err,cookies) { if (err) { cb(err); } else { cb(null, cookies.map(function(c){ return c.toString(); })); } }; args.push(next); this.getCookies.apply(this,args); }; // Use a closure to provide a true imperative API for synchronous stores. function syncWrap(method) { return function() { if (!this.store.synchronous) { throw new Error('CookieJar store is not synchronous; use async API instead.'); } var args = Array.prototype.slice.call(arguments); var syncErr, syncResult; args.push(function syncCb(err, result) { syncErr = err; syncResult = result; }); this[method].apply(this, args); if (syncErr) { throw syncErr; } return syncResult; }; } // wrap all declared CAN_BE_SYNC methods in the sync wrapper CAN_BE_SYNC.forEach(function(method) { CookieJar.prototype[method+'Sync'] = syncWrap(method); }); module.exports = { CookieJar: CookieJar, Cookie: Cookie, Store: Store, parseDate: parseDate, formatDate: formatDate, parse: parse, fromJSON: fromJSON, domainMatch: domainMatch, defaultPath: defaultPath, pathMatch: pathMatch, getPublicSuffix: pubsuffix.getPublicSuffix, cookieCompare: cookieCompare, permuteDomain: permuteDomain, permutePath: permutePath, canonicalDomain: canonicalDomain, };
Alfafa/Facebook
node_modules/bower/node_modules/insight/node_modules/tough-cookie/lib/cookie.js
JavaScript
mit
31,891
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Translation\Tests; use Symfony\Component\Translation\MessageCatalogue; class MessageCatalogueTest extends \PHPUnit_Framework_TestCase { public function testGetLocale() { $catalogue = new MessageCatalogue('en'); $this->assertEquals('en', $catalogue->getLocale()); } public function testGetDomains() { $catalogue = new MessageCatalogue('en', array('domain1' => array(), 'domain2' => array())); $this->assertEquals(array('domain1', 'domain2'), $catalogue->getDomains()); } public function testAll() { $catalogue = new MessageCatalogue('en', $messages = array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); $this->assertEquals(array('foo' => 'foo'), $catalogue->all('domain1')); $this->assertEquals(array(), $catalogue->all('domain88')); $this->assertEquals($messages, $catalogue->all()); } public function testHas() { $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); $this->assertTrue($catalogue->has('foo', 'domain1')); $this->assertFalse($catalogue->has('bar', 'domain1')); $this->assertFalse($catalogue->has('foo', 'domain88')); } public function testGetSet() { $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); $catalogue->set('foo1', 'foo1', 'domain1'); $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); } public function testAdd() { $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); $catalogue->add(array('foo1' => 'foo1'), 'domain1'); $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); $catalogue->add(array('foo' => 'bar'), 'domain1'); $this->assertEquals('bar', $catalogue->get('foo', 'domain1')); $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); $catalogue->add(array('foo' => 'bar'), 'domain88'); $this->assertEquals('bar', $catalogue->get('foo', 'domain88')); } public function testReplace() { $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); $catalogue->replace($messages = array('foo1' => 'foo1'), 'domain1'); $this->assertEquals($messages, $catalogue->all('domain1')); } public function testAddCatalogue() { if (!class_exists('Symfony\Component\Config\Loader\Loader')) { $this->markTestSkipped('The "Config" component is not available'); } $r = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface'); $r->expects($this->any())->method('__toString')->will($this->returnValue('r')); $r1 = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface'); $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1')); $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); $catalogue->addResource($r); $catalogue1 = new MessageCatalogue('en', array('domain1' => array('foo1' => 'foo1'))); $catalogue1->addResource($r1); $catalogue->addCatalogue($catalogue1); $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); $this->assertEquals(array($r, $r1), $catalogue->getResources()); } public function testAddFallbackCatalogue() { if (!class_exists('Symfony\Component\Config\Loader\Loader')) { $this->markTestSkipped('The "Config" component is not available'); } $r = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface'); $r->expects($this->any())->method('__toString')->will($this->returnValue('r')); $r1 = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface'); $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1')); $catalogue = new MessageCatalogue('en_US', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); $catalogue->addResource($r); $catalogue1 = new MessageCatalogue('en', array('domain1' => array('foo' => 'bar', 'foo1' => 'foo1'))); $catalogue1->addResource($r1); $catalogue->addFallbackCatalogue($catalogue1); $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); $this->assertEquals(array($r, $r1), $catalogue->getResources()); } /** * @expectedException LogicException */ public function testAddFallbackCatalogueWithCircularReference() { $main = new MessageCatalogue('en_US'); $fallback = new MessageCatalogue('fr_FR'); $fallback->addFallbackCatalogue($main); $main->addFallbackCatalogue($fallback); } /** * @expectedException LogicException */ public function testAddCatalogueWhenLocaleIsNotTheSameAsTheCurrentOne() { $catalogue = new MessageCatalogue('en'); $catalogue->addCatalogue(new MessageCatalogue('fr', array())); } public function testGetAddResource() { if (!class_exists('Symfony\Component\Config\Loader\Loader')) { $this->markTestSkipped('The "Config" component is not available'); } $catalogue = new MessageCatalogue('en'); $r = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface'); $r->expects($this->any())->method('__toString')->will($this->returnValue('r')); $catalogue->addResource($r); $catalogue->addResource($r); $r1 = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface'); $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1')); $catalogue->addResource($r1); $this->assertEquals(array($r, $r1), $catalogue->getResources()); } }
tdidierjean/picdump
vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
PHP
mit
6,645
<!doctype html> <!-- @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <html> <head> <title>focused-state</title> <script src="../../webcomponentsjs/webcomponents-lite.js"></script> <script src="../../web-component-tester/browser.js"></script> <script src="../../iron-test-helpers/mock-interactions.js"></script> <link rel="import" href="test-elements.html"> </head> <body> <test-fixture id="TrivialFocusedState"> <template> <test-control tabindex="-1"></test-control> </template> </test-fixture> <test-fixture id="NestedFocusedState"> <template> <nested-focusable></nested-focusable> </template> </test-fixture> <test-fixture id="LightDOM"> <template> <test-light-dom> <input id="input"> <nested-focusable></nested-focusable> </test-light-dom> </template> </test-fixture> <script> suite('focused-state', function() { var focusTarget; setup(function() { focusTarget = fixture('TrivialFocusedState'); }); suite('when is focused', function() { test('receives a focused attribute', function() { expect(focusTarget.hasAttribute('focused')).to.be.eql(false); MockInteractions.focus(focusTarget); expect(focusTarget.hasAttribute('focused')).to.be.eql(true); }); test('focused property is true', function() { expect(focusTarget.focused).to.not.be.eql(true); MockInteractions.focus(focusTarget); expect(focusTarget.focused).to.be.eql(true); }); }); suite('when is blurred', function() { test('loses the focused attribute', function() { MockInteractions.focus(focusTarget); expect(focusTarget.hasAttribute('focused')).to.be.eql(true); MockInteractions.blur(focusTarget); expect(focusTarget.hasAttribute('focused')).to.be.eql(false); }); test('focused property is false', function() { MockInteractions.focus(focusTarget); expect(focusTarget.focused).to.be.eql(true); MockInteractions.blur(focusTarget); expect(focusTarget.focused).to.be.eql(false); }); }); suite('when the focused state is disabled', function() { test('will not be focusable', function() { var blurSpy = sinon.spy(focusTarget, 'blur'); MockInteractions.focus(focusTarget); focusTarget.disabled = true; expect(focusTarget.getAttribute('tabindex')).to.be.eql('-1'); expect(blurSpy.called).to.be.eql(true); }); }); }); suite('nested focusable', function() { var focusable; setup(function() { focusable = fixture('NestedFocusedState'); }); test('focus/blur events fired on host element', function() { var nFocusEvents = 0; var nBlurEvents = 0; focusable.addEventListener('focus', function() { nFocusEvents += 1; expect(focusable.focused).to.be.equal(true); MockInteractions.blur(focusable.$.input); }); focusable.addEventListener('blur', function() { expect(focusable.focused).to.be.equal(false); nBlurEvents += 1; }); MockInteractions.focus(focusable.$.input); expect(nBlurEvents).to.be.greaterThan(0); expect(nFocusEvents).to.be.greaterThan(0); }); }); suite('elements in the light dom', function() { var lightDOM, input, lightDescendantShadowInput; setup(function() { lightDOM = fixture('LightDOM'); input = document.querySelector('#input'); lightDescendantShadowInput = Polymer.dom(lightDOM) .querySelector('nested-focusable').$.input; }); test('should not fire the focus event', function() { var nFocusEvents = 0; lightDOM.addEventListener('focus', function() { nFocusEvents += 1; }); MockInteractions.focus(input); expect(nFocusEvents).to.be.equal(0); }); test('should not fire the focus event from shadow descendants', function() { var nFocusEvents = 0; lightDOM.addEventListener('focus', function() { nFocusEvents += 1; }); MockInteractions.focus(lightDescendantShadowInput); expect(nFocusEvents).to.be.equal(0); }); }); </script> </body> </html>
gdg-minsk/devfest-website
bower_components/iron-behaviors/test/focused-state.html
HTML
mit
4,882
var path = require('path'); var expect = require('expect.js') var resolvers = require('rewire')('../lib/resolvers') require.cache[require.resolve('../lib/resolvers')] = { exports: resolvers } var requiregModule = require('../lib/requireg') var isWin32 = process.platform === 'win32' var homeVar = isWin32 ? 'USERPROFILE' : 'HOME' var homePath = process.env[homeVar] describe('requireg', function () { it('should be a function', function () { expect(requiregModule).to.be.a('function') }) describe('requireg API', function () { it('should globalize', function () { requiregModule.globalize() expect(requireg).to.be.a('function') }) }) describe('local modules', function () { it('should resolve a local module', function () { expect(requiregModule('expect.js')).to.be.equal(expect) }) it('should throw an Error exception when no local module exists', function () { expect(function () { requiregModule('nonexistent') }).to.throwError() }) }) describe('global modules', function () { describe('resolve via NODE_PATH', function () { before(function () { process.env.NODE_PATH = path.join(__dirname, 'fixtures', 'lib'); }) after(function () { process.env.NODE_PATH = '' }) it('should resolve the beaker package', function () { expect(requiregModule('beaker')).to.be.true }) it('should have the expected module path', function () { expect(requiregModule.resolve('beaker')) .to.be.equal(path.join(__dirname, 'fixtures', 'lib', 'node_modules', 'beaker', 'index.js')) }) }) describe('resolve via $HOME', function () { before(function () { process.env[homeVar] = path.join(__dirname, 'fixtures', 'lib') }) after(function () { process.env[homeVar] = homePath }) it('should resolve the beaker package', function () { expect(requiregModule('beaker')).to.be.true }) }) describe('resolve via $NODE_MODULES', function () { before(function () { process.env.NODE_MODULES = path.join(__dirname, 'fixtures', 'lib') }) after(function () { process.env.NODE_MODULES = '' }) it('should resolve the beaker package', function () { expect(requiregModule('beaker')).to.be.true }) }) describe('resolve via node execution path', function () { var execPath = process.execPath var rc = require('rc') before(function () { process.execPath = path.join(__dirname, 'fixtures', (isWin32 ? 'lib' : 'bin'), 'node') }) after(function () { process.execPath = execPath }) it('should resolve the beaker package', function () { expect(requiregModule('beaker')).to.be.true }) it('should have the expected module path', function () { expect(requiregModule.resolve('beaker')) .to.be.equal(path.join(__dirname, 'fixtures', 'lib', 'node_modules', 'beaker', 'index.js')) }) }) describe('resolve via npm prefix', function () { var rc = require('rc') before(function () { resolvers.__set__('rc', function () { return { prefix: path.join(__dirname, 'fixtures', (isWin32 ? 'lib' : '')) } }) }) after(function () { resolvers.__set__('rc', rc) }) it('should resolve the beaker package', function () { expect(requiregModule('beaker')).to.be.true }) it('should have the expected module path', function () { expect(requiregModule.resolve('beaker')) .to.be.equal(path.join(__dirname, 'fixtures', 'lib', 'node_modules', 'beaker', 'index.js')) }) }) }) })
oooofeiger/recruit-webapp
node_modules/bower/lib/node_modules/requireg/test/requiregSpec.js
JavaScript
mit
3,790
// Copyright 2014 Software Freedom Conservancy. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. goog.require('bot.ErrorCode'); goog.require('goog.Uri'); goog.require('goog.json'); goog.require('goog.testing.MockControl'); goog.require('goog.testing.jsunit'); goog.require('webdriver.Command'); goog.require('webdriver.http.Client'); goog.require('webdriver.http.Executor'); goog.require('webdriver.promise'); goog.require('webdriver.test.testutil'); // Alias for readability. var callbackHelper = webdriver.test.testutil.callbackHelper; var control = new goog.testing.MockControl(); var mockClient, executor, onCallback, onErrback; function setUp() { mockClient = control.createStrictMock(webdriver.http.Client); executor = new webdriver.http.Executor(mockClient); } function tearDown() { control.$tearDown(); } function assertSuccess() { onErrback.assertNotCalled('Did not expect errback'); onCallback.assertCalled('Expected callback'); } function assertFailure() { onCallback.assertNotCalled('Did not expect callback'); onErrback.assertCalled('Expected errback'); } function headersToString(headers) { var str = []; for (var key in headers) { str.push(key + ': ' + headers[key]); } return str.join('\n'); } function expectRequest(method, path, data, headers) { var description = method + ' ' + path + '\n' + headersToString(headers) + '\n' + goog.json.serialize(data); return mockClient.send(new goog.testing.mockmatchers.ArgumentMatcher( function(request) { assertEquals('wrong method', method, request.method); assertEquals('wrong path', path + '', request.path); webdriver.test.testutil.assertObjectEquals(data, request.data); assertNull( 'Wrong headers for request:\n' + description + '\n Actual headers were:\n' + headersToString(request.headers), goog.testing.asserts.findDifferences(headers, request.headers)); return true; }, description), goog.testing.mockmatchers.isFunction); } function response(status, headers, body) { return new webdriver.http.Response(status, headers, body); } function respondsWith(error, opt_response) { return function(request, callback) { callback(error, opt_response); }; } /////////////////////////////////////////////////////////////////////////////// // // Tests // /////////////////////////////////////////////////////////////////////////////// function testBuildPath() { var parameters = {'sessionId':'foo', 'url':'http://www.google.com'}; var finalPath = webdriver.http.Executor.buildPath_( '/session/:sessionId/url', parameters); assertEquals('/session/foo/url', finalPath); webdriver.test.testutil.assertObjectEquals({'url':'http://www.google.com'}, parameters); } function testBuildPath_withWebElement() { var parameters = {'sessionId':'foo', 'id': {}}; parameters['id']['ELEMENT'] = 'bar'; var finalPath = webdriver.http.Executor.buildPath_( '/session/:sessionId/element/:id/click', parameters); assertEquals('/session/foo/element/bar/click', finalPath); webdriver.test.testutil.assertObjectEquals({}, parameters); } function testBuildPath_throwsIfMissingParameter() { assertThrows(goog.partial(webdriver.http.Executor.buildPath_, '/session/:sessionId', {})); assertThrows(goog.partial(webdriver.http.Executor.buildPath_, '/session/:sessionId/element/:id', {'sessionId': 'foo'})); } function testBuildPath_doesNotMatchOnSegmentsThatDoNotStartWithColon() { assertEquals('/session/foo:bar/baz', webdriver.http.Executor.buildPath_('/session/foo:bar/baz', {})); } function testExecute_rejectsUnrecognisedCommands() { assertThrows(goog.bind(executor.execute, executor, new webdriver.Command('fake-command-name'), goog.nullFunction)); } /** * @param {!webdriver.Command} command The command to send. * @param {!Function=} opt_onSuccess The function to check the response with. */ function assertSendsSuccessfully(command, opt_onSuccess) { var callback; executor.execute(command, callback = callbackHelper(function(e, response) { assertNull(e); assertNotNullNorUndefined(response); if (opt_onSuccess) { opt_onSuccess(response); } })); callback.assertCalled(); control.$verifyAll(); } /** * @param {!webdriver.Command} command The command to send. * @param {!Function=} opt_onError The function to check the error with. */ function assertFailsToSend(command, opt_onError) { var callback; executor.execute(command, callback = callbackHelper(function(e, response) { assertNotNullNorUndefined(e); assertUndefined(response); if (opt_onError) { opt_onError(e); } })); callback.assertCalled(); control.$verifyAll(); } function testExecute_clientFailsToSendRequest() { var error = new Error('boom'); expectRequest('POST', '/session', {}, { 'Accept': 'application/json; charset=utf-8' }). $does(respondsWith(error)); control.$replayAll(); assertFailsToSend(new webdriver.Command(webdriver.CommandName.NEW_SESSION), function(e) { assertEquals(error, e); }); } function testExecute_commandWithNoUrlParameters() { expectRequest('POST', '/session', {}, { 'Accept': 'application/json; charset=utf-8' }). $does(respondsWith(null, response(200, {}, ''))); control.$replayAll(); assertSendsSuccessfully( new webdriver.Command(webdriver.CommandName.NEW_SESSION)); } function testExecute_rejectsCommandsMissingUrlParameters() { var command = new webdriver.Command(webdriver.CommandName.FIND_CHILD_ELEMENT). setParameter('sessionId', 's123'). // Let this be missing: setParameter('id', {'ELEMENT': 'e456'}). setParameter('using', 'id'). setParameter('value', 'foo'); control.$replayAll(); assertThrows(goog.bind(executor.execute, executor, command)); control.$verifyAll(); } function testExecute_replacesUrlParametersWithCommandParameters() { var command = new webdriver.Command(webdriver.CommandName.GET). setParameter('sessionId', 's123'). setParameter('url', 'http://www.google.com'); expectRequest('POST', '/session/s123/url', {'url': 'http://www.google.com'}, {'Accept': 'application/json; charset=utf-8'}). $does(respondsWith(null, response(200, {}, ''))); control.$replayAll(); assertSendsSuccessfully(command); } function testExecute_returnsParsedJsonResponse() { var responseObj = { 'status': bot.ErrorCode.SUCCESS, 'value': 'http://www.google.com' }; var command = new webdriver.Command(webdriver.CommandName.GET_CURRENT_URL). setParameter('sessionId', 's123'); expectRequest('GET', '/session/s123/url', {}, { 'Accept': 'application/json; charset=utf-8' }).$does(respondsWith(null, response(200, {'Content-Type': 'application/json'}, goog.json.serialize(responseObj)))); control.$replayAll(); assertSendsSuccessfully(command, function(response) { webdriver.test.testutil.assertObjectEquals(responseObj, response); }); } function testExecute_returnsSuccessFor2xxWithBodyAsValueWhenNotJson() { var command = new webdriver.Command(webdriver.CommandName.GET_CURRENT_URL). setParameter('sessionId', 's123'); expectRequest('GET', '/session/s123/url', {}, { 'Accept': 'application/json; charset=utf-8' }).$does(respondsWith(null, response(200, {}, 'hello, world\r\ngoodbye, world!'))); control.$replayAll(); assertSendsSuccessfully(command, function(response) { webdriver.test.testutil.assertObjectEquals({ 'status': bot.ErrorCode.SUCCESS, 'value': 'hello, world\ngoodbye, world!' }, response); }); } function testExecute_returnsSuccessFor2xxInvalidJsonBody() { var invalidJson = '['; expectRequest('POST', '/session', {}, { 'Accept': 'application/json; charset=utf-8' }). $does(respondsWith(null, response(200, { 'Content-Type': 'application/json' }, invalidJson))); control.$replayAll(); assertSendsSuccessfully( new webdriver.Command(webdriver.CommandName.NEW_SESSION), function(response) { webdriver.test.testutil.assertObjectEquals({ 'status': bot.ErrorCode.SUCCESS, 'value': invalidJson }, response); }); } function testExecute_returnsUnknownCommandFor404WithBodyAsValueWhenNotJson() { var command = new webdriver.Command(webdriver.CommandName.GET_CURRENT_URL). setParameter('sessionId', 's123'); expectRequest('GET', '/session/s123/url', {}, { 'Accept': 'application/json; charset=utf-8' }).$does(respondsWith(null, response(404, {}, 'hello, world\r\ngoodbye, world!'))); control.$replayAll(); assertSendsSuccessfully(command, function(response) { webdriver.test.testutil.assertObjectEquals({ 'status': bot.ErrorCode.UNKNOWN_COMMAND, 'value': 'hello, world\ngoodbye, world!' }, response); }); } function testExecute_returnsUnknownErrorForGenericErrorCodeWithBodyAsValueWhenNotJson() { var command = new webdriver.Command(webdriver.CommandName.GET_CURRENT_URL). setParameter('sessionId', 's123'); expectRequest('GET', '/session/s123/url', {}, { 'Accept': 'application/json; charset=utf-8' }).$does(respondsWith(null, response(500, {}, 'hello, world\r\ngoodbye, world!'))); control.$replayAll(); assertSendsSuccessfully(command, function(response) { webdriver.test.testutil.assertObjectEquals({ 'status': bot.ErrorCode.UNKNOWN_ERROR, 'value': 'hello, world\ngoodbye, world!' }, response); }); } function testExecute_attemptsToParseBodyWhenNoContentTypeSpecified() { var responseObj = { 'status': bot.ErrorCode.SUCCESS, 'value': 'http://www.google.com' }; var command = new webdriver.Command(webdriver.CommandName.GET_CURRENT_URL). setParameter('sessionId', 's123'); expectRequest('GET', '/session/s123/url', {}, { 'Accept': 'application/json; charset=utf-8' }).$does(respondsWith(null, response(200, {}, goog.json.serialize(responseObj)))); control.$replayAll(); assertSendsSuccessfully(command, function(response) { webdriver.test.testutil.assertObjectEquals(responseObj, response); }); } function FakeXmlHttpRequest(headers, status, responseText) { return { getAllResponseHeaders: function() { return headers; }, status: status, responseText: responseText }; } function testXmlHttpRequestToHttpResponse_parseHeaders_windows() { var response = webdriver.http.Response.fromXmlHttpRequest( FakeXmlHttpRequest([ 'a:b', 'c: d', 'e :f', 'g : h' ].join('\r\n'), 200, '')); assertEquals(200, response.status); assertEquals('', response.body); webdriver.test.testutil.assertObjectEquals({ 'a': 'b', 'c': 'd', 'e': 'f', 'g': 'h' }, response.headers); } function testXmlHttpRequestToHttpResponse_parseHeaders_unix() { var response = webdriver.http.Response.fromXmlHttpRequest( FakeXmlHttpRequest([ 'a:b', 'c: d', 'e :f', 'g : h' ].join('\n'), 200, '')); assertEquals(200, response.status); assertEquals('', response.body); webdriver.test.testutil.assertObjectEquals({ 'a': 'b', 'c': 'd', 'e': 'f', 'g': 'h' }, response.headers); } function testXmlHttpRequestToHttpResponse_noHeaders() { var response = webdriver.http.Response.fromXmlHttpRequest( FakeXmlHttpRequest('', 200, '')); assertEquals(200, response.status); assertEquals('', response.body); webdriver.test.testutil.assertObjectEquals({}, response.headers); } function testXmlHttpRequestToHttpResponse_stripsNullCharactersFromBody() { var response = webdriver.http.Response.fromXmlHttpRequest( FakeXmlHttpRequest('', 200, '\x00\0foo\x00\x00bar\x00\0')); assertEquals(200, response.status); assertEquals('foobar', response.body); webdriver.test.testutil.assertObjectEquals({}, response.headers); }
LeoYeh/AngularJs-root-dev-Base
node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/test/http/http_test.js
JavaScript
mit
12,522
/*! ======================================================= VERSION 4.5.5 ========================================================= */ /*! ========================================================= * bootstrap-slider.js * * Maintainers: * Kyle Kemp * - Twitter: @seiyria * - Github: seiyria * Rohit Kalkur * - Twitter: @Rovolutionary * - Github: rovolution * * ========================================================= * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================= */ !function(a,b){if("function"==typeof define&&define.amd)define(["jquery"],b);else if("object"==typeof module&&module.exports){var c;try{c=require("jquery")}catch(d){c=null}module.exports=b(c)}else a.Slider=b(a.jQuery)}(this,function(a){var b;return function(a){"use strict";function b(){}function c(a){function c(b){b.prototype.option||(b.prototype.option=function(b){a.isPlainObject(b)&&(this.options=a.extend(!0,this.options,b))})}function e(b,c){a.fn[b]=function(e){if("string"==typeof e){for(var g=d.call(arguments,1),h=0,i=this.length;i>h;h++){var j=this[h],k=a.data(j,b);if(k)if(a.isFunction(k[e])&&"_"!==e.charAt(0)){var l=k[e].apply(k,g);if(void 0!==l&&l!==k)return l}else f("no such method '"+e+"' for "+b+" instance");else f("cannot call methods on "+b+" prior to initialization; attempted to call '"+e+"'")}return this}var m=this.map(function(){var d=a.data(this,b);return d?(d.option(e),d._init()):(d=new c(this,e),a.data(this,b,d)),a(this)});return!m||m.length>1?m:m[0]}}if(a){var f="undefined"==typeof console?b:function(a){console.error(a)};return a.bridget=function(a,b){c(b),e(a,b)},a.bridget}}var d=Array.prototype.slice;c(a)}(a),function(a){function c(b,c){function d(a,b){var c="data-slider-"+b.replace(/_/g,"-"),d=a.getAttribute(c);try{return JSON.parse(d)}catch(e){return d}}"string"==typeof b?this.element=document.querySelector(b):b instanceof HTMLElement&&(this.element=b),c=c?c:{};for(var f=Object.keys(this.defaultOptions),g=0;g<f.length;g++){var h=f[g],i=c[h];i="undefined"!=typeof i?i:d(this.element,h),i=null!==i?i:this.defaultOptions[h],this.options||(this.options={}),this.options[h]=i}var j,k,l,m,n,o=this.element.style.width,p=!1,q=this.element.parentNode;if(this.sliderElem)p=!0;else{this.sliderElem=document.createElement("div"),this.sliderElem.className="slider";var r=document.createElement("div");if(r.className="slider-track",k=document.createElement("div"),k.className="slider-track-low",j=document.createElement("div"),j.className="slider-selection",l=document.createElement("div"),l.className="slider-track-high",m=document.createElement("div"),m.className="slider-handle min-slider-handle",n=document.createElement("div"),n.className="slider-handle max-slider-handle",r.appendChild(k),r.appendChild(j),r.appendChild(l),this.ticks=[],Array.isArray(this.options.ticks)&&this.options.ticks.length>0){for(g=0;g<this.options.ticks.length;g++){var s=document.createElement("div");s.className="slider-tick",this.ticks.push(s),r.appendChild(s)}j.className+=" tick-slider-selection"}if(r.appendChild(m),r.appendChild(n),this.tickLabels=[],Array.isArray(this.options.ticks_labels)&&this.options.ticks_labels.length>0)for(this.tickLabelContainer=document.createElement("div"),this.tickLabelContainer.className="slider-tick-label-container",g=0;g<this.options.ticks_labels.length;g++){var t=document.createElement("div");t.className="slider-tick-label",t.innerHTML=this.options.ticks_labels[g],this.tickLabels.push(t),this.tickLabelContainer.appendChild(t)}var u=function(a){var b=document.createElement("div");b.className="tooltip-arrow";var c=document.createElement("div");c.className="tooltip-inner",a.appendChild(b),a.appendChild(c)},v=document.createElement("div");v.className="tooltip tooltip-main",u(v);var w=document.createElement("div");w.className="tooltip tooltip-min",u(w);var x=document.createElement("div");x.className="tooltip tooltip-max",u(x),this.sliderElem.appendChild(r),this.sliderElem.appendChild(v),this.sliderElem.appendChild(w),this.sliderElem.appendChild(x),this.tickLabelContainer&&this.sliderElem.appendChild(this.tickLabelContainer),q.insertBefore(this.sliderElem,this.element),this.element.style.display="none"}if(a&&(this.$element=a(this.element),this.$sliderElem=a(this.sliderElem)),this.eventToCallbackMap={},this.sliderElem.id=this.options.id,this.touchCapable="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,this.tooltip=this.sliderElem.querySelector(".tooltip-main"),this.tooltipInner=this.tooltip.querySelector(".tooltip-inner"),this.tooltip_min=this.sliderElem.querySelector(".tooltip-min"),this.tooltipInner_min=this.tooltip_min.querySelector(".tooltip-inner"),this.tooltip_max=this.sliderElem.querySelector(".tooltip-max"),this.tooltipInner_max=this.tooltip_max.querySelector(".tooltip-inner"),e[this.options.scale]&&(this.options.scale=e[this.options.scale]),p===!0&&(this._removeClass(this.sliderElem,"slider-horizontal"),this._removeClass(this.sliderElem,"slider-vertical"),this._removeClass(this.tooltip,"hide"),this._removeClass(this.tooltip_min,"hide"),this._removeClass(this.tooltip_max,"hide"),["left","top","width","height"].forEach(function(a){this._removeProperty(this.trackLow,a),this._removeProperty(this.trackSelection,a),this._removeProperty(this.trackHigh,a)},this),[this.handle1,this.handle2].forEach(function(a){this._removeProperty(a,"left"),this._removeProperty(a,"top")},this),[this.tooltip,this.tooltip_min,this.tooltip_max].forEach(function(a){this._removeProperty(a,"left"),this._removeProperty(a,"top"),this._removeProperty(a,"margin-left"),this._removeProperty(a,"margin-top"),this._removeClass(a,"right"),this._removeClass(a,"top")},this)),"vertical"===this.options.orientation?(this._addClass(this.sliderElem,"slider-vertical"),this.stylePos="top",this.mousePos="pageY",this.sizePos="offsetHeight",this._addClass(this.tooltip,"right"),this.tooltip.style.left="100%",this._addClass(this.tooltip_min,"right"),this.tooltip_min.style.left="100%",this._addClass(this.tooltip_max,"right"),this.tooltip_max.style.left="100%"):(this._addClass(this.sliderElem,"slider-horizontal"),this.sliderElem.style.width=o,this.options.orientation="horizontal",this.stylePos="left",this.mousePos="pageX",this.sizePos="offsetWidth",this._addClass(this.tooltip,"top"),this.tooltip.style.top=-this.tooltip.outerHeight-14+"px",this._addClass(this.tooltip_min,"top"),this.tooltip_min.style.top=-this.tooltip_min.outerHeight-14+"px",this._addClass(this.tooltip_max,"top"),this.tooltip_max.style.top=-this.tooltip_max.outerHeight-14+"px"),Array.isArray(this.options.ticks)&&this.options.ticks.length>0&&(this.options.max=Math.max.apply(Math,this.options.ticks),this.options.min=Math.min.apply(Math,this.options.ticks)),Array.isArray(this.options.value)?this.options.range=!0:this.options.range&&(this.options.value=[this.options.value,this.options.max]),this.trackLow=k||this.trackLow,this.trackSelection=j||this.trackSelection,this.trackHigh=l||this.trackHigh,"none"===this.options.selection&&(this._addClass(this.trackLow,"hide"),this._addClass(this.trackSelection,"hide"),this._addClass(this.trackHigh,"hide")),this.handle1=m||this.handle1,this.handle2=n||this.handle2,p===!0)for(this._removeClass(this.handle1,"round triangle"),this._removeClass(this.handle2,"round triangle hide"),g=0;g<this.ticks.length;g++)this._removeClass(this.ticks[g],"round triangle hide");var y=["round","triangle","custom"],z=-1!==y.indexOf(this.options.handle);if(z)for(this._addClass(this.handle1,this.options.handle),this._addClass(this.handle2,this.options.handle),g=0;g<this.ticks.length;g++)this._addClass(this.ticks[g],this.options.handle);this.offset=this._offset(this.sliderElem),this.size=this.sliderElem[this.sizePos],this.setValue(this.options.value),this.handle1Keydown=this._keydown.bind(this,0),this.handle1.addEventListener("keydown",this.handle1Keydown,!1),this.handle2Keydown=this._keydown.bind(this,1),this.handle2.addEventListener("keydown",this.handle2Keydown,!1),this.mousedown=this._mousedown.bind(this),this.touchCapable&&this.sliderElem.addEventListener("touchstart",this.mousedown,!1),this.sliderElem.addEventListener("mousedown",this.mousedown,!1),"hide"===this.options.tooltip?(this._addClass(this.tooltip,"hide"),this._addClass(this.tooltip_min,"hide"),this._addClass(this.tooltip_max,"hide")):"always"===this.options.tooltip?(this._showTooltip(),this._alwaysShowTooltip=!0):(this.showTooltip=this._showTooltip.bind(this),this.hideTooltip=this._hideTooltip.bind(this),this.sliderElem.addEventListener("mouseenter",this.showTooltip,!1),this.sliderElem.addEventListener("mouseleave",this.hideTooltip,!1),this.handle1.addEventListener("focus",this.showTooltip,!1),this.handle1.addEventListener("blur",this.hideTooltip,!1),this.handle2.addEventListener("focus",this.showTooltip,!1),this.handle2.addEventListener("blur",this.hideTooltip,!1)),this.options.enabled?this.enable():this.disable()}var d={formatInvalidInputErrorMsg:function(a){return"Invalid input value '"+a+"' passed in"},callingContextNotSliderInstance:"Calling context element does not have instance of Slider bound to it. Check your code to make sure the JQuery object returned from the call to the slider() initializer is calling the method"},e={linear:{toValue:function(a){var b=a/100*(this.options.max-this.options.min),c=this.options.min+Math.round(b/this.options.step)*this.options.step;return c<this.options.min?this.options.min:c>this.options.max?this.options.max:c},toPercentage:function(a){return this.options.max===this.options.min?0:100*(a-this.options.min)/(this.options.max-this.options.min)}},logarithmic:{toValue:function(a){var b=0===this.options.min?0:Math.log(this.options.min),c=Math.log(this.options.max);return Math.exp(b+(c-b)*a/100)},toPercentage:function(a){if(this.options.max===this.options.min)return 0;var b=Math.log(this.options.max),c=0===this.options.min?0:Math.log(this.options.min),d=0===a?0:Math.log(a);return 100*(d-c)/(b-c)}}};if(b=function(a,b){return c.call(this,a,b),this},b.prototype={_init:function(){},constructor:b,defaultOptions:{id:"",min:0,max:10,step:1,precision:0,orientation:"horizontal",value:5,range:!1,selection:"before",tooltip:"show",tooltip_split:!1,handle:"round",reversed:!1,enabled:!0,formatter:function(a){return Array.isArray(a)?a[0]+" : "+a[1]:a},natural_arrow_keys:!1,ticks:[],ticks_labels:[],ticks_snap_bounds:0,scale:"linear"},over:!1,inDrag:!1,getValue:function(){return this.options.range?this.options.value:this.options.value[0]},setValue:function(a,b){a||(a=0);var c=this.getValue();this.options.value=this._validateInputValue(a);var d=this._applyPrecision.bind(this);this.options.range?(this.options.value[0]=d(this.options.value[0]),this.options.value[1]=d(this.options.value[1]),this.options.value[0]=Math.max(this.options.min,Math.min(this.options.max,this.options.value[0])),this.options.value[1]=Math.max(this.options.min,Math.min(this.options.max,this.options.value[1]))):(this.options.value=d(this.options.value),this.options.value=[Math.max(this.options.min,Math.min(this.options.max,this.options.value))],this._addClass(this.handle2,"hide"),this.options.value[1]="after"===this.options.selection?this.options.max:this.options.min),this.percentage=this.options.max>this.options.min?[this._toPercentage(this.options.value[0]),this._toPercentage(this.options.value[1]),100*this.options.step/(this.options.max-this.options.min)]:[0,0,100],this._layout();var e=this.options.range?this.options.value:this.options.value[0];return b===!0&&this._trigger("slide",e),c!==e&&this._trigger("change",{oldValue:c,newValue:e}),this._setDataVal(e),this},destroy:function(){this._removeSliderEventHandlers(),this.sliderElem.parentNode.removeChild(this.sliderElem),this.element.style.display="",this._cleanUpEventCallbacksMap(),this.element.removeAttribute("data"),a&&(this._unbindJQueryEventHandlers(),this.$element.removeData("slider"))},disable:function(){return this.options.enabled=!1,this.handle1.removeAttribute("tabindex"),this.handle2.removeAttribute("tabindex"),this._addClass(this.sliderElem,"slider-disabled"),this._trigger("slideDisabled"),this},enable:function(){return this.options.enabled=!0,this.handle1.setAttribute("tabindex",0),this.handle2.setAttribute("tabindex",0),this._removeClass(this.sliderElem,"slider-disabled"),this._trigger("slideEnabled"),this},toggle:function(){return this.options.enabled?this.disable():this.enable(),this},isEnabled:function(){return this.options.enabled},on:function(a,b){return this._bindNonQueryEventHandler(a,b),this},getAttribute:function(a){return a?this.options[a]:this.options},setAttribute:function(a,b){return this.options[a]=b,this},refresh:function(){return this._removeSliderEventHandlers(),c.call(this,this.element,this.options),a&&a.data(this.element,"slider",this),this},relayout:function(){return this._layout(),this},_removeSliderEventHandlers:function(){this.handle1.removeEventListener("keydown",this.handle1Keydown,!1),this.handle1.removeEventListener("focus",this.showTooltip,!1),this.handle1.removeEventListener("blur",this.hideTooltip,!1),this.handle2.removeEventListener("keydown",this.handle2Keydown,!1),this.handle2.removeEventListener("focus",this.handle2Keydown,!1),this.handle2.removeEventListener("blur",this.handle2Keydown,!1),this.sliderElem.removeEventListener("mouseenter",this.showTooltip,!1),this.sliderElem.removeEventListener("mouseleave",this.hideTooltip,!1),this.sliderElem.removeEventListener("touchstart",this.mousedown,!1),this.sliderElem.removeEventListener("mousedown",this.mousedown,!1)},_bindNonQueryEventHandler:function(a,b){void 0===this.eventToCallbackMap[a]&&(this.eventToCallbackMap[a]=[]),this.eventToCallbackMap[a].push(b)},_cleanUpEventCallbacksMap:function(){for(var a=Object.keys(this.eventToCallbackMap),b=0;b<a.length;b++){var c=a[b];this.eventToCallbackMap[c]=null}},_showTooltip:function(){this.options.tooltip_split===!1?this._addClass(this.tooltip,"in"):(this._addClass(this.tooltip_min,"in"),this._addClass(this.tooltip_max,"in")),this.over=!0},_hideTooltip:function(){this.inDrag===!1&&this.alwaysShowTooltip!==!0&&(this._removeClass(this.tooltip,"in"),this._removeClass(this.tooltip_min,"in"),this._removeClass(this.tooltip_max,"in")),this.over=!1},_layout:function(){var a;if(a=this.options.reversed?[100-this.percentage[0],this.percentage[1]]:[this.percentage[0],this.percentage[1]],this.handle1.style[this.stylePos]=a[0]+"%",this.handle2.style[this.stylePos]=a[1]+"%",Array.isArray(this.options.ticks)&&this.options.ticks.length>0){var b=Math.max.apply(Math,this.options.ticks),c=Math.min.apply(Math,this.options.ticks),d="vertical"===this.options.orientation?"height":"width",e="vertical"===this.options.orientation?"marginTop":"marginLeft",f=this.size/(this.options.ticks.length-1);if(this.tickLabelContainer&&(this.tickLabelContainer.style[e]=-f/2+"px","horizontal"===this.options.orientation)){var g=this.tickLabelContainer.offsetHeight-this.sliderElem.offsetHeight;this.sliderElem.style.marginBottom=g+"px"}for(var h=0;h<this.options.ticks.length;h++){var i=100*(this.options.ticks[h]-c)/(b-c);this.ticks[h].style[this.stylePos]=i+"%",this._removeClass(this.ticks[h],"in-selection"),i<=a[0]&&!this.options.range?this._addClass(this.ticks[h],"in-selection"):i>=a[0]&&i<=a[1]&&this._addClass(this.ticks[h],"in-selection"),this.tickLabels[h]&&(this.tickLabels[h].style[d]=f+"px")}}if("vertical"===this.options.orientation)this.trackLow.style.top="0",this.trackLow.style.height=Math.min(a[0],a[1])+"%",this.trackSelection.style.top=Math.min(a[0],a[1])+"%",this.trackSelection.style.height=Math.abs(a[0]-a[1])+"%",this.trackHigh.style.bottom="0",this.trackHigh.style.height=100-Math.min(a[0],a[1])-Math.abs(a[0]-a[1])+"%";else{this.trackLow.style.left="0",this.trackLow.style.width=Math.min(a[0],a[1])+"%",this.trackSelection.style.left=Math.min(a[0],a[1])+"%",this.trackSelection.style.width=Math.abs(a[0]-a[1])+"%",this.trackHigh.style.right="0",this.trackHigh.style.width=100-Math.min(a[0],a[1])-Math.abs(a[0]-a[1])+"%";var j=this.tooltip_min.getBoundingClientRect(),k=this.tooltip_max.getBoundingClientRect();j.right>k.left?(this._removeClass(this.tooltip_max,"top"),this._addClass(this.tooltip_max,"bottom"),this.tooltip_max.style.top="18px"):(this._removeClass(this.tooltip_max,"bottom"),this._addClass(this.tooltip_max,"top"),this.tooltip_max.style.top=this.tooltip_min.style.top)}var l;if(this.options.range){l=this.options.formatter(this.options.value),this._setText(this.tooltipInner,l),this.tooltip.style[this.stylePos]=(a[1]+a[0])/2+"%","vertical"===this.options.orientation?this._css(this.tooltip,"margin-top",-this.tooltip.offsetHeight/2+"px"):this._css(this.tooltip,"margin-left",-this.tooltip.offsetWidth/2+"px"),"vertical"===this.options.orientation?this._css(this.tooltip,"margin-top",-this.tooltip.offsetHeight/2+"px"):this._css(this.tooltip,"margin-left",-this.tooltip.offsetWidth/2+"px");var m=this.options.formatter(this.options.value[0]);this._setText(this.tooltipInner_min,m);var n=this.options.formatter(this.options.value[1]);this._setText(this.tooltipInner_max,n),this.tooltip_min.style[this.stylePos]=a[0]+"%","vertical"===this.options.orientation?this._css(this.tooltip_min,"margin-top",-this.tooltip_min.offsetHeight/2+"px"):this._css(this.tooltip_min,"margin-left",-this.tooltip_min.offsetWidth/2+"px"),this.tooltip_max.style[this.stylePos]=a[1]+"%","vertical"===this.options.orientation?this._css(this.tooltip_max,"margin-top",-this.tooltip_max.offsetHeight/2+"px"):this._css(this.tooltip_max,"margin-left",-this.tooltip_max.offsetWidth/2+"px")}else l=this.options.formatter(this.options.value[0]),this._setText(this.tooltipInner,l),this.tooltip.style[this.stylePos]=a[0]+"%","vertical"===this.options.orientation?this._css(this.tooltip,"margin-top",-this.tooltip.offsetHeight/2+"px"):this._css(this.tooltip,"margin-left",-this.tooltip.offsetWidth/2+"px")},_removeProperty:function(a,b){a.style.removeProperty?a.style.removeProperty(b):a.style.removeAttribute(b)},_mousedown:function(a){if(!this.options.enabled)return!1;this._triggerFocusOnHandle(),this.offset=this._offset(this.sliderElem),this.size=this.sliderElem[this.sizePos];var b=this._getPercentage(a);if(this.options.range){var c=Math.abs(this.percentage[0]-b),d=Math.abs(this.percentage[1]-b);this.dragged=d>c?0:1}else this.dragged=0;this.percentage[this.dragged]=this.options.reversed?100-b:b,this._layout(),this.touchCapable&&(document.removeEventListener("touchmove",this.mousemove,!1),document.removeEventListener("touchend",this.mouseup,!1)),this.mousemove&&document.removeEventListener("mousemove",this.mousemove,!1),this.mouseup&&document.removeEventListener("mouseup",this.mouseup,!1),this.mousemove=this._mousemove.bind(this),this.mouseup=this._mouseup.bind(this),this.touchCapable&&(document.addEventListener("touchmove",this.mousemove,!1),document.addEventListener("touchend",this.mouseup,!1)),document.addEventListener("mousemove",this.mousemove,!1),document.addEventListener("mouseup",this.mouseup,!1),this.inDrag=!0;var e=this._calculateValue();return this._trigger("slideStart",e),this._setDataVal(e),this.setValue(e),this._pauseEvent(a),!0},_triggerFocusOnHandle:function(a){0===a&&this.handle1.focus(),1===a&&this.handle2.focus()},_keydown:function(a,b){if(!this.options.enabled)return!1;var c;switch(b.keyCode){case 37:case 40:c=-1;break;case 39:case 38:c=1}if(c){if(this.options.natural_arrow_keys){var d="vertical"===this.options.orientation&&!this.options.reversed,e="horizontal"===this.options.orientation&&this.options.reversed;(d||e)&&(c=-c)}var f=this.options.value[a]+c*this.options.step;return this.options.range&&(f=[a?this.options.value[0]:f,a?f:this.options.value[1]]),this._trigger("slideStart",f),this._setDataVal(f),this.setValue(f,!0),this._trigger("slideStop",f),this._setDataVal(f),this._layout(),this._pauseEvent(b),!1}},_pauseEvent:function(a){a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),a.cancelBubble=!0,a.returnValue=!1},_mousemove:function(a){if(!this.options.enabled)return!1;var b=this._getPercentage(a);this._adjustPercentageForRangeSliders(b),this.percentage[this.dragged]=this.options.reversed?100-b:b,this._layout();var c=this._calculateValue(!0);return this.setValue(c,!0),!1},_adjustPercentageForRangeSliders:function(a){this.options.range&&(0===this.dragged&&this.percentage[1]<a?(this.percentage[0]=this.percentage[1],this.dragged=1):1===this.dragged&&this.percentage[0]>a&&(this.percentage[1]=this.percentage[0],this.dragged=0))},_mouseup:function(){if(!this.options.enabled)return!1;this.touchCapable&&(document.removeEventListener("touchmove",this.mousemove,!1),document.removeEventListener("touchend",this.mouseup,!1)),document.removeEventListener("mousemove",this.mousemove,!1),document.removeEventListener("mouseup",this.mouseup,!1),this.inDrag=!1,this.over===!1&&this._hideTooltip();var a=this._calculateValue(!0);return this._layout(),this._trigger("slideStop",a),this._setDataVal(a),!1},_calculateValue:function(a){var b;if(this.options.range?(b=[this.options.min,this.options.max],0!==this.percentage[0]&&(b[0]=this._toValue(this.percentage[0]),b[0]=this._applyPrecision(b[0])),100!==this.percentage[1]&&(b[1]=this._toValue(this.percentage[1]),b[1]=this._applyPrecision(b[1]))):(b=this._toValue(this.percentage[0]),b=parseFloat(b),b=this._applyPrecision(b)),a){for(var c=[b,1/0],d=0;d<this.options.ticks.length;d++){var e=Math.abs(this.options.ticks[d]-b);e<=c[1]&&(c=[this.options.ticks[d],e])}if(c[1]<=this.options.ticks_snap_bounds)return c[0]}return b},_applyPrecision:function(a){var b=this.options.precision||this._getNumDigitsAfterDecimalPlace(this.options.step);return this._applyToFixedAndParseFloat(a,b)},_getNumDigitsAfterDecimalPlace:function(a){var b=(""+a).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return b?Math.max(0,(b[1]?b[1].length:0)-(b[2]?+b[2]:0)):0},_applyToFixedAndParseFloat:function(a,b){var c=a.toFixed(b);return parseFloat(c)},_getPercentage:function(a){!this.touchCapable||"touchstart"!==a.type&&"touchmove"!==a.type||(a=a.touches[0]);var b=a[this.mousePos],c=this.offset[this.stylePos],d=b-c,e=d/this.size*100;return e=Math.round(e/this.percentage[2])*this.percentage[2],Math.max(0,Math.min(100,e))},_validateInputValue:function(a){if("number"==typeof a)return a;if(Array.isArray(a))return this._validateArray(a),a;throw new Error(d.formatInvalidInputErrorMsg(a))},_validateArray:function(a){for(var b=0;b<a.length;b++){var c=a[b];if("number"!=typeof c)throw new Error(d.formatInvalidInputErrorMsg(c))}},_setDataVal:function(a){var b="value: '"+a+"'";this.element.setAttribute("data",b),this.element.setAttribute("value",a),this.element.value=a},_trigger:function(b,c){c=c||0===c?c:void 0;var d=this.eventToCallbackMap[b];if(d&&d.length)for(var e=0;e<d.length;e++){var f=d[e];f(c)}a&&this._triggerJQueryEvent(b,c)},_triggerJQueryEvent:function(a,b){var c={type:a,value:b};this.$element.trigger(c),this.$sliderElem.trigger(c)},_unbindJQueryEventHandlers:function(){this.$element.off(),this.$sliderElem.off()},_setText:function(a,b){"undefined"!=typeof a.innerText?a.innerText=b:"undefined"!=typeof a.textContent&&(a.textContent=b)},_removeClass:function(a,b){for(var c=b.split(" "),d=a.className,e=0;e<c.length;e++){var f=c[e],g=new RegExp("(?:\\s|^)"+f+"(?:\\s|$)");d=d.replace(g," ")}a.className=d.trim()},_addClass:function(a,b){for(var c=b.split(" "),d=a.className,e=0;e<c.length;e++){var f=c[e],g=new RegExp("(?:\\s|^)"+f+"(?:\\s|$)"),h=g.test(d);h||(d+=" "+f)}a.className=d.trim()},_offset:function(a){if("vertical"===this.options.orientation)return{left:a.offsetLeft,top:a.offsetTop};var b=a.getBoundingClientRect(),c=b.left,d=b.top;return{left:c,top:d}},_css:function(b,c,d){if(a)a.style(b,c,d);else{var e=c.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(a,b){return b.toUpperCase()});b.style[e]=d}},_toValue:function(a){return this.options.scale.toValue.apply(this,[a])},_toPercentage:function(a){return this.options.scale.toPercentage.apply(this,[a])}},a){var f=a.fn.slider?"bootstrapSlider":"slider";a.bridget(f,b)}}(a),b});
hpneo/cdnjs
ajax/libs/bootstrap-slider/4.5.5/bootstrap-slider.min.js
JavaScript
mit
24,620
(function() { var svg; //save off default references var d3 = window.d3, topojson = window.topojson; var defaultOptions = { scope: 'world', responsive: false, aspectRatio: 0.5625, setProjection: setProjection, projection: 'equirectangular', dataType: 'json', data: {}, done: function() {}, fills: { defaultFill: '#ABDDA4' }, filters: {}, geographyConfig: { dataUrl: null, hideAntarctica: true, hideHawaiiAndAlaska : false, borderWidth: 1, borderColor: '#FDFDFD', popupTemplate: function(geography, data) { return '<div class="hoverinfo"><strong>' + geography.properties.name + '</strong></div>'; }, popupOnHover: true, highlightOnHover: true, highlightFillColor: '#FC8D59', highlightBorderColor: 'rgba(250, 15, 160, 0.2)', highlightBorderWidth: 2 }, projectionConfig: { rotation: [97, 0] }, bubblesConfig: { borderWidth: 2, borderColor: '#FFFFFF', popupOnHover: true, radius: null, popupTemplate: function(geography, data) { return '<div class="hoverinfo"><strong>' + data.name + '</strong></div>'; }, fillOpacity: 0.75, animate: true, highlightOnHover: true, highlightFillColor: '#FC8D59', highlightBorderColor: 'rgba(250, 15, 160, 0.2)', highlightBorderWidth: 2, highlightFillOpacity: 0.85, exitDelay: 100, key: JSON.stringify }, arcConfig: { strokeColor: '#DD1C77', strokeWidth: 1, arcSharpness: 1, animationSpeed: 600 } }; /* Getter for value. If not declared on datumValue, look up the chain into optionsValue */ function val( datumValue, optionsValue, context ) { if ( typeof context === 'undefined' ) { context = optionsValue; optionsValues = undefined; } var value = typeof datumValue !== 'undefined' ? datumValue : optionsValue; if (typeof value === 'undefined') { return null; } if ( typeof value === 'function' ) { var fnContext = [context]; if ( context.geography ) { fnContext = [context.geography, context.data]; } return value.apply(null, fnContext); } else { return value; } } function addContainer( element, height, width ) { this.svg = d3.select( element ).append('svg') .attr('width', width || element.offsetWidth) .attr('data-width', width || element.offsetWidth) .attr('class', 'datamap') .attr('height', height || element.offsetHeight) .style('overflow', 'hidden'); // IE10+ doesn't respect height/width when map is zoomed in if (this.options.responsive) { d3.select(this.options.element).style({'position': 'relative', 'padding-bottom': (this.options.aspectRatio*100) + '%'}); d3.select(this.options.element).select('svg').style({'position': 'absolute', 'width': '100%', 'height': '100%'}); d3.select(this.options.element).select('svg').select('g').selectAll('path').style('vector-effect', 'non-scaling-stroke'); } return this.svg; } // setProjection takes the svg element and options function setProjection( element, options ) { var width = options.width || element.offsetWidth; var height = options.height || element.offsetHeight; var projection, path; var svg = this.svg; if ( options && typeof options.scope === 'undefined') { options.scope = 'world'; } if ( options.scope === 'usa' ) { projection = d3.geo.albersUsa() .scale(width) .translate([width / 2, height / 2]); } else if ( options.scope === 'world' ) { projection = d3.geo[options.projection]() .scale((width + 1) / 2 / Math.PI) .translate([width / 2, height / (options.projection === "mercator" ? 1.45 : 1.8)]); } if ( options.projection === 'orthographic' ) { svg.append("defs").append("path") .datum({type: "Sphere"}) .attr("id", "sphere") .attr("d", path); svg.append("use") .attr("class", "stroke") .attr("xlink:href", "#sphere"); svg.append("use") .attr("class", "fill") .attr("xlink:href", "#sphere"); projection.scale(250).clipAngle(90).rotate(options.projectionConfig.rotation) } path = d3.geo.path() .projection( projection ); return {path: path, projection: projection}; } function addStyleBlock() { if ( d3.select('.datamaps-style-block').empty() ) { d3.select('head').append('style').attr('class', 'datamaps-style-block') .html('.datamap path.datamaps-graticule { fill: none; stroke: #777; stroke-width: 0.5px; stroke-opacity: .5; pointer-events: none; } .datamap .labels {pointer-events: none;} .datamap path {stroke: #FFFFFF; stroke-width: 1px;} .datamaps-legend dt, .datamaps-legend dd { float: left; margin: 0 3px 0 0;} .datamaps-legend dd {width: 20px; margin-right: 6px; border-radius: 3px;} .datamaps-legend {padding-bottom: 20px; z-index: 1001; position: absolute; left: 4px; font-size: 12px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;} .datamaps-hoverover {display: none; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } .hoverinfo {padding: 4px; border-radius: 1px; background-color: #FFF; box-shadow: 1px 1px 5px #CCC; font-size: 12px; border: 1px solid #CCC; } .hoverinfo hr {border:1px dotted #CCC; }'); } } function drawSubunits( data ) { var fillData = this.options.fills, colorCodeData = this.options.data || {}, geoConfig = this.options.geographyConfig; var subunits = this.svg.select('g.datamaps-subunits'); if ( subunits.empty() ) { subunits = this.addLayer('datamaps-subunits', null, true); } var geoData = topojson.feature( data, data.objects[ this.options.scope ] ).features; if ( geoConfig.hideAntarctica ) { geoData = geoData.filter(function(feature) { return feature.id !== "ATA"; }); } if ( geoConfig.hideHawaiiAndAlaska ) { geoData = geoData.filter(function(feature) { return feature.id !== "HI" && feature.id !== 'AK'; }); } var geo = subunits.selectAll('path.datamaps-subunit').data( geoData ); geo.enter() .append('path') .attr('d', this.path) .attr('class', function(d) { return 'datamaps-subunit ' + d.id; }) .attr('data-info', function(d) { return JSON.stringify( colorCodeData[d.id]); }) .style('fill', function(d) { //if fillKey - use that //otherwise check 'fill' //otherwise check 'defaultFill' var fillColor; var datum = colorCodeData[d.id]; if ( datum && datum.fillKey ) { fillColor = fillData[ val(datum.fillKey, {data: colorCodeData[d.id], geography: d}) ]; } if ( typeof fillColor === 'undefined' ) { fillColor = val(datum && datum.fillColor, fillData.defaultFill, {data: colorCodeData[d.id], geography: d}); } return fillColor; }) .style('stroke-width', geoConfig.borderWidth) .style('stroke', geoConfig.borderColor); } function handleGeographyConfig () { var hoverover; var svg = this.svg; var self = this; var options = this.options.geographyConfig; if ( options.highlightOnHover || options.popupOnHover ) { svg.selectAll('.datamaps-subunit') .on('mouseover', function(d) { var $this = d3.select(this); var datum = self.options.data[d.id] || {}; if ( options.highlightOnHover ) { var previousAttributes = { 'fill': $this.style('fill'), 'stroke': $this.style('stroke'), 'stroke-width': $this.style('stroke-width'), 'fill-opacity': $this.style('fill-opacity') }; $this .style('fill', val(datum.highlightFillColor, options.highlightFillColor, datum)) .style('stroke', val(datum.highlightBorderColor, options.highlightBorderColor, datum)) .style('stroke-width', val(datum.highlightBorderWidth, options.highlightBorderWidth, datum)) .style('fill-opacity', val(datum.highlightFillOpacity, options.highlightFillOpacity, datum)) .attr('data-previousAttributes', JSON.stringify(previousAttributes)); //as per discussion on https://github.com/markmarkoh/datamaps/issues/19 if ( ! /((MSIE)|(Trident))/.test(navigator.userAgent) ) { moveToFront.call(this); } } if ( options.popupOnHover ) { self.updatePopup($this, d, options, svg); } }) .on('mouseout', function() { var $this = d3.select(this); if (options.highlightOnHover) { //reapply previous attributes var previousAttributes = JSON.parse( $this.attr('data-previousAttributes') ); for ( var attr in previousAttributes ) { $this.style(attr, previousAttributes[attr]); } } $this.on('mousemove', null); d3.selectAll('.datamaps-hoverover').style('display', 'none'); }); } function moveToFront() { this.parentNode.appendChild(this); } } //plugin to add a simple map legend function addLegend(layer, data, options) { data = data || {}; if ( !this.options.fills ) { return; } var html = '<dl>'; var label = ''; if ( data.legendTitle ) { html = '<h2>' + data.legendTitle + '</h2>' + html; } for ( var fillKey in this.options.fills ) { if ( fillKey === 'defaultFill') { if (! data.defaultFillName ) { continue; } label = data.defaultFillName; } else { if (data.labels && data.labels[fillKey]) { label = data.labels[fillKey]; } else { label= fillKey + ': '; } } html += '<dt>' + label + '</dt>'; html += '<dd style="background-color:' + this.options.fills[fillKey] + '">&nbsp;</dd>'; } html += '</dl>'; var hoverover = d3.select( this.options.element ).append('div') .attr('class', 'datamaps-legend') .html(html); } function addGraticule ( layer, options ) { var graticule = d3.geo.graticule(); this.svg.insert("path", '.datamaps-subunits') .datum(graticule) .attr("class", "datamaps-graticule") .attr("d", this.path); } function handleArcs (layer, data, options) { var self = this, svg = this.svg; if ( !data || (data && !data.slice) ) { throw "Datamaps Error - arcs must be an array"; } // For some reason arc options were put in an `options` object instead of the parent arc // I don't like this, so to match bubbles and other plugins I'm moving it // This is to keep backwards compatability for ( var i = 0; i < data.length; i++ ) { data[i] = defaults(data[i], data[i].options); delete data[i].options; } if ( typeof options === "undefined" ) { options = defaultOptions.arcConfig; } var arcs = layer.selectAll('path.datamaps-arc').data( data, JSON.stringify ); var path = d3.geo.path() .projection(self.projection); arcs .enter() .append('svg:path') .attr('class', 'datamaps-arc') .style('stroke-linecap', 'round') .style('stroke', function(datum) { return val(datum.strokeColor, options.strokeColor, datum); }) .style('fill', 'none') .style('stroke-width', function(datum) { return val(datum.strokeWidth, options.strokeWidth, datum); }) .attr('d', function(datum) { var originXY = self.latLngToXY(val(datum.origin.latitude, datum), val(datum.origin.longitude, datum)) var destXY = self.latLngToXY(val(datum.destination.latitude, datum), val(datum.destination.longitude, datum)); var midXY = [ (originXY[0] + destXY[0]) / 2, (originXY[1] + destXY[1]) / 2]; if (options.greatArc) { // TODO: Move this to inside `if` clause when setting attr `d` var greatArc = d3.geo.greatArc() .source(function(d) { return [val(d.origin.longitude, d), val(d.origin.latitude, d)]; }) .target(function(d) { return [val(d.destination.longitude, d), val(d.destination.latitude, d)]; }); return path(greatArc(datum)) } var sharpness = val(datum.arcSharpness, options.arcSharpness, datum); return "M" + originXY[0] + ',' + originXY[1] + "S" + (midXY[0] + (50 * sharpness)) + "," + (midXY[1] - (75 * sharpness)) + "," + destXY[0] + "," + destXY[1]; }) .transition() .delay(100) .style('fill', function(datum) { /* Thank you Jake Archibald, this is awesome. Source: http://jakearchibald.com/2013/animated-line-drawing-svg/ */ var length = this.getTotalLength(); this.style.transition = this.style.WebkitTransition = 'none'; this.style.strokeDasharray = length + ' ' + length; this.style.strokeDashoffset = length; this.getBoundingClientRect(); this.style.transition = this.style.WebkitTransition = 'stroke-dashoffset ' + val(datum.animationSpeed, options.animationSpeed, datum) + 'ms ease-out'; this.style.strokeDashoffset = '0'; return 'none'; }) arcs.exit() .transition() .style('opacity', 0) .remove(); } function handleLabels ( layer, options ) { var self = this; options = options || {}; var labelStartCoodinates = this.projection([-67.707617, 42.722131]); this.svg.selectAll(".datamaps-subunit") .attr("data-foo", function(d) { var center = self.path.centroid(d); var xOffset = 7.5, yOffset = 5; if ( ["FL", "KY", "MI"].indexOf(d.id) > -1 ) xOffset = -2.5; if ( d.id === "NY" ) xOffset = -1; if ( d.id === "MI" ) yOffset = 18; if ( d.id === "LA" ) xOffset = 13; var x,y; x = center[0] - xOffset; y = center[1] + yOffset; var smallStateIndex = ["VT", "NH", "MA", "RI", "CT", "NJ", "DE", "MD", "DC"].indexOf(d.id); if ( smallStateIndex > -1) { var yStart = labelStartCoodinates[1]; x = labelStartCoodinates[0]; y = yStart + (smallStateIndex * (2+ (options.fontSize || 12))); layer.append("line") .attr("x1", x - 3) .attr("y1", y - 5) .attr("x2", center[0]) .attr("y2", center[1]) .style("stroke", options.labelColor || "#000") .style("stroke-width", options.lineWidth || 1) } layer.append("text") .attr("x", x) .attr("y", y) .style("font-size", (options.fontSize || 10) + 'px') .style("font-family", options.fontFamily || "Verdana") .style("fill", options.labelColor || "#000") .text( d.id ); return "bar"; }); } function handleBubbles (layer, data, options ) { var self = this, fillData = this.options.fills, filterData = this.options.filters, svg = this.svg; if ( !data || (data && !data.slice) ) { throw "Datamaps Error - bubbles must be an array"; } var bubbles = layer.selectAll('circle.datamaps-bubble').data( data, options.key ); bubbles .enter() .append('svg:circle') .attr('class', 'datamaps-bubble') .attr('cx', function ( datum ) { var latLng; if ( datumHasCoords(datum) ) { latLng = self.latLngToXY(datum.latitude, datum.longitude); } else if ( datum.centered ) { latLng = self.path.centroid(svg.select('path.' + datum.centered).data()[0]); } if ( latLng ) return latLng[0]; }) .attr('cy', function ( datum ) { var latLng; if ( datumHasCoords(datum) ) { latLng = self.latLngToXY(datum.latitude, datum.longitude); } else if ( datum.centered ) { latLng = self.path.centroid(svg.select('path.' + datum.centered).data()[0]); } if ( latLng ) return latLng[1]; }) .attr('r', function(datum) { // if animation enabled start with radius 0, otherwise use full size. return options.animate ? 0 : val(datum.radius, options.radius, datum); }) .attr('data-info', function(d) { return JSON.stringify(d); }) .attr('filter', function (datum) { var filterKey = filterData[ val(datum.filterKey, options.filterKey, datum) ]; if (filterKey) { return filterKey; } }) .style('stroke', function ( datum ) { return val(datum.borderColor, options.borderColor, datum); }) .style('stroke-width', function ( datum ) { return val(datum.borderWidth, options.borderWidth, datum); }) .style('fill-opacity', function ( datum ) { return val(datum.fillOpacity, options.fillOpacity, datum); }) .style('fill', function ( datum ) { var fillColor = fillData[ val(datum.fillKey, options.fillKey, datum) ]; return fillColor || fillData.defaultFill; }) .on('mouseover', function ( datum ) { var $this = d3.select(this); if (options.highlightOnHover) { //save all previous attributes for mouseout var previousAttributes = { 'fill': $this.style('fill'), 'stroke': $this.style('stroke'), 'stroke-width': $this.style('stroke-width'), 'fill-opacity': $this.style('fill-opacity') }; $this .style('fill', val(datum.highlightFillColor, options.highlightFillColor, datum)) .style('stroke', val(datum.highlightBorderColor, options.highlightBorderColor, datum)) .style('stroke-width', val(datum.highlightBorderWidth, options.highlightBorderWidth, datum)) .style('fill-opacity', val(datum.highlightFillOpacity, options.highlightFillOpacity, datum)) .attr('data-previousAttributes', JSON.stringify(previousAttributes)); } if (options.popupOnHover) { self.updatePopup($this, datum, options, svg); } }) .on('mouseout', function ( datum ) { var $this = d3.select(this); if (options.highlightOnHover) { //reapply previous attributes var previousAttributes = JSON.parse( $this.attr('data-previousAttributes') ); for ( var attr in previousAttributes ) { $this.style(attr, previousAttributes[attr]); } } d3.selectAll('.datamaps-hoverover').style('display', 'none'); }) bubbles.transition() .duration(400) .attr('r', function ( datum ) { return val(datum.radius, options.radius, datum); }); bubbles.exit() .transition() .delay(options.exitDelay) .attr("r", 0) .remove(); function datumHasCoords (datum) { return typeof datum !== 'undefined' && typeof datum.latitude !== 'undefined' && typeof datum.longitude !== 'undefined'; } } //stolen from underscore.js function defaults(obj) { Array.prototype.slice.call(arguments, 1).forEach(function(source) { if (source) { for (var prop in source) { if (obj[prop] == null) obj[prop] = source[prop]; } } }); return obj; } /************************************** Public Functions ***************************************/ function Datamap( options ) { if ( typeof d3 === 'undefined' || typeof topojson === 'undefined' ) { throw new Error('Include d3.js (v3.0.3 or greater) and topojson on this page before creating a new map'); } //set options for global use this.options = defaults(options, defaultOptions); this.options.geographyConfig = defaults(options.geographyConfig, defaultOptions.geographyConfig); this.options.projectionConfig = defaults(options.projectionConfig, defaultOptions.projectionConfig); this.options.bubblesConfig = defaults(options.bubblesConfig, defaultOptions.bubblesConfig); this.options.arcConfig = defaults(options.arcConfig, defaultOptions.arcConfig); //add the SVG container if ( d3.select( this.options.element ).select('svg').length > 0 ) { addContainer.call(this, this.options.element, this.options.height, this.options.width ); } /* Add core plugins to this instance */ this.addPlugin('bubbles', handleBubbles); this.addPlugin('legend', addLegend); this.addPlugin('arc', handleArcs); this.addPlugin('labels', handleLabels); this.addPlugin('graticule', addGraticule); //append style block with basic hoverover styles if ( ! this.options.disableDefaultStyles ) { addStyleBlock(); } return this.draw(); } // resize map Datamap.prototype.resize = function () { var self = this; var options = self.options; if (options.responsive) { var newsize = options.element.clientWidth, oldsize = d3.select( options.element).select('svg').attr('data-width'); d3.select(options.element).select('svg').selectAll('g').attr('transform', 'scale(' + (newsize / oldsize) + ')'); } } // actually draw the features(states & countries) Datamap.prototype.draw = function() { //save off in a closure var self = this; var options = self.options; //set projections and paths based on scope var pathAndProjection = options.setProjection.apply(self, [options.element, options] ); this.path = pathAndProjection.path; this.projection = pathAndProjection.projection; //if custom URL for topojson data, retrieve it and render if ( options.geographyConfig.dataUrl ) { d3.json( options.geographyConfig.dataUrl, function(error, results) { if ( error ) throw new Error(error); self.customTopo = results; draw( results ); }); } else { draw( this[options.scope + 'Topo'] || options.geographyConfig.dataJson); } return this; function draw (data) { // if fetching remote data, draw the map first then call `updateChoropleth` if ( self.options.dataUrl ) { //allow for csv or json data types d3[self.options.dataType](self.options.dataUrl, function(data) { //in the case of csv, transform data to object if ( self.options.dataType === 'csv' && (data && data.slice) ) { var tmpData = {}; for(var i = 0; i < data.length; i++) { tmpData[data[i].id] = data[i]; } data = tmpData; } Datamaps.prototype.updateChoropleth.call(self, data); }); } drawSubunits.call(self, data); handleGeographyConfig.call(self); if ( self.options.geographyConfig.popupOnHover || self.options.bubblesConfig.popupOnHover) { hoverover = d3.select( self.options.element ).append('div') .attr('class', 'datamaps-hoverover') .style('z-index', 10001) .style('position', 'absolute'); } //fire off finished callback self.options.done(self); } }; /************************************** TopoJSON ***************************************/ Datamap.prototype.worldTopo = '__WORLD__'; Datamap.prototype.abwTopo = '__ABW__'; Datamap.prototype.afgTopo = '__AFG__'; Datamap.prototype.agoTopo = '__AGO__'; Datamap.prototype.aiaTopo = '__AIA__'; Datamap.prototype.albTopo = '__ALB__'; Datamap.prototype.aldTopo = '__ALD__'; Datamap.prototype.andTopo = '__AND__'; Datamap.prototype.areTopo = '__ARE__'; Datamap.prototype.argTopo = '__ARG__'; Datamap.prototype.armTopo = '__ARM__'; Datamap.prototype.asmTopo = '__ASM__'; Datamap.prototype.ataTopo = '__ATA__'; Datamap.prototype.atcTopo = '__ATC__'; Datamap.prototype.atfTopo = '__ATF__'; Datamap.prototype.atgTopo = '__ATG__'; Datamap.prototype.ausTopo = '__AUS__'; Datamap.prototype.autTopo = '__AUT__'; Datamap.prototype.azeTopo = '__AZE__'; Datamap.prototype.bdiTopo = '__BDI__'; Datamap.prototype.belTopo = '__BEL__'; Datamap.prototype.benTopo = '__BEN__'; Datamap.prototype.bfaTopo = '__BFA__'; Datamap.prototype.bgdTopo = '__BGD__'; Datamap.prototype.bgrTopo = '__BGR__'; Datamap.prototype.bhrTopo = '__BHR__'; Datamap.prototype.bhsTopo = '__BHS__'; Datamap.prototype.bihTopo = '__BIH__'; Datamap.prototype.bjnTopo = '__BJN__'; Datamap.prototype.blmTopo = '__BLM__'; Datamap.prototype.blrTopo = '__BLR__'; Datamap.prototype.blzTopo = '__BLZ__'; Datamap.prototype.bmuTopo = '__BMU__'; Datamap.prototype.bolTopo = '__BOL__'; Datamap.prototype.braTopo = '__BRA__'; Datamap.prototype.brbTopo = '__BRB__'; Datamap.prototype.brnTopo = '__BRN__'; Datamap.prototype.btnTopo = '__BTN__'; Datamap.prototype.norTopo = '__NOR__'; Datamap.prototype.bwaTopo = '__BWA__'; Datamap.prototype.cafTopo = '__CAF__'; Datamap.prototype.canTopo = '__CAN__'; Datamap.prototype.cheTopo = '__CHE__'; Datamap.prototype.chlTopo = '__CHL__'; Datamap.prototype.chnTopo = '__CHN__'; Datamap.prototype.civTopo = '__CIV__'; Datamap.prototype.clpTopo = '__CLP__'; Datamap.prototype.cmrTopo = '__CMR__'; Datamap.prototype.codTopo = '__COD__'; Datamap.prototype.cogTopo = '__COG__'; Datamap.prototype.cokTopo = '__COK__'; Datamap.prototype.colTopo = '__COL__'; Datamap.prototype.comTopo = '__COM__'; Datamap.prototype.cpvTopo = '__CPV__'; Datamap.prototype.criTopo = '__CRI__'; Datamap.prototype.csiTopo = '__CSI__'; Datamap.prototype.cubTopo = '__CUB__'; Datamap.prototype.cuwTopo = '__CUW__'; Datamap.prototype.cymTopo = '__CYM__'; Datamap.prototype.cynTopo = '__CYN__'; Datamap.prototype.cypTopo = '__CYP__'; Datamap.prototype.czeTopo = '__CZE__'; Datamap.prototype.deuTopo = '__DEU__'; Datamap.prototype.djiTopo = '__DJI__'; Datamap.prototype.dmaTopo = '__DMA__'; Datamap.prototype.dnkTopo = '__DNK__'; Datamap.prototype.domTopo = '__DOM__'; Datamap.prototype.dzaTopo = '__DZA__'; Datamap.prototype.ecuTopo = '__ECU__'; Datamap.prototype.egyTopo = '__EGY__'; Datamap.prototype.eriTopo = '__ERI__'; Datamap.prototype.esbTopo = '__ESB__'; Datamap.prototype.espTopo = '__ESP__'; Datamap.prototype.estTopo = '__EST__'; Datamap.prototype.ethTopo = '__ETH__'; Datamap.prototype.finTopo = '__FIN__'; Datamap.prototype.fjiTopo = '__FJI__'; Datamap.prototype.flkTopo = '__FLK__'; Datamap.prototype.fraTopo = '__FRA__'; Datamap.prototype.froTopo = '__FRO__'; Datamap.prototype.fsmTopo = '__FSM__'; Datamap.prototype.gabTopo = '__GAB__'; Datamap.prototype.psxTopo = '__PSX__'; Datamap.prototype.gbrTopo = '__GBR__'; Datamap.prototype.geoTopo = '__GEO__'; Datamap.prototype.ggyTopo = '__GGY__'; Datamap.prototype.ghaTopo = '__GHA__'; Datamap.prototype.gibTopo = '__GIB__'; Datamap.prototype.ginTopo = '__GIN__'; Datamap.prototype.gmbTopo = '__GMB__'; Datamap.prototype.gnbTopo = '__GNB__'; Datamap.prototype.gnqTopo = '__GNQ__'; Datamap.prototype.grcTopo = '__GRC__'; Datamap.prototype.grdTopo = '__GRD__'; Datamap.prototype.grlTopo = '__GRL__'; Datamap.prototype.gtmTopo = '__GTM__'; Datamap.prototype.gumTopo = '__GUM__'; Datamap.prototype.guyTopo = '__GUY__'; Datamap.prototype.hkgTopo = '__HKG__'; Datamap.prototype.hmdTopo = '__HMD__'; Datamap.prototype.hndTopo = '__HND__'; Datamap.prototype.hrvTopo = '__HRV__'; Datamap.prototype.htiTopo = '__HTI__'; Datamap.prototype.hunTopo = '__HUN__'; Datamap.prototype.idnTopo = '__IDN__'; Datamap.prototype.imnTopo = '__IMN__'; Datamap.prototype.indTopo = '__IND__'; Datamap.prototype.ioaTopo = {"type":"Topology","objects":{"ioa":{"type":"GeometryCollection","geometries":[{"type":"MultiPolygon","properties":{"name":"Cocos (Keeling) Islands"},"id":"-99","arcs":[[[0]],[[1]]]},{"type":"Polygon","properties":{"name":"Christmas Island"},"id":"-99","arcs":[[2]]}]}},"arcs":[[[104,31],[-13,-31],[-11,23],[-3,17],[-2,31],[13,4],[10,26],[7,48],[1,67],[6,-67],[-1,-64],[-7,-54]],[[16,101],[13,-29],[18,31],[7,-35],[-27,-55],[-17,100],[-8,164],[-2,138],[8,0],[0,-55],[1,-46],[6,-91],[-4,-62],[5,-60]],[[9987,9999],[12,-36],[-2,-78],[-2,-107],[-5,-137],[0,-113],[-10,-84],[2,-138],[-6,-65],[-17,-6],[-6,96],[-7,89],[-4,84],[-17,30],[-23,23],[-26,-6],[-23,-35],[-3,65],[11,36],[9,101],[-6,78],[0,72],[14,-25],[23,-59],[30,-6],[17,77],[18,90],[21,54]]],"transform":{"scale":[0.00088940371897191,0.00017693012791278507],"translate":[96.821543816,-12.199965101999808]}}; Datamap.prototype.iotTopo = '__IOT__'; Datamap.prototype.irlTopo = '__IRL__'; Datamap.prototype.irnTopo = '__IRN__'; Datamap.prototype.irqTopo = '__IRQ__'; Datamap.prototype.islTopo = '__ISL__'; Datamap.prototype.isrTopo = '__ISR__'; Datamap.prototype.itaTopo = '__ITA__'; Datamap.prototype.jamTopo = '__JAM__'; Datamap.prototype.jeyTopo = '__JEY__'; Datamap.prototype.jorTopo = '__JOR__'; Datamap.prototype.jpnTopo = '__JPN__'; Datamap.prototype.kabTopo = '__KAB__'; Datamap.prototype.kasTopo = '__KAS__'; Datamap.prototype.kazTopo = '__KAZ__'; Datamap.prototype.kenTopo = '__KEN__'; Datamap.prototype.kgzTopo = '__KGZ__'; Datamap.prototype.khmTopo = '__KHM__'; Datamap.prototype.kirTopo = '__KIR__'; Datamap.prototype.knaTopo = '__KNA__'; Datamap.prototype.korTopo = '__KOR__'; Datamap.prototype.kosTopo = '__KOS__'; Datamap.prototype.kwtTopo = '__KWT__'; Datamap.prototype.laoTopo = '__LAO__'; Datamap.prototype.lbnTopo = '__LBN__'; Datamap.prototype.lbrTopo = '__LBR__'; Datamap.prototype.lbyTopo = '__LBY__'; Datamap.prototype.lcaTopo = '__LCA__'; Datamap.prototype.lieTopo = '__LIE__'; Datamap.prototype.lkaTopo = '__LKA__'; Datamap.prototype.lsoTopo = '__LSO__'; Datamap.prototype.ltuTopo = '__LTU__'; Datamap.prototype.luxTopo = '__LUX__'; Datamap.prototype.lvaTopo = '__LVA__'; Datamap.prototype.macTopo = '__MAC__'; Datamap.prototype.mafTopo = '__MAF__'; Datamap.prototype.marTopo = '__MAR__'; Datamap.prototype.mcoTopo = '__MCO__'; Datamap.prototype.mdaTopo = '__MDA__'; Datamap.prototype.mdgTopo = '__MDG__'; Datamap.prototype.mdvTopo = '__MDV__'; Datamap.prototype.mexTopo = '__MEX__'; Datamap.prototype.mhlTopo = '__MHL__'; Datamap.prototype.mkdTopo = '__MKD__'; Datamap.prototype.mliTopo = '__MLI__'; Datamap.prototype.mltTopo = '__MLT__'; Datamap.prototype.mmrTopo = '__MMR__'; Datamap.prototype.mneTopo = '__MNE__'; Datamap.prototype.mngTopo = '__MNG__'; Datamap.prototype.mnpTopo = '__MNP__'; Datamap.prototype.mozTopo = '__MOZ__'; Datamap.prototype.mrtTopo = '__MRT__'; Datamap.prototype.msrTopo = '__MSR__'; Datamap.prototype.musTopo = '__MUS__'; Datamap.prototype.mwiTopo = '__MWI__'; Datamap.prototype.mysTopo = '__MYS__'; Datamap.prototype.namTopo = '__NAM__'; Datamap.prototype.nclTopo = '__NCL__'; Datamap.prototype.nerTopo = '__NER__'; Datamap.prototype.nfkTopo = '__NFK__'; Datamap.prototype.ngaTopo = '__NGA__'; Datamap.prototype.nicTopo = '__NIC__'; Datamap.prototype.niuTopo = '__NIU__'; Datamap.prototype.nldTopo = '__NLD__'; Datamap.prototype.nplTopo = '__NPL__'; Datamap.prototype.nruTopo = '__NRU__'; Datamap.prototype.nulTopo = '__NUL__'; Datamap.prototype.nzlTopo = '__NZL__'; Datamap.prototype.omnTopo = '__OMN__'; Datamap.prototype.pakTopo = '__PAK__'; Datamap.prototype.panTopo = '__PAN__'; Datamap.prototype.pcnTopo = '__PCN__'; Datamap.prototype.perTopo = '__PER__'; Datamap.prototype.pgaTopo = '__PGA__'; Datamap.prototype.phlTopo = '__PHL__'; Datamap.prototype.plwTopo = '__PLW__'; Datamap.prototype.pngTopo = '__PNG__'; Datamap.prototype.polTopo = '__POL__'; Datamap.prototype.priTopo = '__PRI__'; Datamap.prototype.prkTopo = '__PRK__'; Datamap.prototype.prtTopo = '__PRT__'; Datamap.prototype.pryTopo = '__PRY__'; Datamap.prototype.pyfTopo = '__PYF__'; Datamap.prototype.qatTopo = '__QAT__'; Datamap.prototype.rouTopo = '__ROU__'; Datamap.prototype.rusTopo = '__RUS__'; Datamap.prototype.rwaTopo = '__RWA__'; Datamap.prototype.sahTopo = '__SAH__'; Datamap.prototype.sauTopo = '__SAU__'; Datamap.prototype.scrTopo = '__SCR__'; Datamap.prototype.sdnTopo = '__SDN__'; Datamap.prototype.sdsTopo = '__SDS__'; Datamap.prototype.senTopo = '__SEN__'; Datamap.prototype.serTopo = '__SER__'; Datamap.prototype.sgpTopo = '__SGP__'; Datamap.prototype.sgsTopo = '__SGS__'; Datamap.prototype.shnTopo = '__SHN__'; Datamap.prototype.slbTopo = '__SLB__'; Datamap.prototype.sleTopo = '__SLE__'; Datamap.prototype.slvTopo = '__SLV__'; Datamap.prototype.smrTopo = '__SMR__'; Datamap.prototype.solTopo = '__SOL__'; Datamap.prototype.somTopo = '__SOM__'; Datamap.prototype.spmTopo = '__SPM__'; Datamap.prototype.srbTopo = '__SRB__'; Datamap.prototype.stpTopo = '__STP__'; Datamap.prototype.surTopo = '__SUR__'; Datamap.prototype.svkTopo = '__SVK__'; Datamap.prototype.svnTopo = '__SVN__'; Datamap.prototype.sweTopo = '__SWE__'; Datamap.prototype.swzTopo = '__SWZ__'; Datamap.prototype.sxmTopo = '__SXM__'; Datamap.prototype.sycTopo = '__SYC__'; Datamap.prototype.syrTopo = '__SYR__'; Datamap.prototype.tcaTopo = '__TCA__'; Datamap.prototype.tcdTopo = '__TCD__'; Datamap.prototype.tgoTopo = '__TGO__'; Datamap.prototype.thaTopo = '__THA__'; Datamap.prototype.tjkTopo = '__TJK__'; Datamap.prototype.tkmTopo = '__TKM__'; Datamap.prototype.tlsTopo = '__TLS__'; Datamap.prototype.tonTopo = '__TON__'; Datamap.prototype.ttoTopo = '__TTO__'; Datamap.prototype.tunTopo = '__TUN__'; Datamap.prototype.turTopo = '__TUR__'; Datamap.prototype.tuvTopo = '__TUV__'; Datamap.prototype.twnTopo = '__TWN__'; Datamap.prototype.tzaTopo = '__TZA__'; Datamap.prototype.ugaTopo = '__UGA__'; Datamap.prototype.ukrTopo = '__UKR__'; Datamap.prototype.umiTopo = '__UMI__'; Datamap.prototype.uryTopo = '__URY__'; Datamap.prototype.usaTopo = '__USA__'; Datamap.prototype.usgTopo = '__USG__'; Datamap.prototype.uzbTopo = '__UZB__'; Datamap.prototype.vatTopo = '__VAT__'; Datamap.prototype.vctTopo = '__VCT__'; Datamap.prototype.venTopo = '__VEN__'; Datamap.prototype.vgbTopo = '__VGB__'; Datamap.prototype.virTopo = '__VIR__'; Datamap.prototype.vnmTopo = '__VNM__'; Datamap.prototype.vutTopo = '__VUT__'; Datamap.prototype.wlfTopo = '__WLF__'; Datamap.prototype.wsbTopo = '__WSB__'; Datamap.prototype.wsmTopo = '__WSM__'; Datamap.prototype.yemTopo = '__YEM__'; Datamap.prototype.zafTopo = '__ZAF__'; Datamap.prototype.zmbTopo = '__ZMB__'; Datamap.prototype.zweTopo = '__ZWE__'; /************************************** Utilities ***************************************/ //convert lat/lng coords to X / Y coords Datamap.prototype.latLngToXY = function(lat, lng) { return this.projection([lng, lat]); }; //add <g> layer to root SVG Datamap.prototype.addLayer = function( className, id, first ) { var layer; if ( first ) { layer = this.svg.insert('g', ':first-child') } else { layer = this.svg.append('g') } return layer.attr('id', id || '') .attr('class', className || ''); }; Datamap.prototype.updateChoropleth = function(data) { var svg = this.svg; for ( var subunit in data ) { if ( data.hasOwnProperty(subunit) ) { var color; var subunitData = data[subunit] if ( ! subunit ) { continue; } else if ( typeof subunitData === "string" ) { color = subunitData; } else if ( typeof subunitData.color === "string" ) { color = subunitData.color; } else { color = this.options.fills[ subunitData.fillKey ]; } //if it's an object, overriding the previous data if ( subunitData === Object(subunitData) ) { this.options.data[subunit] = defaults(subunitData, this.options.data[subunit] || {}); var geo = this.svg.select('.' + subunit).attr('data-info', JSON.stringify(this.options.data[subunit])); } svg .selectAll('.' + subunit) .transition() .style('fill', color); } } }; Datamap.prototype.updatePopup = function (element, d, options) { var self = this; element.on('mousemove', null); element.on('mousemove', function() { var position = d3.mouse(self.options.element); d3.select(self.svg[0][0].parentNode).select('.datamaps-hoverover') .style('top', ( (position[1] + 30)) + "px") .html(function() { var data = JSON.parse(element.attr('data-info')); try { return options.popupTemplate(d, data); } catch (e) { return ""; } }) .style('left', ( position[0]) + "px"); }); d3.select(self.svg[0][0].parentNode).select('.datamaps-hoverover').style('display', 'block'); }; Datamap.prototype.addPlugin = function( name, pluginFn ) { var self = this; if ( typeof Datamap.prototype[name] === "undefined" ) { Datamap.prototype[name] = function(data, options, callback, createNewLayer) { var layer; if ( typeof createNewLayer === "undefined" ) { createNewLayer = false; } if ( typeof options === 'function' ) { callback = options; options = undefined; } options = defaults(options || {}, self.options[name + 'Config']); //add a single layer, reuse the old layer if ( !createNewLayer && this.options[name + 'Layer'] ) { layer = this.options[name + 'Layer']; options = options || this.options[name + 'Options']; } else { layer = this.addLayer(name); this.options[name + 'Layer'] = layer; this.options[name + 'Options'] = options; } pluginFn.apply(this, [layer, data, options]); if ( callback ) { callback(layer); } }; } }; // expose library if (typeof exports === 'object') { d3 = require('d3'); topojson = require('topojson'); module.exports = Datamap; } else if ( typeof define === "function" && define.amd ) { define( "datamaps", ["require", "d3", "topojson"], function(require) { d3 = require('d3'); topojson = require('topojson'); return Datamap; }); } else { window.Datamap = window.Datamaps = Datamap; } if ( window.jQuery ) { window.jQuery.fn.datamaps = function(options, callback) { options = options || {}; options.element = this[0]; var datamap = new Datamap(options); if ( typeof callback === "function" ) { callback(datamap, options); } return this; }; } })();
extend1994/cdnjs
ajax/libs/datamaps/0.5.5/datamaps.ioa.js
JavaScript
mit
39,399
(function() { var svg; //save off default references var d3 = window.d3, topojson = window.topojson; var defaultOptions = { scope: 'world', responsive: false, aspectRatio: 0.5625, setProjection: setProjection, projection: 'equirectangular', dataType: 'json', data: {}, done: function() {}, fills: { defaultFill: '#ABDDA4' }, filters: {}, geographyConfig: { dataUrl: null, hideAntarctica: true, hideHawaiiAndAlaska : false, borderWidth: 1, borderColor: '#FDFDFD', popupTemplate: function(geography, data) { return '<div class="hoverinfo"><strong>' + geography.properties.name + '</strong></div>'; }, popupOnHover: true, highlightOnHover: true, highlightFillColor: '#FC8D59', highlightBorderColor: 'rgba(250, 15, 160, 0.2)', highlightBorderWidth: 2 }, projectionConfig: { rotation: [97, 0] }, bubblesConfig: { borderWidth: 2, borderColor: '#FFFFFF', popupOnHover: true, radius: null, popupTemplate: function(geography, data) { return '<div class="hoverinfo"><strong>' + data.name + '</strong></div>'; }, fillOpacity: 0.75, animate: true, highlightOnHover: true, highlightFillColor: '#FC8D59', highlightBorderColor: 'rgba(250, 15, 160, 0.2)', highlightBorderWidth: 2, highlightFillOpacity: 0.85, exitDelay: 100, key: JSON.stringify }, arcConfig: { strokeColor: '#DD1C77', strokeWidth: 1, arcSharpness: 1, animationSpeed: 600 } }; /* Getter for value. If not declared on datumValue, look up the chain into optionsValue */ function val( datumValue, optionsValue, context ) { if ( typeof context === 'undefined' ) { context = optionsValue; optionsValues = undefined; } var value = typeof datumValue !== 'undefined' ? datumValue : optionsValue; if (typeof value === 'undefined') { return null; } if ( typeof value === 'function' ) { var fnContext = [context]; if ( context.geography ) { fnContext = [context.geography, context.data]; } return value.apply(null, fnContext); } else { return value; } } function addContainer( element, height, width ) { this.svg = d3.select( element ).append('svg') .attr('width', width || element.offsetWidth) .attr('data-width', width || element.offsetWidth) .attr('class', 'datamap') .attr('height', height || element.offsetHeight) .style('overflow', 'hidden'); // IE10+ doesn't respect height/width when map is zoomed in if (this.options.responsive) { d3.select(this.options.element).style({'position': 'relative', 'padding-bottom': (this.options.aspectRatio*100) + '%'}); d3.select(this.options.element).select('svg').style({'position': 'absolute', 'width': '100%', 'height': '100%'}); d3.select(this.options.element).select('svg').select('g').selectAll('path').style('vector-effect', 'non-scaling-stroke'); } return this.svg; } // setProjection takes the svg element and options function setProjection( element, options ) { var width = options.width || element.offsetWidth; var height = options.height || element.offsetHeight; var projection, path; var svg = this.svg; if ( options && typeof options.scope === 'undefined') { options.scope = 'world'; } if ( options.scope === 'usa' ) { projection = d3.geo.albersUsa() .scale(width) .translate([width / 2, height / 2]); } else if ( options.scope === 'world' ) { projection = d3.geo[options.projection]() .scale((width + 1) / 2 / Math.PI) .translate([width / 2, height / (options.projection === "mercator" ? 1.45 : 1.8)]); } if ( options.projection === 'orthographic' ) { svg.append("defs").append("path") .datum({type: "Sphere"}) .attr("id", "sphere") .attr("d", path); svg.append("use") .attr("class", "stroke") .attr("xlink:href", "#sphere"); svg.append("use") .attr("class", "fill") .attr("xlink:href", "#sphere"); projection.scale(250).clipAngle(90).rotate(options.projectionConfig.rotation) } path = d3.geo.path() .projection( projection ); return {path: path, projection: projection}; } function addStyleBlock() { if ( d3.select('.datamaps-style-block').empty() ) { d3.select('head').append('style').attr('class', 'datamaps-style-block') .html('.datamap path.datamaps-graticule { fill: none; stroke: #777; stroke-width: 0.5px; stroke-opacity: .5; pointer-events: none; } .datamap .labels {pointer-events: none;} .datamap path {stroke: #FFFFFF; stroke-width: 1px;} .datamaps-legend dt, .datamaps-legend dd { float: left; margin: 0 3px 0 0;} .datamaps-legend dd {width: 20px; margin-right: 6px; border-radius: 3px;} .datamaps-legend {padding-bottom: 20px; z-index: 1001; position: absolute; left: 4px; font-size: 12px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;} .datamaps-hoverover {display: none; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } .hoverinfo {padding: 4px; border-radius: 1px; background-color: #FFF; box-shadow: 1px 1px 5px #CCC; font-size: 12px; border: 1px solid #CCC; } .hoverinfo hr {border:1px dotted #CCC; }'); } } function drawSubunits( data ) { var fillData = this.options.fills, colorCodeData = this.options.data || {}, geoConfig = this.options.geographyConfig; var subunits = this.svg.select('g.datamaps-subunits'); if ( subunits.empty() ) { subunits = this.addLayer('datamaps-subunits', null, true); } var geoData = topojson.feature( data, data.objects[ this.options.scope ] ).features; if ( geoConfig.hideAntarctica ) { geoData = geoData.filter(function(feature) { return feature.id !== "ATA"; }); } if ( geoConfig.hideHawaiiAndAlaska ) { geoData = geoData.filter(function(feature) { return feature.id !== "HI" && feature.id !== 'AK'; }); } var geo = subunits.selectAll('path.datamaps-subunit').data( geoData ); geo.enter() .append('path') .attr('d', this.path) .attr('class', function(d) { return 'datamaps-subunit ' + d.id; }) .attr('data-info', function(d) { return JSON.stringify( colorCodeData[d.id]); }) .style('fill', function(d) { //if fillKey - use that //otherwise check 'fill' //otherwise check 'defaultFill' var fillColor; var datum = colorCodeData[d.id]; if ( datum && datum.fillKey ) { fillColor = fillData[ val(datum.fillKey, {data: colorCodeData[d.id], geography: d}) ]; } if ( typeof fillColor === 'undefined' ) { fillColor = val(datum && datum.fillColor, fillData.defaultFill, {data: colorCodeData[d.id], geography: d}); } return fillColor; }) .style('stroke-width', geoConfig.borderWidth) .style('stroke', geoConfig.borderColor); } function handleGeographyConfig () { var hoverover; var svg = this.svg; var self = this; var options = this.options.geographyConfig; if ( options.highlightOnHover || options.popupOnHover ) { svg.selectAll('.datamaps-subunit') .on('mouseover', function(d) { var $this = d3.select(this); var datum = self.options.data[d.id] || {}; if ( options.highlightOnHover ) { var previousAttributes = { 'fill': $this.style('fill'), 'stroke': $this.style('stroke'), 'stroke-width': $this.style('stroke-width'), 'fill-opacity': $this.style('fill-opacity') }; $this .style('fill', val(datum.highlightFillColor, options.highlightFillColor, datum)) .style('stroke', val(datum.highlightBorderColor, options.highlightBorderColor, datum)) .style('stroke-width', val(datum.highlightBorderWidth, options.highlightBorderWidth, datum)) .style('fill-opacity', val(datum.highlightFillOpacity, options.highlightFillOpacity, datum)) .attr('data-previousAttributes', JSON.stringify(previousAttributes)); //as per discussion on https://github.com/markmarkoh/datamaps/issues/19 if ( ! /((MSIE)|(Trident))/.test(navigator.userAgent) ) { moveToFront.call(this); } } if ( options.popupOnHover ) { self.updatePopup($this, d, options, svg); } }) .on('mouseout', function() { var $this = d3.select(this); if (options.highlightOnHover) { //reapply previous attributes var previousAttributes = JSON.parse( $this.attr('data-previousAttributes') ); for ( var attr in previousAttributes ) { $this.style(attr, previousAttributes[attr]); } } $this.on('mousemove', null); d3.selectAll('.datamaps-hoverover').style('display', 'none'); }); } function moveToFront() { this.parentNode.appendChild(this); } } //plugin to add a simple map legend function addLegend(layer, data, options) { data = data || {}; if ( !this.options.fills ) { return; } var html = '<dl>'; var label = ''; if ( data.legendTitle ) { html = '<h2>' + data.legendTitle + '</h2>' + html; } for ( var fillKey in this.options.fills ) { if ( fillKey === 'defaultFill') { if (! data.defaultFillName ) { continue; } label = data.defaultFillName; } else { if (data.labels && data.labels[fillKey]) { label = data.labels[fillKey]; } else { label= fillKey + ': '; } } html += '<dt>' + label + '</dt>'; html += '<dd style="background-color:' + this.options.fills[fillKey] + '">&nbsp;</dd>'; } html += '</dl>'; var hoverover = d3.select( this.options.element ).append('div') .attr('class', 'datamaps-legend') .html(html); } function addGraticule ( layer, options ) { var graticule = d3.geo.graticule(); this.svg.insert("path", '.datamaps-subunits') .datum(graticule) .attr("class", "datamaps-graticule") .attr("d", this.path); } function handleArcs (layer, data, options) { var self = this, svg = this.svg; if ( !data || (data && !data.slice) ) { throw "Datamaps Error - arcs must be an array"; } // For some reason arc options were put in an `options` object instead of the parent arc // I don't like this, so to match bubbles and other plugins I'm moving it // This is to keep backwards compatability for ( var i = 0; i < data.length; i++ ) { data[i] = defaults(data[i], data[i].options); delete data[i].options; } if ( typeof options === "undefined" ) { options = defaultOptions.arcConfig; } var arcs = layer.selectAll('path.datamaps-arc').data( data, JSON.stringify ); var path = d3.geo.path() .projection(self.projection); arcs .enter() .append('svg:path') .attr('class', 'datamaps-arc') .style('stroke-linecap', 'round') .style('stroke', function(datum) { return val(datum.strokeColor, options.strokeColor, datum); }) .style('fill', 'none') .style('stroke-width', function(datum) { return val(datum.strokeWidth, options.strokeWidth, datum); }) .attr('d', function(datum) { var originXY = self.latLngToXY(val(datum.origin.latitude, datum), val(datum.origin.longitude, datum)) var destXY = self.latLngToXY(val(datum.destination.latitude, datum), val(datum.destination.longitude, datum)); var midXY = [ (originXY[0] + destXY[0]) / 2, (originXY[1] + destXY[1]) / 2]; if (options.greatArc) { // TODO: Move this to inside `if` clause when setting attr `d` var greatArc = d3.geo.greatArc() .source(function(d) { return [val(d.origin.longitude, d), val(d.origin.latitude, d)]; }) .target(function(d) { return [val(d.destination.longitude, d), val(d.destination.latitude, d)]; }); return path(greatArc(datum)) } var sharpness = val(datum.arcSharpness, options.arcSharpness, datum); return "M" + originXY[0] + ',' + originXY[1] + "S" + (midXY[0] + (50 * sharpness)) + "," + (midXY[1] - (75 * sharpness)) + "," + destXY[0] + "," + destXY[1]; }) .transition() .delay(100) .style('fill', function(datum) { /* Thank you Jake Archibald, this is awesome. Source: http://jakearchibald.com/2013/animated-line-drawing-svg/ */ var length = this.getTotalLength(); this.style.transition = this.style.WebkitTransition = 'none'; this.style.strokeDasharray = length + ' ' + length; this.style.strokeDashoffset = length; this.getBoundingClientRect(); this.style.transition = this.style.WebkitTransition = 'stroke-dashoffset ' + val(datum.animationSpeed, options.animationSpeed, datum) + 'ms ease-out'; this.style.strokeDashoffset = '0'; return 'none'; }) arcs.exit() .transition() .style('opacity', 0) .remove(); } function handleLabels ( layer, options ) { var self = this; options = options || {}; var labelStartCoodinates = this.projection([-67.707617, 42.722131]); this.svg.selectAll(".datamaps-subunit") .attr("data-foo", function(d) { var center = self.path.centroid(d); var xOffset = 7.5, yOffset = 5; if ( ["FL", "KY", "MI"].indexOf(d.id) > -1 ) xOffset = -2.5; if ( d.id === "NY" ) xOffset = -1; if ( d.id === "MI" ) yOffset = 18; if ( d.id === "LA" ) xOffset = 13; var x,y; x = center[0] - xOffset; y = center[1] + yOffset; var smallStateIndex = ["VT", "NH", "MA", "RI", "CT", "NJ", "DE", "MD", "DC"].indexOf(d.id); if ( smallStateIndex > -1) { var yStart = labelStartCoodinates[1]; x = labelStartCoodinates[0]; y = yStart + (smallStateIndex * (2+ (options.fontSize || 12))); layer.append("line") .attr("x1", x - 3) .attr("y1", y - 5) .attr("x2", center[0]) .attr("y2", center[1]) .style("stroke", options.labelColor || "#000") .style("stroke-width", options.lineWidth || 1) } layer.append("text") .attr("x", x) .attr("y", y) .style("font-size", (options.fontSize || 10) + 'px') .style("font-family", options.fontFamily || "Verdana") .style("fill", options.labelColor || "#000") .text( d.id ); return "bar"; }); } function handleBubbles (layer, data, options ) { var self = this, fillData = this.options.fills, filterData = this.options.filters, svg = this.svg; if ( !data || (data && !data.slice) ) { throw "Datamaps Error - bubbles must be an array"; } var bubbles = layer.selectAll('circle.datamaps-bubble').data( data, options.key ); bubbles .enter() .append('svg:circle') .attr('class', 'datamaps-bubble') .attr('cx', function ( datum ) { var latLng; if ( datumHasCoords(datum) ) { latLng = self.latLngToXY(datum.latitude, datum.longitude); } else if ( datum.centered ) { latLng = self.path.centroid(svg.select('path.' + datum.centered).data()[0]); } if ( latLng ) return latLng[0]; }) .attr('cy', function ( datum ) { var latLng; if ( datumHasCoords(datum) ) { latLng = self.latLngToXY(datum.latitude, datum.longitude); } else if ( datum.centered ) { latLng = self.path.centroid(svg.select('path.' + datum.centered).data()[0]); } if ( latLng ) return latLng[1]; }) .attr('r', function(datum) { // if animation enabled start with radius 0, otherwise use full size. return options.animate ? 0 : val(datum.radius, options.radius, datum); }) .attr('data-info', function(d) { return JSON.stringify(d); }) .attr('filter', function (datum) { var filterKey = filterData[ val(datum.filterKey, options.filterKey, datum) ]; if (filterKey) { return filterKey; } }) .style('stroke', function ( datum ) { return val(datum.borderColor, options.borderColor, datum); }) .style('stroke-width', function ( datum ) { return val(datum.borderWidth, options.borderWidth, datum); }) .style('fill-opacity', function ( datum ) { return val(datum.fillOpacity, options.fillOpacity, datum); }) .style('fill', function ( datum ) { var fillColor = fillData[ val(datum.fillKey, options.fillKey, datum) ]; return fillColor || fillData.defaultFill; }) .on('mouseover', function ( datum ) { var $this = d3.select(this); if (options.highlightOnHover) { //save all previous attributes for mouseout var previousAttributes = { 'fill': $this.style('fill'), 'stroke': $this.style('stroke'), 'stroke-width': $this.style('stroke-width'), 'fill-opacity': $this.style('fill-opacity') }; $this .style('fill', val(datum.highlightFillColor, options.highlightFillColor, datum)) .style('stroke', val(datum.highlightBorderColor, options.highlightBorderColor, datum)) .style('stroke-width', val(datum.highlightBorderWidth, options.highlightBorderWidth, datum)) .style('fill-opacity', val(datum.highlightFillOpacity, options.highlightFillOpacity, datum)) .attr('data-previousAttributes', JSON.stringify(previousAttributes)); } if (options.popupOnHover) { self.updatePopup($this, datum, options, svg); } }) .on('mouseout', function ( datum ) { var $this = d3.select(this); if (options.highlightOnHover) { //reapply previous attributes var previousAttributes = JSON.parse( $this.attr('data-previousAttributes') ); for ( var attr in previousAttributes ) { $this.style(attr, previousAttributes[attr]); } } d3.selectAll('.datamaps-hoverover').style('display', 'none'); }) bubbles.transition() .duration(400) .attr('r', function ( datum ) { return val(datum.radius, options.radius, datum); }); bubbles.exit() .transition() .delay(options.exitDelay) .attr("r", 0) .remove(); function datumHasCoords (datum) { return typeof datum !== 'undefined' && typeof datum.latitude !== 'undefined' && typeof datum.longitude !== 'undefined'; } } //stolen from underscore.js function defaults(obj) { Array.prototype.slice.call(arguments, 1).forEach(function(source) { if (source) { for (var prop in source) { if (obj[prop] == null) obj[prop] = source[prop]; } } }); return obj; } /************************************** Public Functions ***************************************/ function Datamap( options ) { if ( typeof d3 === 'undefined' || typeof topojson === 'undefined' ) { throw new Error('Include d3.js (v3.0.3 or greater) and topojson on this page before creating a new map'); } //set options for global use this.options = defaults(options, defaultOptions); this.options.geographyConfig = defaults(options.geographyConfig, defaultOptions.geographyConfig); this.options.projectionConfig = defaults(options.projectionConfig, defaultOptions.projectionConfig); this.options.bubblesConfig = defaults(options.bubblesConfig, defaultOptions.bubblesConfig); this.options.arcConfig = defaults(options.arcConfig, defaultOptions.arcConfig); //add the SVG container if ( d3.select( this.options.element ).select('svg').length > 0 ) { addContainer.call(this, this.options.element, this.options.height, this.options.width ); } /* Add core plugins to this instance */ this.addPlugin('bubbles', handleBubbles); this.addPlugin('legend', addLegend); this.addPlugin('arc', handleArcs); this.addPlugin('labels', handleLabels); this.addPlugin('graticule', addGraticule); //append style block with basic hoverover styles if ( ! this.options.disableDefaultStyles ) { addStyleBlock(); } return this.draw(); } // resize map Datamap.prototype.resize = function () { var self = this; var options = self.options; if (options.responsive) { var newsize = options.element.clientWidth, oldsize = d3.select( options.element).select('svg').attr('data-width'); d3.select(options.element).select('svg').selectAll('g').attr('transform', 'scale(' + (newsize / oldsize) + ')'); } } // actually draw the features(states & countries) Datamap.prototype.draw = function() { //save off in a closure var self = this; var options = self.options; //set projections and paths based on scope var pathAndProjection = options.setProjection.apply(self, [options.element, options] ); this.path = pathAndProjection.path; this.projection = pathAndProjection.projection; //if custom URL for topojson data, retrieve it and render if ( options.geographyConfig.dataUrl ) { d3.json( options.geographyConfig.dataUrl, function(error, results) { if ( error ) throw new Error(error); self.customTopo = results; draw( results ); }); } else { draw( this[options.scope + 'Topo'] || options.geographyConfig.dataJson); } return this; function draw (data) { // if fetching remote data, draw the map first then call `updateChoropleth` if ( self.options.dataUrl ) { //allow for csv or json data types d3[self.options.dataType](self.options.dataUrl, function(data) { //in the case of csv, transform data to object if ( self.options.dataType === 'csv' && (data && data.slice) ) { var tmpData = {}; for(var i = 0; i < data.length; i++) { tmpData[data[i].id] = data[i]; } data = tmpData; } Datamaps.prototype.updateChoropleth.call(self, data); }); } drawSubunits.call(self, data); handleGeographyConfig.call(self); if ( self.options.geographyConfig.popupOnHover || self.options.bubblesConfig.popupOnHover) { hoverover = d3.select( self.options.element ).append('div') .attr('class', 'datamaps-hoverover') .style('z-index', 10001) .style('position', 'absolute'); } //fire off finished callback self.options.done(self); } }; /************************************** TopoJSON ***************************************/ Datamap.prototype.worldTopo = '__WORLD__'; Datamap.prototype.abwTopo = '__ABW__'; Datamap.prototype.afgTopo = '__AFG__'; Datamap.prototype.agoTopo = '__AGO__'; Datamap.prototype.aiaTopo = '__AIA__'; Datamap.prototype.albTopo = '__ALB__'; Datamap.prototype.aldTopo = '__ALD__'; Datamap.prototype.andTopo = '__AND__'; Datamap.prototype.areTopo = '__ARE__'; Datamap.prototype.argTopo = '__ARG__'; Datamap.prototype.armTopo = '__ARM__'; Datamap.prototype.asmTopo = '__ASM__'; Datamap.prototype.ataTopo = '__ATA__'; Datamap.prototype.atcTopo = '__ATC__'; Datamap.prototype.atfTopo = '__ATF__'; Datamap.prototype.atgTopo = '__ATG__'; Datamap.prototype.ausTopo = '__AUS__'; Datamap.prototype.autTopo = '__AUT__'; Datamap.prototype.azeTopo = '__AZE__'; Datamap.prototype.bdiTopo = '__BDI__'; Datamap.prototype.belTopo = '__BEL__'; Datamap.prototype.benTopo = '__BEN__'; Datamap.prototype.bfaTopo = '__BFA__'; Datamap.prototype.bgdTopo = '__BGD__'; Datamap.prototype.bgrTopo = '__BGR__'; Datamap.prototype.bhrTopo = '__BHR__'; Datamap.prototype.bhsTopo = '__BHS__'; Datamap.prototype.bihTopo = '__BIH__'; Datamap.prototype.bjnTopo = '__BJN__'; Datamap.prototype.blmTopo = '__BLM__'; Datamap.prototype.blrTopo = '__BLR__'; Datamap.prototype.blzTopo = '__BLZ__'; Datamap.prototype.bmuTopo = '__BMU__'; Datamap.prototype.bolTopo = '__BOL__'; Datamap.prototype.braTopo = '__BRA__'; Datamap.prototype.brbTopo = '__BRB__'; Datamap.prototype.brnTopo = '__BRN__'; Datamap.prototype.btnTopo = '__BTN__'; Datamap.prototype.norTopo = '__NOR__'; Datamap.prototype.bwaTopo = {"type":"Topology","objects":{"bwa":{"type":"GeometryCollection","geometries":[{"type":"Polygon","properties":{"name":"Ghanzi"},"id":"BW.GH","arcs":[[0,1,2,3,4]]},{"type":"Polygon","properties":{"name":"Kgalagadi"},"id":"BW.KG","arcs":[[5,6,7,-2]]},{"type":"Polygon","properties":{"name":"North-West"},"id":"BW.NW","arcs":[[8,-4,9]]},{"type":"Polygon","properties":{"name":"Central"},"id":"BW.CE","arcs":[[10,11,12,13,14,-5,-9],[15],[16]]},{"type":"Polygon","properties":{"name":"Kgatleng"},"id":"BW.KL","arcs":[[17,18,19,20,-14]]},{"type":"Polygon","properties":{"name":"Kweneng"},"id":"BW.KW","arcs":[[-21,21,22,23,24,25,-6,-1,-15]]},{"type":"Polygon","properties":{"name":"South-East"},"id":"BW.SE","arcs":[[26,27,-23,28,-19],[29]]},{"type":"Polygon","properties":{"name":"Southern"},"id":"BW.SO","arcs":[[30,-24,-28,31,-7,-26]]},{"type":"Polygon","properties":{"name":"North-East"},"id":"BW.NE","arcs":[[-12,32],[33]]},{"type":"Polygon","properties":{"name":"Gaborone"},"id":"BW.","arcs":[[-29,-22,-20]]},{"type":"Polygon","properties":{"name":"Francistown"},"id":"BW.","arcs":[[-34]]},{"type":"Polygon","properties":{"name":"Lobatse"},"id":"BW.","arcs":[[-30]]},{"type":"Polygon","properties":{"name":"Selebi-Phikwe"},"id":"BW.","arcs":[[-17]]},{"type":"Polygon","properties":{"name":"Sowa"},"id":"BW.","arcs":[[-16]]},{"type":"Polygon","properties":{"name":"Jwaneng"},"id":"BW.","arcs":[[-31,-25]]}]}},"arcs":[[[5826,4324],[-210,-402],[-2331,8]],[[3285,3930],[-3263,3],[-20,0]],[[2,3933],[0,114],[-1,189],[0,189],[0,188],[0,166],[0,165],[-1,165],[0,165],[0,94],[250,0],[250,0],[249,0],[250,0],[61,0],[14,41],[0,45],[-1,63],[0,63],[0,64],[0,63],[0,63],[-1,63],[0,64],[0,63],[0,63],[0,64],[-1,63],[0,63],[0,63],[0,63],[-1,64],[0,63],[0,1]],[[1070,6467],[20,0],[3074,0]],[[4164,6467],[1662,-2143]],[[3285,3930],[-15,-95],[-22,-18],[-48,1],[-11,-4],[-9,-9],[-4,-41],[2,-106],[2,-8],[7,-3],[11,-1],[60,0],[19,-80],[4,-391]],[[3281,3175],[-4,-905],[2,-13],[5,-11],[15,-4],[16,-2],[1023,6],[16,-2],[17,-4],[17,-12],[123,-121],[14,-17],[11,-18],[5,-24],[17,-522],[35,-43],[123,-116],[17,-5],[49,-3],[28,-21],[15,-93]],[[4825,1245],[-47,16],[-21,-3],[-22,-8],[-29,-7],[-54,8],[-45,31],[-73,82],[-47,25],[-56,0],[-111,-28],[-23,-3],[-2,5],[6,10],[-1,8],[-11,9],[-11,6],[-12,3],[-55,-13],[-21,12],[-16,21],[-48,33],[-41,50],[-9,5],[-22,7],[-10,6],[-7,9],[-11,23],[-10,9],[-59,17],[-14,13],[-8,11],[-112,82],[-27,16],[-32,13],[-10,8],[-14,13],[-17,24],[-9,9],[-15,4],[-14,-2],[-35,-12],[-19,-2],[-17,4],[-48,17],[-59,11],[-53,-4],[-50,-14],[-80,-36],[-11,-7],[-13,-7],[-6,5],[-5,11],[-7,9],[-25,4],[-26,-13],[-41,-39],[-6,-10],[-2,-9],[-5,-9],[-12,-7],[-15,-6],[-11,-7],[-9,-10],[-9,-13],[-17,-43],[-12,-13],[-27,-10],[-7,-11],[-21,-68],[-9,-17],[-3,-8],[0,-10],[6,-11],[10,-11],[5,-12],[-9,-10],[-15,-11],[-1,-9],[4,-9],[1,-12],[-2,-16],[-3,-11],[-6,-11],[-47,-52],[-15,-23],[-6,-23],[1,-16],[4,-3],[6,-2],[8,-11],[6,-16],[2,-7],[-12,-18],[-16,-17],[-21,-17],[-12,-19],[14,-19],[5,-14],[1,-25],[-3,-26],[-6,-18],[-9,-14],[-10,-7],[-31,-10],[-11,-9],[0,-10],[4,-11],[-1,-13],[-44,-63],[-3,-3],[-10,-10],[-21,-13],[-12,-15],[-17,-38],[-20,-29],[-19,-7],[-48,10],[-34,-6],[-23,-18],[-37,-50],[-55,-50],[-26,-12],[-17,-5],[-49,-8],[-9,-7],[-11,-22],[-43,-41],[-21,-39],[-34,-87],[-41,-58],[-53,-50],[-63,-36],[-67,-15],[-104,-1],[-34,-5],[-28,-10],[-13,-11],[-1,-17],[9,-49],[2,-22],[-5,-20],[-12,-19],[-19,-18],[-61,-38],[-24,-8],[-23,0],[-63,16],[-91,2],[-52,22],[-25,4],[-49,-2],[-89,-22],[-15,-1],[-30,4],[-15,0],[-93,-25],[-33,-1],[-141,29],[-43,25],[-45,18],[-60,-7],[-28,-14],[-49,-32],[-69,-30],[-23,-15],[-3,-3],[-5,11],[-11,35],[-11,12],[-16,10],[-6,6],[-6,8],[-15,30],[-11,40],[-6,41],[0,33],[23,74],[2,25],[-5,16],[-17,23],[-7,14],[-3,28],[3,31],[14,59],[4,14],[32,21],[15,18],[31,54],[62,73],[24,39],[20,42],[46,61],[4,17],[-40,66],[-4,20],[3,79],[-10,95],[-28,66],[-1,4],[-12,12],[-6,1],[-10,-5],[-15,-5],[1,10],[11,22],[-22,72],[-11,20],[-11,8],[-27,13],[-9,11],[0,12],[9,23],[0,12],[-8,7],[-13,2],[-11,4],[-3,12],[5,7],[24,14],[6,11],[-8,29],[-48,39],[2,31],[7,17],[32,19],[-14,11],[-10,0],[-9,-5],[-10,-4],[-11,4],[0,12],[5,13],[1,9],[-16,-2],[-4,22],[-6,10],[-31,13],[-17,11],[-7,12],[-7,34],[-5,9],[-11,14],[-4,8],[0,8],[4,6],[4,7],[-2,10],[-7,7],[-19,9],[-7,7],[-2,7],[-2,28],[-20,8],[-20,11],[-10,15],[9,18],[2,17],[-12,23],[-29,43],[-33,68],[-12,14],[-137,107],[-82,46],[-11,3],[-22,1],[-10,3],[-12,8],[-28,30],[-56,41],[-20,30],[-18,13],[-7,8],[-6,18],[0,189],[0,189],[0,188],[0,189],[-1,189],[0,31],[0,158],[0,188],[0,189],[0,75]],[[6390,8662],[-1032,0],[-10,0],[1,-1093],[4,-3],[2,-2],[176,-73],[6,-7],[2,-12],[-8,-255],[-2,-14],[-5,-10],[-11,-4],[-684,-55],[-12,1],[-15,2],[-23,0],[-38,-13],[-21,-2],[-26,10],[-17,18],[-29,44],[-41,32],[-16,16],[-29,56],[-13,0],[-14,-8],[-21,8],[-28,30],[-12,10],[-16,8],[-10,-1],[-10,-5],[-14,-6],[-41,-7],[-11,-6],[-18,-17],[-12,-5],[-13,-3],[-10,-4],[-8,-6],[-25,-29],[0,-4],[2,-6],[1,-6],[-3,-6],[-66,-17],[-12,-1],[-14,5],[-27,17],[-5,-22],[2,-750]],[[1070,6467],[0,136],[-1,137],[0,138],[0,137],[-1,137],[0,27],[0,110],[-1,137],[0,137],[0,138],[-1,137],[0,137],[-1,137],[0,137],[-1,138],[0,86],[0,51],[-1,137],[0,45],[0,45],[0,44],[0,45],[0,45],[0,45],[0,45],[0,44],[0,45],[0,45],[0,45],[0,45],[0,45],[0,44],[0,45],[0,45],[0,31],[20,1],[33,1],[60,3],[60,2],[60,2],[61,3],[50,2],[50,2],[50,2],[50,2],[20,1],[21,1],[18,3],[18,4],[18,3],[18,4],[91,17],[89,17],[91,17],[90,17],[90,18],[90,17],[90,17],[90,17],[90,17],[90,18],[90,17],[90,17],[90,17],[90,17],[90,18],[90,17],[93,18],[126,10],[92,8],[74,6],[40,-1],[14,-7],[6,-5],[2,-8],[0,-14],[3,-8],[8,-2],[8,-1],[3,-4],[-1,-26],[1,-8],[3,-6],[12,-16],[13,-27],[32,-38],[6,-11],[1,-6],[-2,-19],[1,-6],[6,-3],[10,-3],[9,-1],[11,11],[16,-14],[15,-18],[6,-9],[15,-6],[14,-2],[11,-5],[4,-13],[6,-12],[12,-9],[5,-10],[-9,-18],[35,-37],[10,-23],[-15,-23],[10,-15],[16,-47],[9,-46],[14,-11],[19,0],[38,13],[4,3],[7,6],[26,29],[22,4],[16,10],[100,106],[17,6],[12,12],[19,28],[13,12],[32,21],[17,16],[3,38],[37,26],[7,1],[5,-2],[5,-3],[5,-3],[4,7],[5,6],[13,9],[30,13],[9,6],[31,30],[8,4],[39,7],[36,26],[51,61],[38,19],[21,3],[22,-3],[12,-4],[19,-9],[9,-2],[10,7],[30,53],[18,17],[16,6],[36,-2],[24,-5],[13,-12],[18,-34],[8,-8],[7,-3],[5,-6],[2,-17],[36,-34],[14,4],[49,5],[11,2],[3,7],[15,17],[4,6],[4,3],[53,63],[16,15],[37,23],[29,36],[5,4],[8,5],[10,4],[9,1],[10,4],[6,15],[7,4],[22,4],[25,21],[18,5],[21,1],[78,25],[7,4],[8,8],[4,7],[5,6],[12,2],[-7,-16],[11,-7],[7,-10],[9,-4],[16,7],[9,-13],[14,2],[29,18],[11,-22],[33,1],[35,14],[35,35],[43,-1],[70,-12],[-43,-95],[0,-31],[7,-26],[31,-76],[44,-74],[29,-31],[36,-21],[32,-25],[23,-41],[34,-84],[35,-56],[8,-21],[10,-47],[6,-14],[13,-23],[71,-73],[36,-24],[14,-15],[51,-71],[31,-26],[41,-21],[27,-23],[12,-39],[6,-80],[39,-83],[133,-118],[29,-86]],[[6390,8662],[0,-1],[-3,-23],[-18,-41],[-3,-22],[4,-26],[8,-21],[27,-44],[32,-41],[24,-49],[103,-282],[27,-40],[41,-25],[48,-12],[57,-1],[12,-6],[10,-7],[8,-9],[11,-14],[2,-9],[-7,-23],[-8,-13],[-7,-4],[0,-2],[13,-8],[8,-4],[33,-6],[24,-12],[29,-45],[20,-18],[20,-8],[42,-9],[21,-8],[43,-28],[18,-18],[9,-21],[8,-24],[14,-15],[20,-9],[48,-13],[16,-9],[3,-3],[8,-9],[15,-20],[16,-16],[19,-9],[21,-4],[25,-1],[40,-7],[121,-60],[38,-7],[36,1],[34,-4],[36,-19],[10,-11],[18,-25],[11,-9],[14,-5],[10,-1],[11,1],[13,0],[22,-4],[23,-6],[19,-12],[14,-19],[54,-136],[20,-128],[-17,-159]],[[7778,7020],[4,-73],[-23,-62],[-23,-93],[-15,-78],[0,-78],[15,-108],[46,-62],[37,-70],[46,-109],[37,-101],[23,-101],[38,-70],[53,-62],[83,-39],[75,0],[91,-23],[68,8],[75,0],[61,-31],[79,-7]],[[8548,5861],[13,-14],[15,-9],[18,-5],[61,-4],[80,-16],[128,-1],[39,-8],[43,-14],[86,-43],[23,-5],[18,3],[17,7],[38,9],[11,5],[12,2],[34,-9],[31,-2],[15,-5],[42,-32],[49,-14],[156,-71],[32,-8],[65,-4],[31,-7],[19,-12],[43,-13],[17,-13],[3,-21],[-13,-26],[-18,-26],[-11,-24],[-5,-46],[9,-47],[20,-42],[32,-33],[40,-20],[39,-6],[101,2],[5,-3],[11,-12],[5,-10],[9,-22],[6,-10],[82,-68],[-20,-6],[-30,2],[-59,12],[-28,-3],[-20,-13],[-17,-15],[-19,-7],[-129,-7],[-10,-4],[-22,-29],[0,-5],[-17,-9],[-20,-20],[-25,-31],[8,-77],[-5,-13],[-10,-10],[-25,-44],[-19,-14],[-46,5],[-24,-1],[-11,-14],[-6,-21],[-15,-12],[-21,-6],[-24,-3],[-46,-14],[-77,-42],[-38,-12],[-28,1],[-21,3],[-19,-4],[-23,-19],[-17,-5],[-67,17],[-88,-6],[-41,-10],[-39,-22],[-16,-13],[-39,-43],[-11,-6],[-26,-3],[-11,-3],[-10,-6],[-34,-41],[-5,-10],[-2,-14],[2,-14],[3,-8],[0,-9],[-8,-14],[-10,-9],[-11,-4],[-10,-2],[-9,-4],[-5,-7],[-6,-17],[-4,-6],[-16,-7],[-24,-7],[-20,-8],[-2,-12],[9,-24],[-4,-24],[-13,-22],[-17,-17],[-15,-9],[-20,-10],[-22,-8],[-21,-3],[-12,-11],[0,-25],[9,-46],[-17,-31],[-37,-25],[-44,-17],[-41,-10],[7,-20],[-17,-6],[-23,1],[-11,2],[-3,-8],[3,-9],[5,-8],[2,-5],[2,-3],[5,-5],[2,-4],[-5,-2],[-2,-2],[-8,-6],[-1,0],[-16,-42],[-6,-11],[-16,-7],[-14,6],[-29,31],[-43,-33],[-12,-4],[-15,4],[-15,7],[-12,1],[-9,-31],[-20,-21],[-5,-17],[-1,-6],[-2,-6],[-4,-5],[-4,-2],[-2,-3],[1,-7],[3,-9],[2,-7],[-6,-25],[-16,-19],[-21,-14],[-23,-6],[-45,-2],[-13,-5],[-11,-11],[-8,-13],[-11,-6],[-15,7],[8,16],[-8,2],[-16,-5],[-13,-6],[-3,-6],[-10,-13],[-11,-6],[-12,34],[-15,-12],[-25,-38],[-18,-16],[-19,-13],[-41,-20],[-39,-11],[-12,-13],[15,-22],[-11,-4],[-9,0],[-9,4],[-7,9],[-3,-7],[-8,-9],[-5,-7],[-8,10],[-13,4],[-10,-2],[-5,-8],[5,-14],[8,-7],[6,-7],[-4,-13],[-14,7],[-11,-1],[-11,-8],[-8,-13],[7,0],[-20,-14],[-6,-6],[-3,-10],[-7,4],[-8,3],[2,-22],[7,-19],[0,-16],[-16,-11],[-18,1],[-9,12],[-5,13],[-12,5],[-10,-8],[-19,-45],[-20,-35],[-6,-21],[3,-10]],[[7454,3452],[0,-1],[-6,-1],[-21,-2],[-13,-11],[-25,-32],[-3,6],[-9,11],[-3,6],[-8,-20],[-11,-17],[-24,-31],[-5,-8],[-6,-17],[-4,-5],[-8,-2],[-20,3],[-8,-1],[-27,-25],[-50,-58],[-2,-1],[-3,-8],[-4,-4],[-4,-3],[-744,419]],[[6446,3650],[-143,193],[-48,45],[-94,29],[-14,6],[-9,8],[-312,393]],[[6694,6907],[4,43],[-24,9],[-25,-4],[-16,-4],[-55,13],[-18,3],[-7,-26],[28,-13],[57,-16],[56,-5]],[[8373,5410],[-8,3],[-11,-6],[-1,-5],[3,-4],[2,-5],[-4,-7],[0,-8],[2,-5],[12,2],[9,7],[8,-2],[7,-6],[9,2],[8,6],[15,5],[4,10],[1,10],[5,5],[-3,4],[-10,6],[2,11],[1,8],[-4,11],[-4,4],[-12,-3],[-5,-11],[0,-7],[-9,-9],[0,-10],[-11,-5],[-6,-1]],[[7454,3452],[2,-9],[-30,-53],[7,-22],[-4,-30],[-75,-291],[-2,-49],[-21,-96],[-11,-20],[-17,-14],[-22,-12],[-94,-29],[-23,-11],[-9,-17],[-65,-63],[-70,-43],[-29,-22],[-26,-34],[-32,-78],[-7,-12],[-70,-68],[-24,4],[-19,2],[-21,4],[-20,2],[-50,-7],[-120,-35]],[[6602,2449],[-10,15],[-47,42],[-85,55]],[[6460,2561],[-87,56]],[[6373,2617],[-18,11],[-21,10],[-12,3],[-10,8],[-7,21],[-2,31],[16,62],[13,32],[14,25],[32,160],[68,670]],[[6373,2617],[-124,-126]],[[6249,2491],[-158,-161]],[[6091,2330],[-90,3],[-19,4],[-126,66],[-697,209]],[[5159,2612],[-186,56]],[[4973,2668],[-1692,507]],[[6602,2449],[-163,-48],[-34,-24],[-17,-8],[-54,2],[-36,-12],[-8,-1],[-6,-5],[-1,-27],[11,-80],[-1,-44],[-11,-36],[-31,-67],[-2,-41],[-32,-53],[-24,-73],[-93,-196],[-34,-143],[-12,-25]],[[6054,1568],[-111,43],[-6,12],[-1,12],[122,399],[4,15],[0,15],[-11,4],[-14,2],[-29,-2],[-9,1],[-2,5],[0,1],[34,97],[6,28],[-2,15],[10,9],[13,16],[13,12],[20,78]],[[6249,2491],[5,-32],[5,-39],[14,-24],[36,-8],[25,7],[45,3],[27,35],[0,28],[53,74],[1,26]],[[6061,1815],[12,1],[11,3],[7,-5],[13,6],[6,10],[0,11],[-9,0],[-3,6],[7,6],[-1,5],[7,7],[-6,5],[-1,8],[-13,-3],[-2,12],[-5,1],[-4,-10],[-6,-19],[0,-17],[-4,-13],[-8,-11],[-1,-3]],[[4973,2668],[-2,-219],[195,9],[-7,154]],[[6054,1568],[-47,-105],[-23,-67],[-137,-100],[-77,-36],[-223,-21],[-44,7],[-49,14],[-41,7],[-41,-6],[-48,-22],[-64,-45],[-21,-8],[-64,-16],[-32,-4],[-30,8],[-35,7],[-78,-8],[-37,8],[-57,36],[-81,28]],[[7778,7020],[40,20],[37,5],[121,0],[85,-11],[61,11],[37,-17],[43,-1],[19,-7],[15,-14],[8,-20],[-3,-43],[-13,-39],[-8,-39],[26,-87],[3,-44],[-16,-89],[-6,-13],[-8,-9],[-6,-10],[-1,-14],[0,-13],[-3,-25],[0,-10],[9,-62],[-2,-23],[-13,-58],[0,-19],[9,-21],[36,-49],[17,-17],[74,-52],[31,-38],[28,-41],[38,-45],[10,-15],[2,-9],[0,-17],[2,-8],[6,-11],[18,-18],[31,-62],[3,-12],[-3,-8],[-8,-13],[-3,-11],[4,-2],[8,-2],[4,-7],[-6,-14],[5,-11],[5,-1],[6,1],[7,-4],[6,-9],[9,-22],[6,-10]],[[8010,6235],[6,14],[16,-4],[30,-15],[4,0],[19,4],[3,7],[-2,8],[-1,12],[1,14],[-4,8],[-10,5],[-6,3],[-4,16],[6,15],[12,9],[1,9],[-7,9],[-9,0],[-10,-5],[-23,-11],[-12,-3],[-8,-13],[-6,-8],[-14,-11],[-11,-2],[0,-4],[1,-8],[-6,-6],[-7,-4],[-4,-12],[-1,-13],[4,-8],[18,-5],[24,-1]]],"transform":{"scale":[0.0009372664967496691,0.0009110897661766216],"translate":[19.978345988000115,-26.891794127999987]}}; Datamap.prototype.cafTopo = '__CAF__'; Datamap.prototype.canTopo = '__CAN__'; Datamap.prototype.cheTopo = '__CHE__'; Datamap.prototype.chlTopo = '__CHL__'; Datamap.prototype.chnTopo = '__CHN__'; Datamap.prototype.civTopo = '__CIV__'; Datamap.prototype.clpTopo = '__CLP__'; Datamap.prototype.cmrTopo = '__CMR__'; Datamap.prototype.codTopo = '__COD__'; Datamap.prototype.cogTopo = '__COG__'; Datamap.prototype.cokTopo = '__COK__'; Datamap.prototype.colTopo = '__COL__'; Datamap.prototype.comTopo = '__COM__'; Datamap.prototype.cpvTopo = '__CPV__'; Datamap.prototype.criTopo = '__CRI__'; Datamap.prototype.csiTopo = '__CSI__'; Datamap.prototype.cubTopo = '__CUB__'; Datamap.prototype.cuwTopo = '__CUW__'; Datamap.prototype.cymTopo = '__CYM__'; Datamap.prototype.cynTopo = '__CYN__'; Datamap.prototype.cypTopo = '__CYP__'; Datamap.prototype.czeTopo = '__CZE__'; Datamap.prototype.deuTopo = '__DEU__'; Datamap.prototype.djiTopo = '__DJI__'; Datamap.prototype.dmaTopo = '__DMA__'; Datamap.prototype.dnkTopo = '__DNK__'; Datamap.prototype.domTopo = '__DOM__'; Datamap.prototype.dzaTopo = '__DZA__'; Datamap.prototype.ecuTopo = '__ECU__'; Datamap.prototype.egyTopo = '__EGY__'; Datamap.prototype.eriTopo = '__ERI__'; Datamap.prototype.esbTopo = '__ESB__'; Datamap.prototype.espTopo = '__ESP__'; Datamap.prototype.estTopo = '__EST__'; Datamap.prototype.ethTopo = '__ETH__'; Datamap.prototype.finTopo = '__FIN__'; Datamap.prototype.fjiTopo = '__FJI__'; Datamap.prototype.flkTopo = '__FLK__'; Datamap.prototype.fraTopo = '__FRA__'; Datamap.prototype.froTopo = '__FRO__'; Datamap.prototype.fsmTopo = '__FSM__'; Datamap.prototype.gabTopo = '__GAB__'; Datamap.prototype.psxTopo = '__PSX__'; Datamap.prototype.gbrTopo = '__GBR__'; Datamap.prototype.geoTopo = '__GEO__'; Datamap.prototype.ggyTopo = '__GGY__'; Datamap.prototype.ghaTopo = '__GHA__'; Datamap.prototype.gibTopo = '__GIB__'; Datamap.prototype.ginTopo = '__GIN__'; Datamap.prototype.gmbTopo = '__GMB__'; Datamap.prototype.gnbTopo = '__GNB__'; Datamap.prototype.gnqTopo = '__GNQ__'; Datamap.prototype.grcTopo = '__GRC__'; Datamap.prototype.grdTopo = '__GRD__'; Datamap.prototype.grlTopo = '__GRL__'; Datamap.prototype.gtmTopo = '__GTM__'; Datamap.prototype.gumTopo = '__GUM__'; Datamap.prototype.guyTopo = '__GUY__'; Datamap.prototype.hkgTopo = '__HKG__'; Datamap.prototype.hmdTopo = '__HMD__'; Datamap.prototype.hndTopo = '__HND__'; Datamap.prototype.hrvTopo = '__HRV__'; Datamap.prototype.htiTopo = '__HTI__'; Datamap.prototype.hunTopo = '__HUN__'; Datamap.prototype.idnTopo = '__IDN__'; Datamap.prototype.imnTopo = '__IMN__'; Datamap.prototype.indTopo = '__IND__'; Datamap.prototype.ioaTopo = '__IOA__'; Datamap.prototype.iotTopo = '__IOT__'; Datamap.prototype.irlTopo = '__IRL__'; Datamap.prototype.irnTopo = '__IRN__'; Datamap.prototype.irqTopo = '__IRQ__'; Datamap.prototype.islTopo = '__ISL__'; Datamap.prototype.isrTopo = '__ISR__'; Datamap.prototype.itaTopo = '__ITA__'; Datamap.prototype.jamTopo = '__JAM__'; Datamap.prototype.jeyTopo = '__JEY__'; Datamap.prototype.jorTopo = '__JOR__'; Datamap.prototype.jpnTopo = '__JPN__'; Datamap.prototype.kabTopo = '__KAB__'; Datamap.prototype.kasTopo = '__KAS__'; Datamap.prototype.kazTopo = '__KAZ__'; Datamap.prototype.kenTopo = '__KEN__'; Datamap.prototype.kgzTopo = '__KGZ__'; Datamap.prototype.khmTopo = '__KHM__'; Datamap.prototype.kirTopo = '__KIR__'; Datamap.prototype.knaTopo = '__KNA__'; Datamap.prototype.korTopo = '__KOR__'; Datamap.prototype.kosTopo = '__KOS__'; Datamap.prototype.kwtTopo = '__KWT__'; Datamap.prototype.laoTopo = '__LAO__'; Datamap.prototype.lbnTopo = '__LBN__'; Datamap.prototype.lbrTopo = '__LBR__'; Datamap.prototype.lbyTopo = '__LBY__'; Datamap.prototype.lcaTopo = '__LCA__'; Datamap.prototype.lieTopo = '__LIE__'; Datamap.prototype.lkaTopo = '__LKA__'; Datamap.prototype.lsoTopo = '__LSO__'; Datamap.prototype.ltuTopo = '__LTU__'; Datamap.prototype.luxTopo = '__LUX__'; Datamap.prototype.lvaTopo = '__LVA__'; Datamap.prototype.macTopo = '__MAC__'; Datamap.prototype.mafTopo = '__MAF__'; Datamap.prototype.marTopo = '__MAR__'; Datamap.prototype.mcoTopo = '__MCO__'; Datamap.prototype.mdaTopo = '__MDA__'; Datamap.prototype.mdgTopo = '__MDG__'; Datamap.prototype.mdvTopo = '__MDV__'; Datamap.prototype.mexTopo = '__MEX__'; Datamap.prototype.mhlTopo = '__MHL__'; Datamap.prototype.mkdTopo = '__MKD__'; Datamap.prototype.mliTopo = '__MLI__'; Datamap.prototype.mltTopo = '__MLT__'; Datamap.prototype.mmrTopo = '__MMR__'; Datamap.prototype.mneTopo = '__MNE__'; Datamap.prototype.mngTopo = '__MNG__'; Datamap.prototype.mnpTopo = '__MNP__'; Datamap.prototype.mozTopo = '__MOZ__'; Datamap.prototype.mrtTopo = '__MRT__'; Datamap.prototype.msrTopo = '__MSR__'; Datamap.prototype.musTopo = '__MUS__'; Datamap.prototype.mwiTopo = '__MWI__'; Datamap.prototype.mysTopo = '__MYS__'; Datamap.prototype.namTopo = '__NAM__'; Datamap.prototype.nclTopo = '__NCL__'; Datamap.prototype.nerTopo = '__NER__'; Datamap.prototype.nfkTopo = '__NFK__'; Datamap.prototype.ngaTopo = '__NGA__'; Datamap.prototype.nicTopo = '__NIC__'; Datamap.prototype.niuTopo = '__NIU__'; Datamap.prototype.nldTopo = '__NLD__'; Datamap.prototype.nplTopo = '__NPL__'; Datamap.prototype.nruTopo = '__NRU__'; Datamap.prototype.nulTopo = '__NUL__'; Datamap.prototype.nzlTopo = '__NZL__'; Datamap.prototype.omnTopo = '__OMN__'; Datamap.prototype.pakTopo = '__PAK__'; Datamap.prototype.panTopo = '__PAN__'; Datamap.prototype.pcnTopo = '__PCN__'; Datamap.prototype.perTopo = '__PER__'; Datamap.prototype.pgaTopo = '__PGA__'; Datamap.prototype.phlTopo = '__PHL__'; Datamap.prototype.plwTopo = '__PLW__'; Datamap.prototype.pngTopo = '__PNG__'; Datamap.prototype.polTopo = '__POL__'; Datamap.prototype.priTopo = '__PRI__'; Datamap.prototype.prkTopo = '__PRK__'; Datamap.prototype.prtTopo = '__PRT__'; Datamap.prototype.pryTopo = '__PRY__'; Datamap.prototype.pyfTopo = '__PYF__'; Datamap.prototype.qatTopo = '__QAT__'; Datamap.prototype.rouTopo = '__ROU__'; Datamap.prototype.rusTopo = '__RUS__'; Datamap.prototype.rwaTopo = '__RWA__'; Datamap.prototype.sahTopo = '__SAH__'; Datamap.prototype.sauTopo = '__SAU__'; Datamap.prototype.scrTopo = '__SCR__'; Datamap.prototype.sdnTopo = '__SDN__'; Datamap.prototype.sdsTopo = '__SDS__'; Datamap.prototype.senTopo = '__SEN__'; Datamap.prototype.serTopo = '__SER__'; Datamap.prototype.sgpTopo = '__SGP__'; Datamap.prototype.sgsTopo = '__SGS__'; Datamap.prototype.shnTopo = '__SHN__'; Datamap.prototype.slbTopo = '__SLB__'; Datamap.prototype.sleTopo = '__SLE__'; Datamap.prototype.slvTopo = '__SLV__'; Datamap.prototype.smrTopo = '__SMR__'; Datamap.prototype.solTopo = '__SOL__'; Datamap.prototype.somTopo = '__SOM__'; Datamap.prototype.spmTopo = '__SPM__'; Datamap.prototype.srbTopo = '__SRB__'; Datamap.prototype.stpTopo = '__STP__'; Datamap.prototype.surTopo = '__SUR__'; Datamap.prototype.svkTopo = '__SVK__'; Datamap.prototype.svnTopo = '__SVN__'; Datamap.prototype.sweTopo = '__SWE__'; Datamap.prototype.swzTopo = '__SWZ__'; Datamap.prototype.sxmTopo = '__SXM__'; Datamap.prototype.sycTopo = '__SYC__'; Datamap.prototype.syrTopo = '__SYR__'; Datamap.prototype.tcaTopo = '__TCA__'; Datamap.prototype.tcdTopo = '__TCD__'; Datamap.prototype.tgoTopo = '__TGO__'; Datamap.prototype.thaTopo = '__THA__'; Datamap.prototype.tjkTopo = '__TJK__'; Datamap.prototype.tkmTopo = '__TKM__'; Datamap.prototype.tlsTopo = '__TLS__'; Datamap.prototype.tonTopo = '__TON__'; Datamap.prototype.ttoTopo = '__TTO__'; Datamap.prototype.tunTopo = '__TUN__'; Datamap.prototype.turTopo = '__TUR__'; Datamap.prototype.tuvTopo = '__TUV__'; Datamap.prototype.twnTopo = '__TWN__'; Datamap.prototype.tzaTopo = '__TZA__'; Datamap.prototype.ugaTopo = '__UGA__'; Datamap.prototype.ukrTopo = '__UKR__'; Datamap.prototype.umiTopo = '__UMI__'; Datamap.prototype.uryTopo = '__URY__'; Datamap.prototype.usaTopo = '__USA__'; Datamap.prototype.usgTopo = '__USG__'; Datamap.prototype.uzbTopo = '__UZB__'; Datamap.prototype.vatTopo = '__VAT__'; Datamap.prototype.vctTopo = '__VCT__'; Datamap.prototype.venTopo = '__VEN__'; Datamap.prototype.vgbTopo = '__VGB__'; Datamap.prototype.virTopo = '__VIR__'; Datamap.prototype.vnmTopo = '__VNM__'; Datamap.prototype.vutTopo = '__VUT__'; Datamap.prototype.wlfTopo = '__WLF__'; Datamap.prototype.wsbTopo = '__WSB__'; Datamap.prototype.wsmTopo = '__WSM__'; Datamap.prototype.yemTopo = '__YEM__'; Datamap.prototype.zafTopo = '__ZAF__'; Datamap.prototype.zmbTopo = '__ZMB__'; Datamap.prototype.zweTopo = '__ZWE__'; /************************************** Utilities ***************************************/ //convert lat/lng coords to X / Y coords Datamap.prototype.latLngToXY = function(lat, lng) { return this.projection([lng, lat]); }; //add <g> layer to root SVG Datamap.prototype.addLayer = function( className, id, first ) { var layer; if ( first ) { layer = this.svg.insert('g', ':first-child') } else { layer = this.svg.append('g') } return layer.attr('id', id || '') .attr('class', className || ''); }; Datamap.prototype.updateChoropleth = function(data) { var svg = this.svg; for ( var subunit in data ) { if ( data.hasOwnProperty(subunit) ) { var color; var subunitData = data[subunit] if ( ! subunit ) { continue; } else if ( typeof subunitData === "string" ) { color = subunitData; } else if ( typeof subunitData.color === "string" ) { color = subunitData.color; } else { color = this.options.fills[ subunitData.fillKey ]; } //if it's an object, overriding the previous data if ( subunitData === Object(subunitData) ) { this.options.data[subunit] = defaults(subunitData, this.options.data[subunit] || {}); var geo = this.svg.select('.' + subunit).attr('data-info', JSON.stringify(this.options.data[subunit])); } svg .selectAll('.' + subunit) .transition() .style('fill', color); } } }; Datamap.prototype.updatePopup = function (element, d, options) { var self = this; element.on('mousemove', null); element.on('mousemove', function() { var position = d3.mouse(self.options.element); d3.select(self.svg[0][0].parentNode).select('.datamaps-hoverover') .style('top', ( (position[1] + 30)) + "px") .html(function() { var data = JSON.parse(element.attr('data-info')); try { return options.popupTemplate(d, data); } catch (e) { return ""; } }) .style('left', ( position[0]) + "px"); }); d3.select(self.svg[0][0].parentNode).select('.datamaps-hoverover').style('display', 'block'); }; Datamap.prototype.addPlugin = function( name, pluginFn ) { var self = this; if ( typeof Datamap.prototype[name] === "undefined" ) { Datamap.prototype[name] = function(data, options, callback, createNewLayer) { var layer; if ( typeof createNewLayer === "undefined" ) { createNewLayer = false; } if ( typeof options === 'function' ) { callback = options; options = undefined; } options = defaults(options || {}, self.options[name + 'Config']); //add a single layer, reuse the old layer if ( !createNewLayer && this.options[name + 'Layer'] ) { layer = this.options[name + 'Layer']; options = options || this.options[name + 'Options']; } else { layer = this.addLayer(name); this.options[name + 'Layer'] = layer; this.options[name + 'Options'] = options; } pluginFn.apply(this, [layer, data, options]); if ( callback ) { callback(layer); } }; } }; // expose library if (typeof exports === 'object') { d3 = require('d3'); topojson = require('topojson'); module.exports = Datamap; } else if ( typeof define === "function" && define.amd ) { define( "datamaps", ["require", "d3", "topojson"], function(require) { d3 = require('d3'); topojson = require('topojson'); return Datamap; }); } else { window.Datamap = window.Datamaps = Datamap; } if ( window.jQuery ) { window.jQuery.fn.datamaps = function(options, callback) { options = options || {}; options.element = this[0]; var datamap = new Datamap(options); if ( typeof callback === "function" ) { callback(datamap, options); } return this; }; } })();
pombredanne/cdnjs
ajax/libs/datamaps/0.5.2/datamaps.bwa.js
JavaScript
mit
50,987
(function() { var svg; //save off default references var d3 = window.d3, topojson = window.topojson; var defaultOptions = { scope: 'world', responsive: false, aspectRatio: 0.5625, setProjection: setProjection, projection: 'equirectangular', dataType: 'json', data: {}, done: function() {}, fills: { defaultFill: '#ABDDA4' }, filters: {}, geographyConfig: { dataUrl: null, hideAntarctica: true, hideHawaiiAndAlaska : false, borderWidth: 1, borderColor: '#FDFDFD', popupTemplate: function(geography, data) { return '<div class="hoverinfo"><strong>' + geography.properties.name + '</strong></div>'; }, popupOnHover: true, highlightOnHover: true, highlightFillColor: '#FC8D59', highlightBorderColor: 'rgba(250, 15, 160, 0.2)', highlightBorderWidth: 2 }, projectionConfig: { rotation: [97, 0] }, bubblesConfig: { borderWidth: 2, borderColor: '#FFFFFF', popupOnHover: true, radius: null, popupTemplate: function(geography, data) { return '<div class="hoverinfo"><strong>' + data.name + '</strong></div>'; }, fillOpacity: 0.75, animate: true, highlightOnHover: true, highlightFillColor: '#FC8D59', highlightBorderColor: 'rgba(250, 15, 160, 0.2)', highlightBorderWidth: 2, highlightFillOpacity: 0.85, exitDelay: 100, key: JSON.stringify }, arcConfig: { strokeColor: '#DD1C77', strokeWidth: 1, arcSharpness: 1, animationSpeed: 600 } }; /* Getter for value. If not declared on datumValue, look up the chain into optionsValue */ function val( datumValue, optionsValue, context ) { if ( typeof context === 'undefined' ) { context = optionsValue; optionsValues = undefined; } var value = typeof datumValue !== 'undefined' ? datumValue : optionsValue; if (typeof value === 'undefined') { return null; } if ( typeof value === 'function' ) { var fnContext = [context]; if ( context.geography ) { fnContext = [context.geography, context.data]; } return value.apply(null, fnContext); } else { return value; } } function addContainer( element, height, width ) { this.svg = d3.select( element ).append('svg') .attr('width', width || element.offsetWidth) .attr('data-width', width || element.offsetWidth) .attr('class', 'datamap') .attr('height', height || element.offsetHeight) .style('overflow', 'hidden'); // IE10+ doesn't respect height/width when map is zoomed in if (this.options.responsive) { d3.select(this.options.element).style({'position': 'relative', 'padding-bottom': (this.options.aspectRatio*100) + '%'}); d3.select(this.options.element).select('svg').style({'position': 'absolute', 'width': '100%', 'height': '100%'}); d3.select(this.options.element).select('svg').select('g').selectAll('path').style('vector-effect', 'non-scaling-stroke'); } return this.svg; } // setProjection takes the svg element and options function setProjection( element, options ) { var width = options.width || element.offsetWidth; var height = options.height || element.offsetHeight; var projection, path; var svg = this.svg; if ( options && typeof options.scope === 'undefined') { options.scope = 'world'; } if ( options.scope === 'usa' ) { projection = d3.geo.albersUsa() .scale(width) .translate([width / 2, height / 2]); } else if ( options.scope === 'world' ) { projection = d3.geo[options.projection]() .scale((width + 1) / 2 / Math.PI) .translate([width / 2, height / (options.projection === "mercator" ? 1.45 : 1.8)]); } if ( options.projection === 'orthographic' ) { svg.append("defs").append("path") .datum({type: "Sphere"}) .attr("id", "sphere") .attr("d", path); svg.append("use") .attr("class", "stroke") .attr("xlink:href", "#sphere"); svg.append("use") .attr("class", "fill") .attr("xlink:href", "#sphere"); projection.scale(250).clipAngle(90).rotate(options.projectionConfig.rotation) } path = d3.geo.path() .projection( projection ); return {path: path, projection: projection}; } function addStyleBlock() { if ( d3.select('.datamaps-style-block').empty() ) { d3.select('head').append('style').attr('class', 'datamaps-style-block') .html('.datamap path.datamaps-graticule { fill: none; stroke: #777; stroke-width: 0.5px; stroke-opacity: .5; pointer-events: none; } .datamap .labels {pointer-events: none;} .datamap path {stroke: #FFFFFF; stroke-width: 1px;} .datamaps-legend dt, .datamaps-legend dd { float: left; margin: 0 3px 0 0;} .datamaps-legend dd {width: 20px; margin-right: 6px; border-radius: 3px;} .datamaps-legend {padding-bottom: 20px; z-index: 1001; position: absolute; left: 4px; font-size: 12px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;} .datamaps-hoverover {display: none; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } .hoverinfo {padding: 4px; border-radius: 1px; background-color: #FFF; box-shadow: 1px 1px 5px #CCC; font-size: 12px; border: 1px solid #CCC; } .hoverinfo hr {border:1px dotted #CCC; }'); } } function drawSubunits( data ) { var fillData = this.options.fills, colorCodeData = this.options.data || {}, geoConfig = this.options.geographyConfig; var subunits = this.svg.select('g.datamaps-subunits'); if ( subunits.empty() ) { subunits = this.addLayer('datamaps-subunits', null, true); } var geoData = topojson.feature( data, data.objects[ this.options.scope ] ).features; if ( geoConfig.hideAntarctica ) { geoData = geoData.filter(function(feature) { return feature.id !== "ATA"; }); } if ( geoConfig.hideHawaiiAndAlaska ) { geoData = geoData.filter(function(feature) { return feature.id !== "HI" && feature.id !== 'AK'; }); } var geo = subunits.selectAll('path.datamaps-subunit').data( geoData ); geo.enter() .append('path') .attr('d', this.path) .attr('class', function(d) { return 'datamaps-subunit ' + d.id; }) .attr('data-info', function(d) { return JSON.stringify( colorCodeData[d.id]); }) .style('fill', function(d) { //if fillKey - use that //otherwise check 'fill' //otherwise check 'defaultFill' var fillColor; var datum = colorCodeData[d.id]; if ( datum && datum.fillKey ) { fillColor = fillData[ val(datum.fillKey, {data: colorCodeData[d.id], geography: d}) ]; } if ( typeof fillColor === 'undefined' ) { fillColor = val(datum && datum.fillColor, fillData.defaultFill, {data: colorCodeData[d.id], geography: d}); } return fillColor; }) .style('stroke-width', geoConfig.borderWidth) .style('stroke', geoConfig.borderColor); } function handleGeographyConfig () { var hoverover; var svg = this.svg; var self = this; var options = this.options.geographyConfig; if ( options.highlightOnHover || options.popupOnHover ) { svg.selectAll('.datamaps-subunit') .on('mouseover', function(d) { var $this = d3.select(this); var datum = self.options.data[d.id] || {}; if ( options.highlightOnHover ) { var previousAttributes = { 'fill': $this.style('fill'), 'stroke': $this.style('stroke'), 'stroke-width': $this.style('stroke-width'), 'fill-opacity': $this.style('fill-opacity') }; $this .style('fill', val(datum.highlightFillColor, options.highlightFillColor, datum)) .style('stroke', val(datum.highlightBorderColor, options.highlightBorderColor, datum)) .style('stroke-width', val(datum.highlightBorderWidth, options.highlightBorderWidth, datum)) .style('fill-opacity', val(datum.highlightFillOpacity, options.highlightFillOpacity, datum)) .attr('data-previousAttributes', JSON.stringify(previousAttributes)); //as per discussion on https://github.com/markmarkoh/datamaps/issues/19 if ( ! /((MSIE)|(Trident))/.test(navigator.userAgent) ) { moveToFront.call(this); } } if ( options.popupOnHover ) { self.updatePopup($this, d, options, svg); } }) .on('mouseout', function() { var $this = d3.select(this); if (options.highlightOnHover) { //reapply previous attributes var previousAttributes = JSON.parse( $this.attr('data-previousAttributes') ); for ( var attr in previousAttributes ) { $this.style(attr, previousAttributes[attr]); } } $this.on('mousemove', null); d3.selectAll('.datamaps-hoverover').style('display', 'none'); }); } function moveToFront() { this.parentNode.appendChild(this); } } //plugin to add a simple map legend function addLegend(layer, data, options) { data = data || {}; if ( !this.options.fills ) { return; } var html = '<dl>'; var label = ''; if ( data.legendTitle ) { html = '<h2>' + data.legendTitle + '</h2>' + html; } for ( var fillKey in this.options.fills ) { if ( fillKey === 'defaultFill') { if (! data.defaultFillName ) { continue; } label = data.defaultFillName; } else { if (data.labels && data.labels[fillKey]) { label = data.labels[fillKey]; } else { label= fillKey + ': '; } } html += '<dt>' + label + '</dt>'; html += '<dd style="background-color:' + this.options.fills[fillKey] + '">&nbsp;</dd>'; } html += '</dl>'; var hoverover = d3.select( this.options.element ).append('div') .attr('class', 'datamaps-legend') .html(html); } function addGraticule ( layer, options ) { var graticule = d3.geo.graticule(); this.svg.insert("path", '.datamaps-subunits') .datum(graticule) .attr("class", "datamaps-graticule") .attr("d", this.path); } function handleArcs (layer, data, options) { var self = this, svg = this.svg; if ( !data || (data && !data.slice) ) { throw "Datamaps Error - arcs must be an array"; } // For some reason arc options were put in an `options` object instead of the parent arc // I don't like this, so to match bubbles and other plugins I'm moving it // This is to keep backwards compatability for ( var i = 0; i < data.length; i++ ) { data[i] = defaults(data[i], data[i].options); delete data[i].options; } if ( typeof options === "undefined" ) { options = defaultOptions.arcConfig; } var arcs = layer.selectAll('path.datamaps-arc').data( data, JSON.stringify ); var path = d3.geo.path() .projection(self.projection); arcs .enter() .append('svg:path') .attr('class', 'datamaps-arc') .style('stroke-linecap', 'round') .style('stroke', function(datum) { return val(datum.strokeColor, options.strokeColor, datum); }) .style('fill', 'none') .style('stroke-width', function(datum) { return val(datum.strokeWidth, options.strokeWidth, datum); }) .attr('d', function(datum) { var originXY = self.latLngToXY(val(datum.origin.latitude, datum), val(datum.origin.longitude, datum)) var destXY = self.latLngToXY(val(datum.destination.latitude, datum), val(datum.destination.longitude, datum)); var midXY = [ (originXY[0] + destXY[0]) / 2, (originXY[1] + destXY[1]) / 2]; if (options.greatArc) { // TODO: Move this to inside `if` clause when setting attr `d` var greatArc = d3.geo.greatArc() .source(function(d) { return [val(d.origin.longitude, d), val(d.origin.latitude, d)]; }) .target(function(d) { return [val(d.destination.longitude, d), val(d.destination.latitude, d)]; }); return path(greatArc(datum)) } var sharpness = val(datum.arcSharpness, options.arcSharpness, datum); return "M" + originXY[0] + ',' + originXY[1] + "S" + (midXY[0] + (50 * sharpness)) + "," + (midXY[1] - (75 * sharpness)) + "," + destXY[0] + "," + destXY[1]; }) .transition() .delay(100) .style('fill', function(datum) { /* Thank you Jake Archibald, this is awesome. Source: http://jakearchibald.com/2013/animated-line-drawing-svg/ */ var length = this.getTotalLength(); this.style.transition = this.style.WebkitTransition = 'none'; this.style.strokeDasharray = length + ' ' + length; this.style.strokeDashoffset = length; this.getBoundingClientRect(); this.style.transition = this.style.WebkitTransition = 'stroke-dashoffset ' + val(datum.animationSpeed, options.animationSpeed, datum) + 'ms ease-out'; this.style.strokeDashoffset = '0'; return 'none'; }) arcs.exit() .transition() .style('opacity', 0) .remove(); } function handleLabels ( layer, options ) { var self = this; options = options || {}; var labelStartCoodinates = this.projection([-67.707617, 42.722131]); this.svg.selectAll(".datamaps-subunit") .attr("data-foo", function(d) { var center = self.path.centroid(d); var xOffset = 7.5, yOffset = 5; if ( ["FL", "KY", "MI"].indexOf(d.id) > -1 ) xOffset = -2.5; if ( d.id === "NY" ) xOffset = -1; if ( d.id === "MI" ) yOffset = 18; if ( d.id === "LA" ) xOffset = 13; var x,y; x = center[0] - xOffset; y = center[1] + yOffset; var smallStateIndex = ["VT", "NH", "MA", "RI", "CT", "NJ", "DE", "MD", "DC"].indexOf(d.id); if ( smallStateIndex > -1) { var yStart = labelStartCoodinates[1]; x = labelStartCoodinates[0]; y = yStart + (smallStateIndex * (2+ (options.fontSize || 12))); layer.append("line") .attr("x1", x - 3) .attr("y1", y - 5) .attr("x2", center[0]) .attr("y2", center[1]) .style("stroke", options.labelColor || "#000") .style("stroke-width", options.lineWidth || 1) } layer.append("text") .attr("x", x) .attr("y", y) .style("font-size", (options.fontSize || 10) + 'px') .style("font-family", options.fontFamily || "Verdana") .style("fill", options.labelColor || "#000") .text( d.id ); return "bar"; }); } function handleBubbles (layer, data, options ) { var self = this, fillData = this.options.fills, filterData = this.options.filters, svg = this.svg; if ( !data || (data && !data.slice) ) { throw "Datamaps Error - bubbles must be an array"; } var bubbles = layer.selectAll('circle.datamaps-bubble').data( data, options.key ); bubbles .enter() .append('svg:circle') .attr('class', 'datamaps-bubble') .attr('cx', function ( datum ) { var latLng; if ( datumHasCoords(datum) ) { latLng = self.latLngToXY(datum.latitude, datum.longitude); } else if ( datum.centered ) { latLng = self.path.centroid(svg.select('path.' + datum.centered).data()[0]); } if ( latLng ) return latLng[0]; }) .attr('cy', function ( datum ) { var latLng; if ( datumHasCoords(datum) ) { latLng = self.latLngToXY(datum.latitude, datum.longitude); } else if ( datum.centered ) { latLng = self.path.centroid(svg.select('path.' + datum.centered).data()[0]); } if ( latLng ) return latLng[1]; }) .attr('r', function(datum) { // if animation enabled start with radius 0, otherwise use full size. return options.animate ? 0 : val(datum.radius, options.radius, datum); }) .attr('data-info', function(d) { return JSON.stringify(d); }) .attr('filter', function (datum) { var filterKey = filterData[ val(datum.filterKey, options.filterKey, datum) ]; if (filterKey) { return filterKey; } }) .style('stroke', function ( datum ) { return val(datum.borderColor, options.borderColor, datum); }) .style('stroke-width', function ( datum ) { return val(datum.borderWidth, options.borderWidth, datum); }) .style('fill-opacity', function ( datum ) { return val(datum.fillOpacity, options.fillOpacity, datum); }) .style('fill', function ( datum ) { var fillColor = fillData[ val(datum.fillKey, options.fillKey, datum) ]; return fillColor || fillData.defaultFill; }) .on('mouseover', function ( datum ) { var $this = d3.select(this); if (options.highlightOnHover) { //save all previous attributes for mouseout var previousAttributes = { 'fill': $this.style('fill'), 'stroke': $this.style('stroke'), 'stroke-width': $this.style('stroke-width'), 'fill-opacity': $this.style('fill-opacity') }; $this .style('fill', val(datum.highlightFillColor, options.highlightFillColor, datum)) .style('stroke', val(datum.highlightBorderColor, options.highlightBorderColor, datum)) .style('stroke-width', val(datum.highlightBorderWidth, options.highlightBorderWidth, datum)) .style('fill-opacity', val(datum.highlightFillOpacity, options.highlightFillOpacity, datum)) .attr('data-previousAttributes', JSON.stringify(previousAttributes)); } if (options.popupOnHover) { self.updatePopup($this, datum, options, svg); } }) .on('mouseout', function ( datum ) { var $this = d3.select(this); if (options.highlightOnHover) { //reapply previous attributes var previousAttributes = JSON.parse( $this.attr('data-previousAttributes') ); for ( var attr in previousAttributes ) { $this.style(attr, previousAttributes[attr]); } } d3.selectAll('.datamaps-hoverover').style('display', 'none'); }) bubbles.transition() .duration(400) .attr('r', function ( datum ) { return val(datum.radius, options.radius, datum); }); bubbles.exit() .transition() .delay(options.exitDelay) .attr("r", 0) .remove(); function datumHasCoords (datum) { return typeof datum !== 'undefined' && typeof datum.latitude !== 'undefined' && typeof datum.longitude !== 'undefined'; } } //stolen from underscore.js function defaults(obj) { Array.prototype.slice.call(arguments, 1).forEach(function(source) { if (source) { for (var prop in source) { if (obj[prop] == null) obj[prop] = source[prop]; } } }); return obj; } /************************************** Public Functions ***************************************/ function Datamap( options ) { if ( typeof d3 === 'undefined' || typeof topojson === 'undefined' ) { throw new Error('Include d3.js (v3.0.3 or greater) and topojson on this page before creating a new map'); } //set options for global use this.options = defaults(options, defaultOptions); this.options.geographyConfig = defaults(options.geographyConfig, defaultOptions.geographyConfig); this.options.projectionConfig = defaults(options.projectionConfig, defaultOptions.projectionConfig); this.options.bubblesConfig = defaults(options.bubblesConfig, defaultOptions.bubblesConfig); this.options.arcConfig = defaults(options.arcConfig, defaultOptions.arcConfig); //add the SVG container if ( d3.select( this.options.element ).select('svg').length > 0 ) { addContainer.call(this, this.options.element, this.options.height, this.options.width ); } /* Add core plugins to this instance */ this.addPlugin('bubbles', handleBubbles); this.addPlugin('legend', addLegend); this.addPlugin('arc', handleArcs); this.addPlugin('labels', handleLabels); this.addPlugin('graticule', addGraticule); //append style block with basic hoverover styles if ( ! this.options.disableDefaultStyles ) { addStyleBlock(); } return this.draw(); } // resize map Datamap.prototype.resize = function () { var self = this; var options = self.options; if (options.responsive) { var newsize = options.element.clientWidth, oldsize = d3.select( options.element).select('svg').attr('data-width'); d3.select(options.element).select('svg').selectAll('g').attr('transform', 'scale(' + (newsize / oldsize) + ')'); } } // actually draw the features(states & countries) Datamap.prototype.draw = function() { //save off in a closure var self = this; var options = self.options; //set projections and paths based on scope var pathAndProjection = options.setProjection.apply(self, [options.element, options] ); this.path = pathAndProjection.path; this.projection = pathAndProjection.projection; //if custom URL for topojson data, retrieve it and render if ( options.geographyConfig.dataUrl ) { d3.json( options.geographyConfig.dataUrl, function(error, results) { if ( error ) throw new Error(error); self.customTopo = results; draw( results ); }); } else { draw( this[options.scope + 'Topo'] || options.geographyConfig.dataJson); } return this; function draw (data) { // if fetching remote data, draw the map first then call `updateChoropleth` if ( self.options.dataUrl ) { //allow for csv or json data types d3[self.options.dataType](self.options.dataUrl, function(data) { //in the case of csv, transform data to object if ( self.options.dataType === 'csv' && (data && data.slice) ) { var tmpData = {}; for(var i = 0; i < data.length; i++) { tmpData[data[i].id] = data[i]; } data = tmpData; } Datamaps.prototype.updateChoropleth.call(self, data); }); } drawSubunits.call(self, data); handleGeographyConfig.call(self); if ( self.options.geographyConfig.popupOnHover || self.options.bubblesConfig.popupOnHover) { hoverover = d3.select( self.options.element ).append('div') .attr('class', 'datamaps-hoverover') .style('z-index', 10001) .style('position', 'absolute'); } //fire off finished callback self.options.done(self); } }; /************************************** TopoJSON ***************************************/ Datamap.prototype.worldTopo = '__WORLD__'; Datamap.prototype.abwTopo = '__ABW__'; Datamap.prototype.afgTopo = '__AFG__'; Datamap.prototype.agoTopo = '__AGO__'; Datamap.prototype.aiaTopo = '__AIA__'; Datamap.prototype.albTopo = '__ALB__'; Datamap.prototype.aldTopo = '__ALD__'; Datamap.prototype.andTopo = '__AND__'; Datamap.prototype.areTopo = '__ARE__'; Datamap.prototype.argTopo = '__ARG__'; Datamap.prototype.armTopo = '__ARM__'; Datamap.prototype.asmTopo = '__ASM__'; Datamap.prototype.ataTopo = '__ATA__'; Datamap.prototype.atcTopo = '__ATC__'; Datamap.prototype.atfTopo = '__ATF__'; Datamap.prototype.atgTopo = '__ATG__'; Datamap.prototype.ausTopo = '__AUS__'; Datamap.prototype.autTopo = '__AUT__'; Datamap.prototype.azeTopo = '__AZE__'; Datamap.prototype.bdiTopo = '__BDI__'; Datamap.prototype.belTopo = '__BEL__'; Datamap.prototype.benTopo = '__BEN__'; Datamap.prototype.bfaTopo = '__BFA__'; Datamap.prototype.bgdTopo = '__BGD__'; Datamap.prototype.bgrTopo = '__BGR__'; Datamap.prototype.bhrTopo = '__BHR__'; Datamap.prototype.bhsTopo = '__BHS__'; Datamap.prototype.bihTopo = '__BIH__'; Datamap.prototype.bjnTopo = '__BJN__'; Datamap.prototype.blmTopo = '__BLM__'; Datamap.prototype.blrTopo = '__BLR__'; Datamap.prototype.blzTopo = '__BLZ__'; Datamap.prototype.bmuTopo = '__BMU__'; Datamap.prototype.bolTopo = '__BOL__'; Datamap.prototype.braTopo = '__BRA__'; Datamap.prototype.brbTopo = '__BRB__'; Datamap.prototype.brnTopo = '__BRN__'; Datamap.prototype.btnTopo = '__BTN__'; Datamap.prototype.norTopo = '__NOR__'; Datamap.prototype.bwaTopo = '__BWA__'; Datamap.prototype.cafTopo = '__CAF__'; Datamap.prototype.canTopo = '__CAN__'; Datamap.prototype.cheTopo = '__CHE__'; Datamap.prototype.chlTopo = '__CHL__'; Datamap.prototype.chnTopo = '__CHN__'; Datamap.prototype.civTopo = '__CIV__'; Datamap.prototype.clpTopo = '__CLP__'; Datamap.prototype.cmrTopo = '__CMR__'; Datamap.prototype.codTopo = '__COD__'; Datamap.prototype.cogTopo = '__COG__'; Datamap.prototype.cokTopo = '__COK__'; Datamap.prototype.colTopo = '__COL__'; Datamap.prototype.comTopo = '__COM__'; Datamap.prototype.cpvTopo = '__CPV__'; Datamap.prototype.criTopo = '__CRI__'; Datamap.prototype.csiTopo = '__CSI__'; Datamap.prototype.cubTopo = '__CUB__'; Datamap.prototype.cuwTopo = '__CUW__'; Datamap.prototype.cymTopo = '__CYM__'; Datamap.prototype.cynTopo = '__CYN__'; Datamap.prototype.cypTopo = '__CYP__'; Datamap.prototype.czeTopo = '__CZE__'; Datamap.prototype.deuTopo = '__DEU__'; Datamap.prototype.djiTopo = '__DJI__'; Datamap.prototype.dmaTopo = '__DMA__'; Datamap.prototype.dnkTopo = '__DNK__'; Datamap.prototype.domTopo = '__DOM__'; Datamap.prototype.dzaTopo = '__DZA__'; Datamap.prototype.ecuTopo = '__ECU__'; Datamap.prototype.egyTopo = '__EGY__'; Datamap.prototype.eriTopo = '__ERI__'; Datamap.prototype.esbTopo = '__ESB__'; Datamap.prototype.espTopo = '__ESP__'; Datamap.prototype.estTopo = '__EST__'; Datamap.prototype.ethTopo = '__ETH__'; Datamap.prototype.finTopo = '__FIN__'; Datamap.prototype.fjiTopo = '__FJI__'; Datamap.prototype.flkTopo = '__FLK__'; Datamap.prototype.fraTopo = '__FRA__'; Datamap.prototype.froTopo = '__FRO__'; Datamap.prototype.fsmTopo = '__FSM__'; Datamap.prototype.gabTopo = '__GAB__'; Datamap.prototype.psxTopo = '__PSX__'; Datamap.prototype.gbrTopo = '__GBR__'; Datamap.prototype.geoTopo = '__GEO__'; Datamap.prototype.ggyTopo = '__GGY__'; Datamap.prototype.ghaTopo = '__GHA__'; Datamap.prototype.gibTopo = '__GIB__'; Datamap.prototype.ginTopo = '__GIN__'; Datamap.prototype.gmbTopo = '__GMB__'; Datamap.prototype.gnbTopo = '__GNB__'; Datamap.prototype.gnqTopo = '__GNQ__'; Datamap.prototype.grcTopo = '__GRC__'; Datamap.prototype.grdTopo = '__GRD__'; Datamap.prototype.grlTopo = '__GRL__'; Datamap.prototype.gtmTopo = '__GTM__'; Datamap.prototype.gumTopo = '__GUM__'; Datamap.prototype.guyTopo = '__GUY__'; Datamap.prototype.hkgTopo = '__HKG__'; Datamap.prototype.hmdTopo = '__HMD__'; Datamap.prototype.hndTopo = '__HND__'; Datamap.prototype.hrvTopo = '__HRV__'; Datamap.prototype.htiTopo = '__HTI__'; Datamap.prototype.hunTopo = '__HUN__'; Datamap.prototype.idnTopo = '__IDN__'; Datamap.prototype.imnTopo = '__IMN__'; Datamap.prototype.indTopo = '__IND__'; Datamap.prototype.ioaTopo = '__IOA__'; Datamap.prototype.iotTopo = '__IOT__'; Datamap.prototype.irlTopo = '__IRL__'; Datamap.prototype.irnTopo = '__IRN__'; Datamap.prototype.irqTopo = '__IRQ__'; Datamap.prototype.islTopo = '__ISL__'; Datamap.prototype.isrTopo = '__ISR__'; Datamap.prototype.itaTopo = '__ITA__'; Datamap.prototype.jamTopo = '__JAM__'; Datamap.prototype.jeyTopo = '__JEY__'; Datamap.prototype.jorTopo = '__JOR__'; Datamap.prototype.jpnTopo = '__JPN__'; Datamap.prototype.kabTopo = '__KAB__'; Datamap.prototype.kasTopo = '__KAS__'; Datamap.prototype.kazTopo = '__KAZ__'; Datamap.prototype.kenTopo = '__KEN__'; Datamap.prototype.kgzTopo = '__KGZ__'; Datamap.prototype.khmTopo = '__KHM__'; Datamap.prototype.kirTopo = '__KIR__'; Datamap.prototype.knaTopo = '__KNA__'; Datamap.prototype.korTopo = '__KOR__'; Datamap.prototype.kosTopo = '__KOS__'; Datamap.prototype.kwtTopo = '__KWT__'; Datamap.prototype.laoTopo = '__LAO__'; Datamap.prototype.lbnTopo = '__LBN__'; Datamap.prototype.lbrTopo = '__LBR__'; Datamap.prototype.lbyTopo = '__LBY__'; Datamap.prototype.lcaTopo = '__LCA__'; Datamap.prototype.lieTopo = '__LIE__'; Datamap.prototype.lkaTopo = '__LKA__'; Datamap.prototype.lsoTopo = '__LSO__'; Datamap.prototype.ltuTopo = '__LTU__'; Datamap.prototype.luxTopo = '__LUX__'; Datamap.prototype.lvaTopo = '__LVA__'; Datamap.prototype.macTopo = '__MAC__'; Datamap.prototype.mafTopo = '__MAF__'; Datamap.prototype.marTopo = '__MAR__'; Datamap.prototype.mcoTopo = '__MCO__'; Datamap.prototype.mdaTopo = '__MDA__'; Datamap.prototype.mdgTopo = '__MDG__'; Datamap.prototype.mdvTopo = '__MDV__'; Datamap.prototype.mexTopo = '__MEX__'; Datamap.prototype.mhlTopo = '__MHL__'; Datamap.prototype.mkdTopo = '__MKD__'; Datamap.prototype.mliTopo = '__MLI__'; Datamap.prototype.mltTopo = '__MLT__'; Datamap.prototype.mmrTopo = '__MMR__'; Datamap.prototype.mneTopo = '__MNE__'; Datamap.prototype.mngTopo = '__MNG__'; Datamap.prototype.mnpTopo = '__MNP__'; Datamap.prototype.mozTopo = '__MOZ__'; Datamap.prototype.mrtTopo = '__MRT__'; Datamap.prototype.msrTopo = '__MSR__'; Datamap.prototype.musTopo = '__MUS__'; Datamap.prototype.mwiTopo = '__MWI__'; Datamap.prototype.mysTopo = '__MYS__'; Datamap.prototype.namTopo = '__NAM__'; Datamap.prototype.nclTopo = '__NCL__'; Datamap.prototype.nerTopo = '__NER__'; Datamap.prototype.nfkTopo = '__NFK__'; Datamap.prototype.ngaTopo = '__NGA__'; Datamap.prototype.nicTopo = '__NIC__'; Datamap.prototype.niuTopo = '__NIU__'; Datamap.prototype.nldTopo = '__NLD__'; Datamap.prototype.nplTopo = '__NPL__'; Datamap.prototype.nruTopo = '__NRU__'; Datamap.prototype.nulTopo = '__NUL__'; Datamap.prototype.nzlTopo = '__NZL__'; Datamap.prototype.omnTopo = '__OMN__'; Datamap.prototype.pakTopo = '__PAK__'; Datamap.prototype.panTopo = '__PAN__'; Datamap.prototype.pcnTopo = '__PCN__'; Datamap.prototype.perTopo = '__PER__'; Datamap.prototype.pgaTopo = '__PGA__'; Datamap.prototype.phlTopo = '__PHL__'; Datamap.prototype.plwTopo = '__PLW__'; Datamap.prototype.pngTopo = '__PNG__'; Datamap.prototype.polTopo = '__POL__'; Datamap.prototype.priTopo = '__PRI__'; Datamap.prototype.prkTopo = '__PRK__'; Datamap.prototype.prtTopo = '__PRT__'; Datamap.prototype.pryTopo = '__PRY__'; Datamap.prototype.pyfTopo = '__PYF__'; Datamap.prototype.qatTopo = '__QAT__'; Datamap.prototype.rouTopo = '__ROU__'; Datamap.prototype.rusTopo = '__RUS__'; Datamap.prototype.rwaTopo = '__RWA__'; Datamap.prototype.sahTopo = '__SAH__'; Datamap.prototype.sauTopo = '__SAU__'; Datamap.prototype.scrTopo = '__SCR__'; Datamap.prototype.sdnTopo = '__SDN__'; Datamap.prototype.sdsTopo = '__SDS__'; Datamap.prototype.senTopo = '__SEN__'; Datamap.prototype.serTopo = '__SER__'; Datamap.prototype.sgpTopo = '__SGP__'; Datamap.prototype.sgsTopo = '__SGS__'; Datamap.prototype.shnTopo = '__SHN__'; Datamap.prototype.slbTopo = '__SLB__'; Datamap.prototype.sleTopo = '__SLE__'; Datamap.prototype.slvTopo = '__SLV__'; Datamap.prototype.smrTopo = '__SMR__'; Datamap.prototype.solTopo = '__SOL__'; Datamap.prototype.somTopo = '__SOM__'; Datamap.prototype.spmTopo = '__SPM__'; Datamap.prototype.srbTopo = '__SRB__'; Datamap.prototype.stpTopo = '__STP__'; Datamap.prototype.surTopo = '__SUR__'; Datamap.prototype.svkTopo = '__SVK__'; Datamap.prototype.svnTopo = '__SVN__'; Datamap.prototype.sweTopo = '__SWE__'; Datamap.prototype.swzTopo = '__SWZ__'; Datamap.prototype.sxmTopo = '__SXM__'; Datamap.prototype.sycTopo = '__SYC__'; Datamap.prototype.syrTopo = '__SYR__'; Datamap.prototype.tcaTopo = '__TCA__'; Datamap.prototype.tcdTopo = '__TCD__'; Datamap.prototype.tgoTopo = '__TGO__'; Datamap.prototype.thaTopo = '__THA__'; Datamap.prototype.tjkTopo = '__TJK__'; Datamap.prototype.tkmTopo = '__TKM__'; Datamap.prototype.tlsTopo = '__TLS__'; Datamap.prototype.tonTopo = '__TON__'; Datamap.prototype.ttoTopo = '__TTO__'; Datamap.prototype.tunTopo = '__TUN__'; Datamap.prototype.turTopo = '__TUR__'; Datamap.prototype.tuvTopo = '__TUV__'; Datamap.prototype.twnTopo = {"type":"Topology","objects":{"twn":{"type":"GeometryCollection","geometries":[{"type":"Polygon","properties":{"name":"Kaohsiung City"},"id":"TW.KH.KC","arcs":[[0,1,2,3,4,5,6]]},{"type":"MultiPolygon","properties":{"name":"Pingtung"},"id":"TW.TW.PT","arcs":[[[7]],[[8,9,-3]]]},{"type":"MultiPolygon","properties":{"name":"Tainan City"},"id":"TW.TW.TN","arcs":[[[10]],[[11]],[[12]],[[13]],[[-5,14,15]]]},{"type":"Polygon","properties":{"name":"Hsinchu City"},"id":"TW.TW.HS","arcs":[[16,17,18]]},{"type":"Polygon","properties":{"name":"Hsinchu"},"id":"TW.TW.HH","arcs":[[19,20,21,-19,22,23]]},{"type":"MultiPolygon","properties":{"name":"Yilan"},"id":"TW.TW.IL","arcs":[[[24]],[[25,26,-20,27,28,29]]]},{"type":"Polygon","properties":{"name":"Keelung City"},"id":"TW.TW.CL","arcs":[[30,31]]},{"type":"Polygon","properties":{"name":"Miaoli"},"id":"TW.TW.ML","arcs":[[-22,32,33,-17]]},{"type":"Polygon","properties":{"name":"Taipei City"},"id":"TW.TP.TC","arcs":[[34]]},{"type":"MultiPolygon","properties":{"name":"New Taipei City"},"id":"TW.TW.TP","arcs":[[[-31,35,-29,36,37],[-35]],[[38]]]},{"type":"Polygon","properties":{"name":"Taoyuan"},"id":"TW.TW.TY","arcs":[[-28,-24,39,-37]]},{"type":"Polygon","properties":{"name":"Changhua"},"id":"TW.TW.CG","arcs":[[40,41,42,43]]},{"type":"MultiPolygon","properties":{"name":"Chiayi"},"id":"TW.TW.CH","arcs":[[[44]],[[45]],[[46]],[[47]],[[48]],[[49]],[[50,-6,-16,51,52],[53]]]},{"type":"Polygon","properties":{"name":"Chiayi City"},"id":"TW.TW.CS","arcs":[[-54]]},{"type":"Polygon","properties":{"name":"Hualien"},"id":"TW.TW.HL","arcs":[[54,55,-1,56,57,-26]]},{"type":"Polygon","properties":{"name":"Nantou"},"id":"TW.TW.NT","arcs":[[-57,-7,-51,58,-41,59]]},{"type":"Polygon","properties":{"name":"Taichung City"},"id":"TW.TW.TG","arcs":[[-21,-27,-58,-60,-44,60,-33]]},{"type":"Polygon","properties":{"name":"Yunlin"},"id":"TW.TW.YL","arcs":[[-59,-53,61,-42]]},{"type":"MultiPolygon","properties":{"name":"Taitung"},"id":"TW.TW.TT","arcs":[[[62]],[[63]],[[64]],[[-9,-2,-56,65]]]},{"type":"MultiPolygon","properties":{"name":"Penghu"},"id":"TW.TW.PH","arcs":[[[66]],[[67]],[[68]],[[69]],[[70]],[[71]],[[72]],[[73]],[[74]],[[75]],[[76]],[[77]],[[78]],[[79]],[[80]],[[81]],[[82]],[[83]]]},{"type":"MultiPolygon","properties":{"name":"Kinmen"},"id":"TW.FK.KM","arcs":[[[84]],[[85]],[[86]]]},{"type":"MultiPolygon","properties":{"name":"Lienchiang"},"id":"TW.FK.LK","arcs":[[[87]],[[88]],[[89]],[[90]],[[91]]]}]}},"arcs":[[[7259,3416],[19,-45],[-29,-39],[-55,-19],[-14,-25],[10,-31],[55,-28],[62,-40],[27,-59],[4,-20]],[[7338,3110],[-154,-30],[-63,-32],[-39,-30],[-77,-39],[-8,-45],[22,-46],[-26,-39],[-73,-31],[-9,-53],[22,-78],[-30,-103],[-1,-87],[-42,-46],[-84,-57],[-23,-76],[14,-63],[29,-36],[60,-50],[13,-39],[-38,-3]],[[6831,2127],[-1,0],[-51,7],[-42,-2],[-84,-52],[-58,43],[-74,69],[-71,-14],[-65,-46],[-129,52],[-92,-35],[-63,-56],[-78,-22],[-175,9],[-17,-38],[-13,-56],[-26,-62],[6,-55],[-2,-74],[-55,-166],[-2,-56],[28,-59],[3,-64],[-80,-161]],[[5690,1289],[-25,9],[-16,-1],[-18,-5],[-21,0],[-128,80],[-119,134],[125,-120],[-14,57],[-21,31],[-17,25],[-52,48],[-89,65],[-34,33],[-16,37],[22,36],[11,33],[-15,45],[-26,44],[-49,60],[-45,80],[-10,35],[1,23],[15,28],[3,19],[-5,10],[-13,7],[-13,11],[-6,18],[-28,38],[-7,15],[-21,107]],[[5059,2291],[61,28],[1,-3],[39,-68],[47,-19],[154,-17],[81,7],[83,-8],[41,11],[34,21],[64,20],[62,35],[23,42],[30,41],[52,55],[60,51],[64,42],[73,56],[63,65],[98,133],[103,118],[22,51]],[[6314,2952],[0,1],[-9,51],[-15,36],[2,38],[35,28],[67,-6],[58,5],[121,57],[44,41],[78,48],[75,33],[42,40],[35,53],[83,52],[182,74]],[[7112,3503],[43,-8],[57,-18],[41,-45],[6,-16]],[[5585,1005],[3,-3],[2,0],[2,-5],[13,-15],[-4,-3],[1,-4],[-26,-15],[-4,-2],[-16,-10],[-30,-21],[0,2],[0,-1],[-8,25],[13,20],[0,1],[27,28],[21,0],[6,3]],[[6831,2127],[33,-52],[8,-38],[52,-10],[55,-29],[-28,-107],[-1,-41],[-20,-39],[-96,-32],[-47,-21],[-75,-13],[-53,-35],[-23,-52],[-36,-51],[-30,-59],[-8,-115],[12,-51],[20,-48],[10,-56],[0,-41],[25,-40],[46,-43],[-24,-30],[-53,-25],[-20,-31],[-5,-36],[27,-30],[33,-13],[31,-35],[-1,-45],[5,-47],[32,-47],[45,-38],[100,-37],[44,3]],[[6889,743],[9,-406],[-16,-57],[-25,-47],[-33,-20],[-39,-29],[1,-66],[14,-71],[-3,-47],[-44,54],[-67,40],[-77,28],[-78,15],[-3,-52],[-23,-18],[-33,6],[-36,25],[-2,18],[12,55],[-54,73],[-5,19],[1,16],[4,26],[0,84],[5,25],[24,28],[6,23],[-196,406],[-16,22],[-54,54],[-43,77],[-20,22],[-80,51],[-32,14],[-11,3],[-10,6],[-10,29],[-6,11],[-43,22],[-99,38],[-44,24],[-47,33],[-22,11],[-4,1]],[[4744,2552],[-6,-10],[-22,16],[-17,32],[3,10],[7,0],[9,-9],[6,-15],[21,-17],[-1,-7]],[[4749,2767],[-28,-55],[-1,1],[39,105],[2,-2],[4,0],[-13,-40],[-3,-9]],[[4783,2867],[-1,0],[36,76],[5,1],[2,-14],[-42,-63]],[[4846,3042],[-3,-20],[-1,1],[6,82],[5,-1],[-7,-62]],[[5059,2291],[-9,49],[-18,28],[-38,31],[46,26],[26,47],[-10,41],[-62,7],[-12,-14],[-11,-27],[-17,-20],[-33,1],[-13,17],[5,55],[-8,19],[-40,14],[-22,-16],[-19,-23],[-26,-6],[-29,20],[-7,27],[6,27],[12,18],[29,12],[36,4],[31,7],[10,24],[-14,12],[-92,18],[0,16],[77,0],[-8,21],[-42,28],[-27,25],[7,32],[24,11],[27,7],[13,19],[-8,31],[-13,25],[9,23],[13,29],[23,21],[-5,17],[5,18],[33,70],[15,13],[26,5],[-37,20],[15,31]],[[4927,3151],[52,-15],[87,-10],[71,-14],[61,21],[25,39],[57,28],[65,40],[46,37],[60,36],[76,27],[150,22],[83,4],[71,-19],[39,-19],[20,-32],[18,-40],[97,-79],[9,-58],[-17,-111],[16,-36],[44,-27],[37,0],[53,19],[49,5],[36,-9],[82,-8]],[[7107,6267],[-2,-2],[-45,-9],[-43,14],[-27,29],[-42,20],[-67,21]],[[6881,6340],[11,31],[54,88],[22,23],[7,12],[0,13],[-7,14],[-11,17],[15,23],[17,14]],[[6989,6575],[82,-27],[148,-37],[53,-22],[38,-30],[18,-28],[-9,-28],[-23,-11],[-51,-6],[-58,-19],[-34,-33],[-22,-44],[-24,-23]],[[8275,6000],[-23,-50],[-14,-36],[6,-34],[-37,-45],[-137,-109],[-43,-81]],[[8027,5645],[-28,6],[-104,-8],[-7,-4]],[[7888,5639],[-6,37],[-45,61],[-33,24],[-13,35],[-49,30],[-123,-24],[-47,3],[-67,-3],[-75,-16],[-40,7],[8,39],[13,36],[-10,31],[-9,22],[9,25],[8,26],[3,30],[-7,41],[-38,25],[-120,45],[-59,34],[-37,35],[-44,85]],[[6989,6575],[1,1],[14,17],[6,30],[9,22],[20,22],[26,17],[25,7],[-2,9],[6,23],[22,46],[20,26]],[[7136,6795],[32,-9],[134,8],[45,-24],[39,-67],[49,-15],[43,-10],[40,-15],[67,-17],[36,-32],[-12,-45],[34,-29],[65,-16],[41,-23],[31,-24],[37,-5],[38,2],[33,-27],[26,-35],[43,-17],[33,-20],[4,-39],[15,-56],[-18,-59],[-46,-50],[6,-34],[50,-30],[61,-29],[54,-7],[40,-22],[72,-32],[47,-17]],[[9643,6575],[2,-1],[19,-2],[10,-12],[6,-5],[-7,-18],[-38,1],[-13,6],[-4,5],[-1,0],[-12,16],[10,-3],[24,11],[1,2],[2,0],[1,0]],[[9181,5399],[-10,0],[-110,13],[-181,85],[-38,-6],[-23,-46],[-48,-35],[-64,0],[-81,24],[-148,30],[-64,24],[-25,16]],[[8389,5504],[-57,36],[-48,0],[-47,-18],[-38,-4],[-37,19],[-43,20],[-48,8],[-15,29],[7,43],[-36,8]],[[8275,6000],[5,12],[38,12],[32,-5],[34,10],[22,30],[-31,95],[53,31],[30,6]],[[8458,6191],[57,13],[48,14],[37,25],[49,27],[65,25],[38,21],[-4,15],[-10,25],[-1,32],[19,38],[46,31],[38,17],[128,41],[132,62],[61,15],[50,28],[30,38],[32,32],[36,15],[35,10],[45,22],[16,29],[-25,28],[14,22],[110,18],[36,19],[82,34],[59,10],[33,-15],[7,-9]],[[9721,6873],[-117,-45],[-55,-37],[-183,-175],[-29,-37],[-23,-52],[-15,-59],[-5,-59],[2,-57],[33,-119],[-2,-31],[-14,-30],[2,-63],[33,-48],[64,-31],[76,-11],[0,-14],[-32,3],[-31,-2],[-25,-7],[-18,-10],[25,-39],[14,-50],[-9,-44],[-58,-26],[-5,-19],[8,-23],[17,-21],[5,-21],[-24,-19],[-61,-27],[-69,-63],[-3,-24],[4,-54],[-11,-21],[-13,-17],[-7,-25],[-6,-49],[-5,-13],[-10,-10],[-5,-10],[10,-13],[2,-2]],[[9176,7220],[-3,-91],[2,-24],[36,-29],[-4,-19],[-24,-15],[-40,-11],[-50,5],[-104,34],[-29,16],[-36,27],[-28,27],[-17,27],[-28,28],[-6,22],[31,17],[71,24],[43,22]],[[8990,7280],[14,-7],[7,-8],[17,-13],[38,-11],[110,-21]],[[7888,5639],[-37,-20],[-18,-44],[-47,-15],[-53,0],[-41,-23],[-45,-34],[-58,-25],[-114,-71],[-67,-22],[-87,-36],[-54,16],[-48,43],[-60,19],[-97,6],[-54,-26],[-8,-57],[-52,-22],[-119,-4],[-114,51],[-64,9],[-73,28],[-148,86],[-61,42],[-47,39],[-91,110]],[[6231,5689],[72,62],[18,32],[9,51],[21,43],[58,80],[16,48],[15,21],[67,15],[18,17],[12,20],[13,19],[41,34],[45,26],[55,11],[71,-10],[-10,42],[27,28],[37,30],[18,44],[8,14],[35,14],[4,10]],[[8767,6837],[-57,0],[-48,9],[-36,24],[-37,34],[-57,35],[-39,51],[16,57],[-12,48],[-56,43],[-38,32],[16,23],[18,19],[21,35],[35,30],[107,50],[29,19],[39,15],[37,-9],[21,-17],[-6,-28],[4,-26],[16,-25],[16,-27],[24,-78],[39,-26],[16,-34],[-16,-51],[1,-39],[46,-20],[36,-24],[-19,-33],[-75,-74],[-41,-13]],[[9176,7220],[340,-64],[32,-16],[-16,-28],[-5,-23],[7,-40],[24,-66],[26,-32],[21,-7],[69,8],[35,-3],[41,-8],[37,-15],[20,-19],[-86,-34]],[[8458,6191],[-24,42],[-88,65],[-14,43],[-7,40],[30,29],[15,40],[-83,95],[-50,16],[-72,-3],[-51,22],[13,51],[-10,40],[-52,39],[-11,39],[11,45],[-2,47],[36,31],[128,30],[33,27],[10,32],[-5,31],[-50,57],[-42,18],[-40,7],[-31,22],[-47,23],[-61,24],[-42,35]],[[7952,7178],[111,16],[46,14],[61,39],[18,8],[22,3],[30,0],[35,-9],[18,-20],[12,-21],[15,-12],[34,11],[-35,43],[-57,45],[-30,15],[9,21],[17,11],[19,7],[8,7],[20,40],[32,45],[64,45],[95,38],[108,19],[106,-10],[44,-25],[98,-109],[36,-57],[11,4],[27,5],[30,3],[22,-5],[-2,-6],[-10,-10],[-10,-14],[1,-17],[10,-9],[23,-13]],[[9999,8308],[-21,-11],[-3,22],[24,-11]],[[7136,6795],[88,109],[68,64],[71,46],[181,47],[42,21],[36,25],[45,18],[88,25],[197,28]],[[6350,4717],[0,-28],[-42,-11],[-12,-23],[6,-31],[-20,-35],[-16,-43],[-1,-44],[-11,-51],[-9,-104],[20,-49],[36,-25],[38,-11],[55,-22],[-10,-28],[-37,-12],[-25,-17],[-23,-12]],[[6299,4171],[-10,-6],[-118,19],[-57,-1],[-120,47],[-193,17],[-114,34],[-66,14],[-74,3],[-216,-20],[-74,34]],[[5257,4312],[7,11],[16,55],[12,23],[69,53],[20,22],[27,60],[40,60],[57,125],[26,36],[30,24],[24,13],[22,8],[15,11],[6,23],[12,21],[50,32],[12,23],[6,78],[9,22],[26,20],[112,102]],[[5855,5134],[57,-14],[39,-28],[26,-49],[10,-58],[44,-42],[117,-28],[43,-27],[31,-39],[20,-31],[0,-30],[12,-26],[42,-6],[54,-28],[0,-11]],[[4899,3136],[-18,-10],[-3,9],[23,24],[9,18],[11,12],[6,-4],[1,-9],[-14,-15],[-15,-25]],[[4921,3235],[-9,-9],[2,14],[20,30],[8,3],[-4,-15],[-17,-23]],[[4969,3305],[-1,0],[0,34],[5,-3],[1,-22],[-5,-9]],[[4983,3381],[-5,-14],[-1,3],[-2,-2],[-5,16],[12,-3],[1,0]],[[4970,3428],[-5,-11],[-10,14],[-3,3],[16,-3],[0,-2],[2,-1]],[[4677,3420],[-31,-13],[37,43],[137,109],[104,105],[25,6],[-89,-114],[-44,-35],[-29,-28],[-37,-29],[-29,-16],[-44,-28]],[[6540,3817],[60,-5],[66,-21],[40,-9],[51,-21],[-4,-41],[-29,-41],[12,-37],[26,-51],[4,-45],[11,-30],[75,-10],[251,-2],[9,-1]],[[4927,3151],[38,2],[32,12],[14,-4],[-8,25],[-22,-13],[-18,4],[-24,1],[-1,26],[25,43],[36,2],[53,0],[-36,81],[-41,63],[19,28],[0,16],[-30,11],[4,14],[17,16],[9,20],[39,41],[-84,-5],[-2,68]],[[4947,3602],[10,1],[1,0],[104,10],[81,-37],[60,0],[39,24],[16,38],[21,23],[52,7],[68,44],[44,19],[37,29],[161,73],[70,16],[124,18],[68,3],[52,-36],[49,-46],[124,-36],[36,4],[82,19],[46,-26],[23,-31],[62,5],[116,19],[38,10],[0,27],[4,38],[5,0]],[[5628,3578],[-37,-32],[9,-44],[60,-18],[69,-35],[72,-13],[66,21],[45,4],[29,17],[-25,53],[-24,31],[-40,17],[-55,17],[-77,-6],[-92,-12]],[[9181,5399],[7,-6],[9,-11],[7,-12],[2,-8],[-14,-19],[-57,-43],[-62,-67],[-45,-29],[-15,-15],[7,-17],[-8,-11],[-66,-39],[-24,-19],[-28,-47],[-28,-94],[-73,-84],[-14,-34],[2,-37],[17,-40],[15,-17],[13,-9],[8,-10],[1,-25],[-11,-28],[-36,-45],[-7,-27],[-4,-49],[-32,-126],[-62,-133],[-79,-311],[-47,-76],[-109,-498]],[[8448,3413],[-34,8],[-106,-41],[-38,-42],[17,-54],[6,-53],[-36,-53],[-33,-41],[-27,-52],[-23,-65],[-37,-60],[-47,-103],[-31,-47],[1,-53],[-9,-48],[-63,-29],[-81,9],[-115,75],[-90,125],[-56,12],[-62,7],[-49,37],[-60,22],[-77,22],[-49,64],[-11,57]],[[7259,3416],[60,27],[30,22],[-17,48],[15,21],[15,32],[51,29],[72,13],[73,2],[52,37],[13,66],[39,40],[75,22],[44,24],[16,40],[31,98],[13,65],[-10,56],[-11,42],[-31,31],[-21,31],[55,73],[3,29],[25,55],[37,65],[31,68],[15,78],[6,58],[-18,35],[-20,26],[23,59],[50,82],[79,81],[2,30],[-14,35],[-51,26],[-28,24],[-3,77],[36,22],[66,17],[51,19],[-3,28],[-13,49]],[[8097,5198],[27,15],[13,16],[33,13],[30,29],[13,40],[29,38],[74,37],[24,48],[4,32],[45,38]],[[6540,3817],[-26,27],[-81,-6],[-67,-17],[-57,20],[-39,37],[9,44],[19,40],[-10,60],[10,56],[20,36],[-19,57]],[[6350,4717],[42,-1],[176,-20],[41,6],[49,36],[75,112],[36,65],[63,24],[99,-11],[59,2],[57,59],[29,15],[89,-52],[34,7],[26,43],[46,30],[65,-1],[49,15],[77,59],[50,22],[44,6],[86,36],[61,2],[61,8],[110,34],[45,2],[47,-8],[131,-9]],[[5855,5134],[6,6],[7,25],[32,22],[22,49],[27,95],[91,125],[28,77],[33,42],[130,114]],[[4947,3602],[45,40],[-2,128],[7,95],[28,77],[43,59],[12,78],[23,68],[12,23],[61,64],[10,21],[7,11],[55,34],[9,12]],[[8774,109],[-8,-10],[-11,7],[8,11],[11,-8]],[[8728,244],[-54,-14],[-72,23],[-67,38],[-38,29],[11,21],[0,20],[-10,18],[-17,17],[192,0],[0,-14],[-5,-8],[-8,-19],[-4,-23],[9,-20],[46,-27],[20,-20],[-3,-21]],[[8492,1636],[-1,-8],[-7,2],[-17,0],[-9,1],[-5,5],[-26,8],[-27,38],[-14,33],[5,5],[99,6],[11,-5],[7,-15],[-7,-31],[-9,-13],[-4,-13],[4,-13]],[[8448,3413],[-45,-206],[-22,-37],[-69,-74],[-26,-38],[-20,-48],[-15,-89],[2,-79],[-10,-75],[-48,-78],[-20,-16],[-47,-27],[-21,-18],[-10,-17],[-17,-46],[-47,-65],[-29,-102],[-21,-46],[-100,-116],[-13,-21],[-137,-92],[-32,-30],[-5,-21],[7,-49],[-2,-22],[-12,-25],[-21,-27],[-47,-47],[-46,-35],[-158,-84],[-106,-93],[-26,-11],[-21,-22],[-51,-105],[-26,-39],[-79,-79],[-32,-47],[-19,-96],[-47,-131],[-93,-131],[-14,-45],[-16,-126],[2,-115]],[[3141,2877],[-17,-7],[-13,12],[-15,37],[10,9],[37,10],[27,-5],[1,-17],[-2,-13],[-12,-8],[-16,-18]],[[3130,2971],[-17,-25],[-22,6],[-20,19],[-2,19],[12,9],[31,-4],[18,-24]],[[3610,2996],[-5,-1],[0,1],[-1,0],[-10,10],[4,2],[-1,3],[16,1],[3,1],[5,0],[4,-6],[-2,-3],[6,-7],[-11,-1],[-1,0],[-7,0]],[[3621,3015],[-4,0],[2,5],[3,-4],[-1,-1]],[[3746,3031],[4,-1],[22,0],[-4,-8],[4,-2],[-10,-12],[-8,-14],[-5,12],[-6,10],[2,14],[1,0],[0,1]],[[3728,3036],[-1,-6],[2,0],[0,-4],[-5,1],[-5,1],[1,1],[-4,1],[5,0],[7,6]],[[3346,3047],[-18,-6],[12,14],[6,-8]],[[2894,3150],[-3,-1],[-1,1],[-3,3],[4,2],[3,-1],[0,-4]],[[2856,3163],[-3,-2],[-1,1],[-3,4],[5,2],[1,-2],[1,-3]],[[2895,3164],[-1,-8],[-3,0],[-4,12],[8,-4]],[[3417,3262],[-8,-1],[-8,0],[-30,-13],[-3,2],[3,11],[11,11],[7,5],[16,2],[14,-7],[-2,-10]],[[3335,3314],[1,-18],[5,-12],[7,-5],[7,-5],[-6,-12],[-12,-9],[1,-7],[5,-8],[-14,-5],[-32,3],[-15,5],[14,24],[-2,33],[-9,-5],[-19,-5],[-6,18],[20,40],[16,3],[27,-29],[6,-1],[6,-5]],[[2849,3359],[7,-2],[3,1],[13,-4],[-3,-4],[3,-9],[-6,-7],[-20,-4],[-3,4],[-8,4],[10,18],[2,0],[2,3]],[[3424,3551],[-25,-13],[-4,-1],[-3,-2],[-7,0],[-13,-4],[-23,-10],[-2,4],[-10,1],[-3,14],[2,1],[-1,0],[1,0],[5,3],[18,-4],[3,2],[10,4],[3,1],[1,0],[22,9],[24,-4],[2,-1]],[[3615,3769],[-6,-10],[40,10],[30,-3],[22,1],[16,21],[46,-67],[13,-31],[-6,-24],[-19,16],[-25,13],[-28,4],[-39,-17],[-27,-3],[-14,-6],[-7,-11],[-11,-32],[-7,-9],[-45,-21],[-48,-6],[-47,15],[-48,38],[13,19],[26,-25],[39,-6],[42,9],[35,22],[-24,7],[-19,10],[-15,12],[-14,17],[-6,-7],[0,-3],[-1,-1],[-11,-4],[-2,31],[2,31],[18,0],[21,-4],[72,36],[46,12],[-12,-34]],[[3223,3697],[-37,0],[6,16],[12,10],[19,4],[24,2],[22,6],[6,16],[1,37],[32,81],[30,24],[42,-29],[-25,-11],[-17,-28],[-27,-66],[-1,-18],[6,-15],[-3,-10],[-29,-4],[-22,-1],[-15,-2],[-12,-4],[-12,-8]],[[3555,3836],[-22,-5],[-11,11],[-8,27],[-20,23],[-42,33],[54,32],[33,-14],[31,-21],[13,-23],[-24,-18],[10,-27],[-14,-18]],[[3581,4072],[-3,-7],[-1,3],[-1,0],[-11,20],[3,4],[-5,7],[17,11],[11,17],[6,7],[4,-6],[0,-2],[25,-11],[-4,-14],[-22,-10],[-19,-19]],[[81,5593],[-52,-12],[-29,9],[49,77],[13,11],[21,4],[20,0],[19,-10],[17,-14],[-1,-25],[-13,-16],[-16,-1],[-11,-9],[-5,-9],[-12,-5]],[[621,5800],[46,-98],[-10,-67],[-38,-36],[-66,33],[-50,13],[-80,-7],[-70,-34],[-38,-47],[-33,-14],[-39,15],[-26,1],[-23,8],[-12,16],[4,6],[22,21],[6,10],[2,16],[-1,19],[-7,33],[-17,33],[-2,16],[15,7],[74,29],[99,-51],[68,6],[11,68],[22,42],[74,12],[69,-50]],[[3267,6860],[-28,-11],[-13,9],[7,24],[23,11],[17,-2],[2,-15],[-8,-16]],[[4601,9064],[-2,-18],[-19,-15],[-17,-7],[-23,-9],[24,43],[24,-4],[2,7],[11,3]],[[4485,9070],[-20,-16],[-23,26],[35,10],[26,-11],[-18,-9]],[[4453,9489],[10,-4],[44,19],[27,0],[0,-14],[-28,-24],[-54,-22],[-16,-2],[-25,13],[-7,18],[4,21],[11,16],[10,1],[0,-10],[3,-6],[21,-6]],[[4663,9624],[-2,-10],[-4,-7],[5,-9],[-1,-7],[-12,9],[-15,16],[-10,5],[-24,-9],[-9,3],[-13,-3],[-14,-12],[-12,-39],[-11,5],[-5,12],[5,33],[5,12],[11,5],[26,7],[6,7],[22,10],[25,-3],[13,-15],[8,-4],[6,-6]],[[5938,9970],[-11,-3],[-6,1],[-5,2],[-7,-3],[-7,-7],[-11,-16],[-3,4],[-12,2],[-6,2],[-12,5],[11,13],[-5,11],[9,4],[22,14],[26,-11],[6,-10],[11,-8]]],"transform":{"scale":[0.0003871236732673101,0.0004484579316931754],"translate":[118.20899498800023,21.904608466000084]}}; Datamap.prototype.tzaTopo = '__TZA__'; Datamap.prototype.ugaTopo = '__UGA__'; Datamap.prototype.ukrTopo = '__UKR__'; Datamap.prototype.umiTopo = '__UMI__'; Datamap.prototype.uryTopo = '__URY__'; Datamap.prototype.usaTopo = '__USA__'; Datamap.prototype.usgTopo = '__USG__'; Datamap.prototype.uzbTopo = '__UZB__'; Datamap.prototype.vatTopo = '__VAT__'; Datamap.prototype.vctTopo = '__VCT__'; Datamap.prototype.venTopo = '__VEN__'; Datamap.prototype.vgbTopo = '__VGB__'; Datamap.prototype.virTopo = '__VIR__'; Datamap.prototype.vnmTopo = '__VNM__'; Datamap.prototype.vutTopo = '__VUT__'; Datamap.prototype.wlfTopo = '__WLF__'; Datamap.prototype.wsbTopo = '__WSB__'; Datamap.prototype.wsmTopo = '__WSM__'; Datamap.prototype.yemTopo = '__YEM__'; Datamap.prototype.zafTopo = '__ZAF__'; Datamap.prototype.zmbTopo = '__ZMB__'; Datamap.prototype.zweTopo = '__ZWE__'; /************************************** Utilities ***************************************/ //convert lat/lng coords to X / Y coords Datamap.prototype.latLngToXY = function(lat, lng) { return this.projection([lng, lat]); }; //add <g> layer to root SVG Datamap.prototype.addLayer = function( className, id, first ) { var layer; if ( first ) { layer = this.svg.insert('g', ':first-child') } else { layer = this.svg.append('g') } return layer.attr('id', id || '') .attr('class', className || ''); }; Datamap.prototype.updateChoropleth = function(data) { var svg = this.svg; for ( var subunit in data ) { if ( data.hasOwnProperty(subunit) ) { var color; var subunitData = data[subunit] if ( ! subunit ) { continue; } else if ( typeof subunitData === "string" ) { color = subunitData; } else if ( typeof subunitData.color === "string" ) { color = subunitData.color; } else { color = this.options.fills[ subunitData.fillKey ]; } //if it's an object, overriding the previous data if ( subunitData === Object(subunitData) ) { this.options.data[subunit] = defaults(subunitData, this.options.data[subunit] || {}); var geo = this.svg.select('.' + subunit).attr('data-info', JSON.stringify(this.options.data[subunit])); } svg .selectAll('.' + subunit) .transition() .style('fill', color); } } }; Datamap.prototype.updatePopup = function (element, d, options) { var self = this; element.on('mousemove', null); element.on('mousemove', function() { var position = d3.mouse(self.options.element); d3.select(self.svg[0][0].parentNode).select('.datamaps-hoverover') .style('top', ( (position[1] + 30)) + "px") .html(function() { var data = JSON.parse(element.attr('data-info')); try { return options.popupTemplate(d, data); } catch (e) { return ""; } }) .style('left', ( position[0]) + "px"); }); d3.select(self.svg[0][0].parentNode).select('.datamaps-hoverover').style('display', 'block'); }; Datamap.prototype.addPlugin = function( name, pluginFn ) { var self = this; if ( typeof Datamap.prototype[name] === "undefined" ) { Datamap.prototype[name] = function(data, options, callback, createNewLayer) { var layer; if ( typeof createNewLayer === "undefined" ) { createNewLayer = false; } if ( typeof options === 'function' ) { callback = options; options = undefined; } options = defaults(options || {}, self.options[name + 'Config']); //add a single layer, reuse the old layer if ( !createNewLayer && this.options[name + 'Layer'] ) { layer = this.options[name + 'Layer']; options = options || this.options[name + 'Options']; } else { layer = this.addLayer(name); this.options[name + 'Layer'] = layer; this.options[name + 'Options'] = options; } pluginFn.apply(this, [layer, data, options]); if ( callback ) { callback(layer); } }; } }; // expose library if (typeof exports === 'object') { d3 = require('d3'); topojson = require('topojson'); module.exports = Datamap; } else if ( typeof define === "function" && define.amd ) { define( "datamaps", ["require", "d3", "topojson"], function(require) { d3 = require('d3'); topojson = require('topojson'); return Datamap; }); } else { window.Datamap = window.Datamaps = Datamap; } if ( window.jQuery ) { window.jQuery.fn.datamaps = function(options, callback) { options = options || {}; options.element = this[0]; var datamap = new Datamap(options); if ( typeof callback === "function" ) { callback(datamap, options); } return this; }; } })();
seogi1004/cdnjs
ajax/libs/datamaps/0.5.4/datamaps.twn.js
JavaScript
mit
55,187
<?php /* * This file is part of Twig. * * (c) 2009 Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ class Twig_Extension_Escaper extends Twig_Extension { protected $defaultStrategy; /** * Constructor. * * @param string|false|callable $defaultStrategy An escaping strategy * * @see setDefaultStrategy() */ public function __construct($defaultStrategy = 'html') { $this->setDefaultStrategy($defaultStrategy); } public function getTokenParsers() { return array(new Twig_TokenParser_AutoEscape()); } public function getNodeVisitors() { return array(new Twig_NodeVisitor_Escaper()); } public function getFilters() { return array( new Twig_SimpleFilter('raw', 'twig_raw_filter', array('is_safe' => array('all'))), ); } /** * Sets the default strategy to use when not defined by the user. * * The strategy can be a valid PHP callback that takes the template * "filename" as an argument and returns the strategy to use. * * @param string|false|callable $defaultStrategy An escaping strategy */ public function setDefaultStrategy($defaultStrategy) { // for BC if (true === $defaultStrategy) { @trigger_error('Using "true" as the default strategy is deprecated since version 1.21. Use "html" instead.', E_USER_DEPRECATED); $defaultStrategy = 'html'; } if ('filename' === $defaultStrategy) { $defaultStrategy = array('Twig_FileExtensionEscapingStrategy', 'guess'); } $this->defaultStrategy = $defaultStrategy; } /** * Gets the default strategy to use when not defined by the user. * * @param string $filename The template "filename" * * @return string|false The default strategy to use for the template */ public function getDefaultStrategy($filename) { // disable string callables to avoid calling a function named html or js, // or any other upcoming escaping strategy if (!is_string($this->defaultStrategy) && false !== $this->defaultStrategy) { return call_user_func($this->defaultStrategy, $filename); } return $this->defaultStrategy; } public function getName() { return 'escaper'; } } /** * Marks a variable as being safe. * * @param string $string A PHP variable * * @return string */ function twig_raw_filter($string) { return $string; }
rbvea/made-in-hawaii
wp-content/plugins/timber-library/vendor/twig/twig/lib/Twig/Extension/Escaper.php
PHP
mit
2,655
<?php /* * 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 * OWNER 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. * * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ namespace Doctrine\ORM\Internal\Hydration; /** * Represents a result structure that can be iterated over, hydrating row-by-row * during the iteration. An IterableResult is obtained by AbstractHydrator#iterate(). * * @author robo * @since 2.0 */ class IterableResult implements \Iterator { /** * @var \Doctrine\ORM\Internal\Hydration\AbstractHydrator */ private $_hydrator; /** * @var boolean */ private $_rewinded = false; /** * @var integer */ private $_key = -1; /** * @var object|null */ private $_current = null; /** * @param \Doctrine\ORM\Internal\Hydration\AbstractHydrator $hydrator */ public function __construct($hydrator) { $this->_hydrator = $hydrator; } /** * @return void * * @throws HydrationException */ public function rewind() { if ($this->_rewinded == true) { throw new HydrationException("Can only iterate a Result once."); } else { $this->_current = $this->next(); $this->_rewinded = true; } } /** * Gets the next set of results. * * @return array */ public function next() { $this->_current = $this->_hydrator->hydrateRow(); $this->_key++; return $this->_current; } /** * @return mixed */ public function current() { return $this->_current; } /** * @return int */ public function key() { return $this->_key; } /** * @return bool */ public function valid() { return ($this->_current!=false); } }
didjo972/Planning
vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/IterableResult.php
PHP
mit
2,685
<?php /** * CodeIgniter * * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * * Copyright (c) 2014 - 2016, British Columbia Institute of Technology * * 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. * * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.3.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); /** * ODBC Result Class * * This class extends the parent result class: CI_DB_result * * @package CodeIgniter * @subpackage Drivers * @category Database * @author EllisLab Dev Team * @link https://codeigniter.com/user_guide/database/ */ class CI_DB_odbc_result extends CI_DB_result { /** * Number of rows in the result set * * @return int */ public function num_rows() { if (is_int($this->num_rows)) { return $this->num_rows; } elseif (($this->num_rows = odbc_num_rows($this->result_id)) !== -1) { return $this->num_rows; } // Work-around for ODBC subdrivers that don't support num_rows() if (count($this->result_array) > 0) { return $this->num_rows = count($this->result_array); } elseif (count($this->result_object) > 0) { return $this->num_rows = count($this->result_object); } return $this->num_rows = count($this->result_array()); } // -------------------------------------------------------------------- /** * Number of fields in the result set * * @return int */ public function num_fields() { return odbc_num_fields($this->result_id); } // -------------------------------------------------------------------- /** * Fetch Field Names * * Generates an array of column names * * @return array */ public function list_fields() { $field_names = array(); $num_fields = $this->num_fields(); if ($num_fields > 0) { for ($i = 1; $i <= $num_fields; $i++) { $field_names[] = odbc_field_name($this->result_id, $i); } } return $field_names; } // -------------------------------------------------------------------- /** * Field data * * Generates an array of objects containing field meta-data * * @return array */ public function field_data() { $retval = array(); for ($i = 0, $odbc_index = 1, $c = $this->num_fields(); $i < $c; $i++, $odbc_index++) { $retval[$i] = new stdClass(); $retval[$i]->name = odbc_field_name($this->result_id, $odbc_index); $retval[$i]->type = odbc_field_type($this->result_id, $odbc_index); $retval[$i]->max_length = odbc_field_len($this->result_id, $odbc_index); $retval[$i]->primary_key = 0; $retval[$i]->default = ''; } return $retval; } // -------------------------------------------------------------------- /** * Free the result * * @return void */ public function free_result() { if (is_resource($this->result_id)) { odbc_free_result($this->result_id); $this->result_id = FALSE; } } // -------------------------------------------------------------------- /** * Result - associative array * * Returns the result set as an array * * @return array */ protected function _fetch_assoc() { return odbc_fetch_array($this->result_id); } // -------------------------------------------------------------------- /** * Result - object * * Returns the result set as an object * * @param string $class_name * @return object */ protected function _fetch_object($class_name = 'stdClass') { $row = odbc_fetch_object($this->result_id); if ($class_name === 'stdClass' OR ! $row) { return $row; } $class_name = new $class_name(); foreach ($row as $key => $value) { $class_name->$key = $value; } return $class_name; } } // -------------------------------------------------------------------- if ( ! function_exists('odbc_fetch_array')) { /** * ODBC Fetch array * * Emulates the native odbc_fetch_array() function when * it is not available (odbc_fetch_array() requires unixODBC) * * @param resource &$result * @param int $rownumber * @return array */ function odbc_fetch_array(&$result, $rownumber = 1) { $rs = array(); if ( ! odbc_fetch_into($result, $rs, $rownumber)) { return FALSE; } $rs_assoc = array(); foreach ($rs as $k => $v) { $field_name = odbc_field_name($result, $k+1); $rs_assoc[$field_name] = $v; } return $rs_assoc; } } // -------------------------------------------------------------------- if ( ! function_exists('odbc_fetch_object')) { /** * ODBC Fetch object * * Emulates the native odbc_fetch_object() function when * it is not available. * * @param resource &$result * @param int $rownumber * @return object */ function odbc_fetch_object(&$result, $rownumber = 1) { $rs = array(); if ( ! odbc_fetch_into($result, $rs, $rownumber)) { return FALSE; } $rs_object = new stdClass(); foreach ($rs as $k => $v) { $field_name = odbc_field_name($result, $k+1); $rs_object->$field_name = $v; } return $rs_object; } }
MarlonJD/ProjectBelle
system/database/drivers/odbc/odbc_result.php
PHP
mit
6,359
var baseClone = require('./_baseClone'), baseMatchesProperty = require('./_baseMatchesProperty'); /** Used to compose bitmasks for cloning. */ var CLONE_DEEP_FLAG = 1; /** * Creates a function that performs a partial deep comparison between the * value at `path` of a given object to `srcValue`, returning `true` if the * object value is equivalent, else `false`. * * **Note:** Partial comparisons will match empty array and empty object * `srcValue` values against any array or object value, respectively. See * `_.isEqual` for a list of supported value comparisons. * * @static * @memberOf _ * @since 3.2.0 * @category Util * @param {Array|string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. * @example * * var objects = [ * { 'a': 1, 'b': 2, 'c': 3 }, * { 'a': 4, 'b': 5, 'c': 6 } * ]; * * _.find(objects, _.matchesProperty('a', 4)); * // => { 'a': 4, 'b': 5, 'c': 6 } */ function matchesProperty(path, srcValue) { return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); } module.exports = matchesProperty;
IdealEnigma/idealenigma.github.io
node_modules/sass-graph/node_modules/lodash/matchesProperty.js
JavaScript
mit
1,153
/** * lodash 3.0.4 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ /** `Object#toString` result references. */ var arrayTag = '[object Array]', funcTag = '[object Function]'; /** Used to detect host constructors (Safari > 5). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** * Checks if `value` is object-like. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** Used for native method references. */ var objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var fnToString = Function.prototype.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objToString = objectProto.toString; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /* Native method references for those with the same name as other `lodash` methods. */ var nativeIsArray = getNative(Array, 'isArray'); /** * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) * of an array-like value. */ var MAX_SAFE_INTEGER = 9007199254740991; /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = object == null ? undefined : object[key]; return isNative(value) ? value : undefined; } /** * Checks if `value` is a valid array-like length. * * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(function() { return arguments; }()); * // => false */ var isArray = nativeIsArray || function(value) { return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; }; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in older versions of Chrome and Safari which return 'function' for regexes // and Safari 8 equivalents which return 'object' for typed array constructors. return isObject(value) && objToString.call(value) == funcTag; } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(1); * // => false */ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is a native function. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, else `false`. * @example * * _.isNative(Array.prototype.push); * // => true * * _.isNative(_); * // => false */ function isNative(value) { if (value == null) { return false; } if (isFunction(value)) { return reIsNative.test(fnToString.call(value)); } return isObjectLike(value) && reIsHostCtor.test(value); } module.exports = isArray;
Jandersolutions/jander777-ghost
node_modules/grunt-jscs/node_modules/jscs/node_modules/lodash.assign/node_modules/lodash._baseassign/node_modules/lodash.keys/node_modules/lodash.isarray/index.js
JavaScript
mit
5,164
/*! UIkit 2.14.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ .uk-nestable{padding:0;list-style:none}.uk-nestable-list{margin:0;padding-left:40px;list-style:none}.uk-nestable-list-dragged{position:absolute;z-index:1050;padding-left:0;pointer-events:none}.uk-nestable-item{margin-bottom:10px;padding:5px;background:#f5f5f5}.uk-nestable-placeholder{-moz-box-sizing:border-box;box-sizing:border-box;margin-bottom:10px;border:1px dashed #ddd}.uk-nestable-empty{min-height:40px}.uk-nestable-handle{display:inline-block;font-size:18px;color:#ddd;touch-action:none}.uk-nestable-handle:hover{cursor:move}.uk-nestable-handle:after{content:"\f0c9";font-family:FontAwesome}.uk-nestable-moving,.uk-nestable-moving *{cursor:move}[data-nestable-action=toggle]{display:inline-block;color:#999;visibility:hidden}[data-nestable-action=toggle]:hover{color:#444;cursor:pointer}[data-nestable-action=toggle]:after{content:"\f147";font-family:FontAwesome}.uk-parent>.uk-nestable-item [data-nestable-action=toggle]{visibility:visible}.uk-collapsed>.uk-nestable-item [data-nestable-action=toggle]:after{content:"\f196"}.uk-collapsed .uk-nestable-list{display:none}
rtenshi/jsdelivr
files/uikit/2.14.0/css/components/nestable.min.css
CSS
mit
1,159
/** * mixin issues * * Copyright 2012 Cloud9 IDE, Inc. * * This product includes software developed by * Cloud9 IDE, Inc (http://c9.io). * * Author: Mike de Boer <info@mikedeboer.nl> **/ "use strict"; var error = require("./../../error"); var Util = require("./../../util"); var issues = module.exports = { issues: {} }; (function() { /** section: github * issues#getAll(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - filter (String): Optional. Validation rule: ` ^(all|assigned|created|mentioned|subscribed)$ `. * - state (String): Optional. open, closed, or all Validation rule: ` ^(open|closed|all)$ `. * - labels (String): Optional. String list of comma separated Label names. Example: bug,ui,@high * - sort (String): Optional. Validation rule: ` ^(created|updated|comments)$ `. * - direction (String): Optional. Validation rule: ` ^(asc|desc)$ `. * - since (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ * - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `. * - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `. **/ this.getAll = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#repoIssues(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - milestone (String): Optional. Validation rule: ` ^([0-9]+|none|\*)$ `. * - state (String): Optional. open, closed, or all Validation rule: ` ^(open|closed|all)$ `. * - assignee (String): Optional. String User login, `none` for Issues with no assigned User. `*` for Issues with any assigned User. * - creator (String): Optional. The user that created the issue. * - mentioned (String): Optional. String User login. * - labels (String): Optional. String list of comma separated Label names. Example: bug,ui,@high * - sort (String): Optional. Validation rule: ` ^(created|updated|comments)$ `. * - direction (String): Optional. Validation rule: ` ^(asc|desc)$ `. * - since (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ * - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `. * - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `. **/ this.repoIssues = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#getRepoIssue(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - number (Number): Required. Validation rule: ` ^[0-9]+$ `. **/ this.getRepoIssue = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#create(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - title (String): Required. * - body (String): Optional. * - assignee (String): Optional. Login for the user that this issue should be assigned to. * - milestone (Number): Optional. Milestone to associate this issue with. Validation rule: ` ^[0-9]+$ `. * - labels (Json): Optional. Array of strings - Labels to associate with this issue. **/ this.create = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#edit(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - number (Number): Required. Validation rule: ` ^[0-9]+$ `. * - title (String): Optional. * - body (String): Optional. * - assignee (String): Optional. Login for the user that this issue should be assigned to. * - milestone (Number): Optional. Milestone to associate this issue with. Validation rule: ` ^[0-9]+$ `. * - labels (Json): Optional. Array of strings - Labels to associate with this issue. * - state (String): Optional. open or closed Validation rule: ` ^(open|closed)$ `. **/ this.edit = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#repoComments(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - sort (String): Optional. Validation rule: ` ^(created|updated)$ `. * - direction (String): Optional. Validation rule: ` ^(asc|desc)$ `. * - since (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ * - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `. * - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `. **/ this.repoComments = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#getComments(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - number (Number): Required. Validation rule: ` ^[0-9]+$ `. * - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `. * - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `. **/ this.getComments = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#getComment(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - id (String): Required. **/ this.getComment = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#createComment(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - number (Number): Required. Validation rule: ` ^[0-9]+$ `. * - body (String): Required. **/ this.createComment = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#editComment(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - id (String): Required. * - body (String): Required. **/ this.editComment = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#deleteComment(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - id (String): Required. **/ this.deleteComment = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#getEvents(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - number (Number): Required. Validation rule: ` ^[0-9]+$ `. * - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `. * - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `. **/ this.getEvents = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#getRepoEvents(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `. * - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `. **/ this.getRepoEvents = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#getEvent(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - id (String): Required. **/ this.getEvent = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#getLabels(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `. * - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `. **/ this.getLabels = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#getLabel(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - name (String): Required. **/ this.getLabel = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#createLabel(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - name (String): Required. * - color (String): Required. 6 character hex code, without a leading #. **/ this.createLabel = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#updateLabel(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - name (String): Required. * - color (String): Required. 6 character hex code, without a leading #. **/ this.updateLabel = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#deleteLabel(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - name (String): Required. **/ this.deleteLabel = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#getIssueLabels(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - number (Number): Required. Validation rule: ` ^[0-9]+$ `. **/ this.getIssueLabels = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#getAllMilestones(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - state (String): Optional. Validation rule: ` ^(open|closed)$ `. * - sort (String): Optional. due_date, completeness, default: due_date Validation rule: ` ^(due_date|completeness)$ `. * - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `. * - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `. **/ this.getAllMilestones = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#getMilestone(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - number (Number): Required. Validation rule: ` ^[0-9]+$ `. **/ this.getMilestone = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#createMilestone(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - title (String): Required. * - state (String): Optional. Validation rule: ` ^(open|closed)$ `. * - description (String): Optional. * - due_on (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ **/ this.createMilestone = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#updateMilestone(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - number (Number): Required. Validation rule: ` ^[0-9]+$ `. * - title (String): Required. * - state (String): Optional. Validation rule: ` ^(open|closed)$ `. * - description (String): Optional. * - due_on (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ **/ this.updateMilestone = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; /** section: github * issues#deleteMilestone(msg, callback) -> null * - msg (Object): Object that contains the parameters and their values to be sent to the server. * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. * * ##### Params on the `msg` object: * * - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'. * - user (String): Required. * - repo (String): Required. * - number (Number): Required. Validation rule: ` ^[0-9]+$ `. **/ this.deleteMilestone = function(msg, block, callback) { var self = this; this.client.httpSend(msg, block, function(err, res) { if (err) return self.sendError(err, null, msg, callback); var ret; try { ret = res.data; var contentType = res.headers["content-type"]; if (contentType && contentType.indexOf("application/json") !== -1) ret = JSON.parse(ret); } catch (ex) { if (callback) callback(new error.InternalServerError(ex.message), res); return; } if (!ret) ret = {}; if (typeof ret == "object") { if (!ret.meta) ret.meta = {}; ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) { if (res.headers[header]) ret.meta[header] = res.headers[header]; }); } if (callback) callback(null, ret); }); }; }).call(issues.issues);
blad3r/test1
node_modules/bower/node_modules/github/api/v3.0.0/issues.js
JavaScript
mit
54,469
/* Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojo.rpc.JsonService"]){ dojo._hasResource["dojo.rpc.JsonService"]=true; dojo.provide("dojo.rpc.JsonService"); dojo.require("dojo.rpc.RpcService"); dojo.declare("dojo.rpc.JsonService",dojo.rpc.RpcService,{bustCache:false,contentType:"application/json-rpc",lastSubmissionId:0,callRemote:function(_1,_2){ var _3=new dojo.Deferred(); this.bind(_1,_2,_3); return _3; },bind:function(_4,_5,_6,_7){ var _8=dojo.rawXhrPost({url:_7||this.serviceUrl,postData:this.createRequest(_4,_5),contentType:this.contentType,timeout:this.timeout,handleAs:"json-comment-optional"}); _8.addCallbacks(this.resultCallback(_6),this.errorCallback(_6)); },createRequest:function(_9,_a){ var _b={"params":_a,"method":_9,"id":++this.lastSubmissionId}; var _c=dojo.toJson(_b); return _c; },parseResults:function(_d){ if(dojo.isObject(_d)){ if("result" in _d){ return _d.result; } if("Result" in _d){ return _d.Result; } if("ResultSet" in _d){ return _d.ResultSet; } } return _d; }}); }
nolsherry/cdnjs
ajax/libs/dojo/1.6.3/rpc/JsonService.js
JavaScript
mit
1,176
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ //>>built define("dojo/has",["require","module"],function(_1,_2){ var _3=_1.has||function(){ }; if(!1){ var _4=typeof window!="undefined"&&typeof location!="undefined"&&typeof document!="undefined"&&window.location==location&&window.document==document,_5=(function(){ return this; })(),_6=_4&&document,_7=_6&&_6.createElement("DiV"),_8=(_2.config&&_2.config())||{}; _3=function(_9){ return typeof _8[_9]=="function"?(_8[_9]=_8[_9](_5,_6,_7)):_8[_9]; }; _3.cache=_8; _3.add=function(_a,_b,_c,_d){ (typeof _8[_a]=="undefined"||_d)&&(_8[_a]=_b); return _c&&_3(_a); }; 1||_3.add("host-browser",_4); 0&&_3.add("host-node",(typeof process=="object"&&process.versions&&process.versions.node&&process.versions.v8)); 0&&_3.add("host-rhino",(typeof load=="function"&&(typeof Packages=="function"||typeof Packages=="object"))); 1||_3.add("dom",_4); 1||_3.add("dojo-dom-ready-api",1); 1||_3.add("dojo-sniff",1); } if(1){ _3.add("dom-addeventlistener",!!document.addEventListener); _3.add("touch","ontouchstart" in document||window.navigator.msMaxTouchPoints>0); _3.add("device-width",screen.availWidth||innerWidth); var _e=document.createElement("form"); _3.add("dom-attributes-explicit",_e.attributes.length==0); _3.add("dom-attributes-specified-flag",_e.attributes.length>0&&_e.attributes.length<40); } _3.clearElement=function(_f){ _f.innerHTML=""; return _f; }; _3.normalize=function(id,_10){ var _11=id.match(/[\?:]|[^:\?]*/g),i=0,get=function(_12){ var _13=_11[i++]; if(_13==":"){ return 0; }else{ if(_11[i++]=="?"){ if(!_12&&_3(_13)){ return get(); }else{ get(true); return get(_12); } } return _13||0; } }; id=get(); return id&&_10(id); }; _3.load=function(id,_14,_15){ if(id){ _14([id],_15); }else{ _15(); } }; return _3; });
khasinski/cdnjs
ajax/libs/dojo/1.9.7/has.js
JavaScript
mit
1,919
/* Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojo.cookie"]){ dojo._hasResource["dojo.cookie"]=true; dojo.provide("dojo.cookie"); dojo.require("dojo.regexp"); dojo.cookie=function(_1,_2,_3){ var c=document.cookie; if(arguments.length==1){ var _4=c.match(new RegExp("(?:^|; )"+dojo.regexp.escapeString(_1)+"=([^;]*)")); return _4?decodeURIComponent(_4[1]):undefined; }else{ _3=_3||{}; var _5=_3.expires; if(typeof _5=="number"){ var d=new Date(); d.setTime(d.getTime()+_5*24*60*60*1000); _5=_3.expires=d; } if(_5&&_5.toUTCString){ _3.expires=_5.toUTCString(); } _2=encodeURIComponent(_2); var _6=_1+"="+_2,_7; for(_7 in _3){ _6+="; "+_7; var _8=_3[_7]; if(_8!==true){ _6+="="+_8; } } document.cookie=_6; } }; dojo.cookie.isSupported=function(){ if(!("cookieEnabled" in navigator)){ this("__djCookieTest__","CookiesAllowed"); navigator.cookieEnabled=this("__djCookieTest__")=="CookiesAllowed"; if(navigator.cookieEnabled){ this("__djCookieTest__","",{expires:-1}); } } return navigator.cookieEnabled; }; }
rigdern/cdnjs
ajax/libs/dojo/1.5.4/cookie.js
JavaScript
mit
1,178
'use strict'; var dP = require('./_object-dp').f , create = require('./_object-create') , hide = require('./_hide') , redefineAll = require('./_redefine-all') , ctx = require('./_ctx') , anInstance = require('./_an-instance') , defined = require('./_defined') , forOf = require('./_for-of') , $iterDefine = require('./_iter-define') , step = require('./_iter-step') , setSpecies = require('./_set-species') , DESCRIPTORS = require('./_descriptors') , fastKey = require('./_meta').fastKey , SIZE = DESCRIPTORS ? '_s' : 'size'; var getEntry = function(that, key){ // fast case var index = fastKey(key), entry; if(index !== 'F')return that._i[index]; // frozen object case for(entry = that._f; entry; entry = entry.n){ if(entry.k == key)return entry; } }; module.exports = { getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ var C = wrapper(function(that, iterable){ anInstance(that, C, NAME, '_i'); that._i = create(null); // index that._f = undefined; // first entry that._l = undefined; // last entry that[SIZE] = 0; // size if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); }); redefineAll(C.prototype, { // 23.1.3.1 Map.prototype.clear() // 23.2.3.2 Set.prototype.clear() clear: function clear(){ for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){ entry.r = true; if(entry.p)entry.p = entry.p.n = undefined; delete data[entry.i]; } that._f = that._l = undefined; that[SIZE] = 0; }, // 23.1.3.3 Map.prototype.delete(key) // 23.2.3.4 Set.prototype.delete(value) 'delete': function(key){ var that = this , entry = getEntry(that, key); if(entry){ var next = entry.n , prev = entry.p; delete that._i[entry.i]; entry.r = true; if(prev)prev.n = next; if(next)next.p = prev; if(that._f == entry)that._f = next; if(that._l == entry)that._l = prev; that[SIZE]--; } return !!entry; }, // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) forEach: function forEach(callbackfn /*, that = undefined */){ anInstance(this, C, 'forEach'); var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3) , entry; while(entry = entry ? entry.n : this._f){ f(entry.v, entry.k, this); // revert to the last existing entry while(entry && entry.r)entry = entry.p; } }, // 23.1.3.7 Map.prototype.has(key) // 23.2.3.7 Set.prototype.has(value) has: function has(key){ return !!getEntry(this, key); } }); if(DESCRIPTORS)dP(C.prototype, 'size', { get: function(){ return defined(this[SIZE]); } }); return C; }, def: function(that, key, value){ var entry = getEntry(that, key) , prev, index; // change existing entry if(entry){ entry.v = value; // create new entry } else { that._l = entry = { i: index = fastKey(key, true), // <- index k: key, // <- key v: value, // <- value p: prev = that._l, // <- previous entry n: undefined, // <- next entry r: false // <- removed }; if(!that._f)that._f = entry; if(prev)prev.n = entry; that[SIZE]++; // add to index if(index !== 'F')that._i[index] = entry; } return that; }, getEntry: getEntry, setStrong: function(C, NAME, IS_MAP){ // add .keys, .values, .entries, [@@iterator] // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 $iterDefine(C, NAME, function(iterated, kind){ this._t = iterated; // target this._k = kind; // kind this._l = undefined; // previous }, function(){ var that = this , kind = that._k , entry = that._l; // revert to the last existing entry while(entry && entry.r)entry = entry.p; // get next entry if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){ // or finish the iteration that._t = undefined; return step(1); } // return step by kind if(kind == 'keys' )return step(0, entry.k); if(kind == 'values')return step(0, entry.v); return step(0, [entry.k, entry.v]); }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true); // add [@@species], 23.1.2.2, 23.2.2.2 setSpecies(NAME); } };
Mohamed-amin/angular-boilerplate
node_modules/core-js/modules/_collection-strong.js
JavaScript
mit
4,871
/* Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojo._base.json"]){ dojo._hasResource["dojo._base.json"]=true; dojo.provide("dojo._base.json"); dojo.fromJson=function(_1){ return eval("("+_1+")"); }; dojo._escapeString=function(_2){ return ("\""+_2.replace(/(["\\])/g,"\\$1")+"\"").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r"); }; dojo.toJsonIndentStr="\t"; dojo.toJson=function(it,_3,_4){ if(it===undefined){ return "undefined"; } var _5=typeof it; if(_5=="number"||_5=="boolean"){ return it+""; } if(it===null){ return "null"; } if(dojo.isString(it)){ return dojo._escapeString(it); } var _6=arguments.callee; var _7; _4=_4||""; var _8=_3?_4+dojo.toJsonIndentStr:""; var tf=it.__json__||it.json; if(dojo.isFunction(tf)){ _7=tf.call(it); if(it!==_7){ return _6(_7,_3,_8); } } if(it.nodeType&&it.cloneNode){ throw new Error("Can't serialize DOM nodes"); } var _9=_3?" ":""; var _a=_3?"\n":""; if(dojo.isArray(it)){ var _b=dojo.map(it,function(_c){ var _d=_6(_c,_3,_8); if(typeof _d!="string"){ _d="undefined"; } return _a+_8+_d; }); return "["+_b.join(","+_9)+_a+_4+"]"; } if(_5=="function"){ return null; } var _e=[],_f; for(_f in it){ var _10,val; if(typeof _f=="number"){ _10="\""+_f+"\""; }else{ if(typeof _f=="string"){ _10=dojo._escapeString(_f); }else{ continue; } } val=_6(it[_f],_3,_8); if(typeof val!="string"){ continue; } _e.push(_a+_8+_10+":"+_9+val); } return "{"+_e.join(","+_9)+_a+_4+"}"; }; }
ruiaraujo/cdnjs
ajax/libs/dojo/1.6.3/_base/json.js
JavaScript
mit
1,652
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico"> <meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0"> <title>Responsive example - Custom child row renderer</title> <link rel="stylesheet" type="text/css" href="../../../../media/css/jquery.dataTables.css"> <link rel="stylesheet" type="text/css" href="../../css/dataTables.responsive.css"> <link rel="stylesheet" type="text/css" href="../../../../examples/resources/syntax/shCore.css"> <link rel="stylesheet" type="text/css" href="../../../../examples/resources/demo.css"> <style type="text/css" class="init"> </style> <script type="text/javascript" language="javascript" src="../../../../media/js/jquery.js"></script> <script type="text/javascript" language="javascript" src="../../../../media/js/jquery.dataTables.js"></script> <script type="text/javascript" language="javascript" src="../../js/dataTables.responsive.js"></script> <script type="text/javascript" language="javascript" src="../../../../examples/resources/syntax/shCore.js"></script> <script type="text/javascript" language="javascript" src="../../../../examples/resources/demo.js"></script> <script type="text/javascript" language="javascript" class="init"> $(document).ready(function() { $('#example').DataTable( { responsive: { details: { renderer: function ( api, rowIdx ) { // Select hidden columns for the given row var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) { var header = $( api.column( cell.column ).header() ); return '<tr>'+ '<td>'+ header.text()+':'+ '</td> '+ '<td>'+ api.cell( cell ).data()+ '</td>'+ '</tr>'; } ).toArray().join(''); return data ? $('<table/>').append( data ) : false; } } } } ); } ); </script> </head> <body class="dt-example"> <div class="container"> <section> <h1>Responsive example <span>Custom child row renderer</span></h1> <div class="info"> <p>The child row's for a collapsed table in Responsive, by default, show a <code class="tag" title="HTML tag">ul/li</code> list of the data from the hidden columns. The <a href="//datatables.net/extensions/responsive/reference/option/responsive.details.renderer"><code class="option" title= "Responsive initialisation option">responsive.details.renderer<span>R</span></code></a> option provide the ability to create your own custom renderer. It is given two parameters: the DataTables API instance for the table and the row index to use.</p> <p>This example shows the <a href="//datatables.net/reference/api/cells()"><code class="api" title="DataTables API method">cells()<span>DT</span></code></a> method being used to select the hidden columns and constructing a table of the data. You could refine the selector to select only certain columns, or show all columns, etc.</p> </div> <table id="example" class="display nowrap" cellspacing="0" width="100%"> <thead> <tr> <th>First name</th> <th>Last name</th> <th>Position</th> <th>Office</th> <th>Age</th> <th>Start date</th> <th>Salary</th> <th>Extn.</th> <th>E-mail</th> </tr> </thead> <tbody> <tr> <td>Tiger</td> <td>Nixon</td> <td>System Architect</td> <td>Edinburgh</td> <td>61</td> <td>2011/04/25</td> <td>$320,800</td> <td>5421</td> <td>t.nixon@datatables.net</td> </tr> <tr> <td>Garrett</td> <td>Winters</td> <td>Accountant</td> <td>Tokyo</td> <td>63</td> <td>2011/07/25</td> <td>$170,750</td> <td>8422</td> <td>g.winters@datatables.net</td> </tr> <tr> <td>Ashton</td> <td>Cox</td> <td>Junior Technical Author</td> <td>San Francisco</td> <td>66</td> <td>2009/01/12</td> <td>$86,000</td> <td>1562</td> <td>a.cox@datatables.net</td> </tr> <tr> <td>Cedric</td> <td>Kelly</td> <td>Senior Javascript Developer</td> <td>Edinburgh</td> <td>22</td> <td>2012/03/29</td> <td>$433,060</td> <td>6224</td> <td>c.kelly@datatables.net</td> </tr> <tr> <td>Airi</td> <td>Satou</td> <td>Accountant</td> <td>Tokyo</td> <td>33</td> <td>2008/11/28</td> <td>$162,700</td> <td>5407</td> <td>a.satou@datatables.net</td> </tr> <tr> <td>Brielle</td> <td>Williamson</td> <td>Integration Specialist</td> <td>New York</td> <td>61</td> <td>2012/12/02</td> <td>$372,000</td> <td>4804</td> <td>b.williamson@datatables.net</td> </tr> <tr> <td>Herrod</td> <td>Chandler</td> <td>Sales Assistant</td> <td>San Francisco</td> <td>59</td> <td>2012/08/06</td> <td>$137,500</td> <td>9608</td> <td>h.chandler@datatables.net</td> </tr> <tr> <td>Rhona</td> <td>Davidson</td> <td>Integration Specialist</td> <td>Tokyo</td> <td>55</td> <td>2010/10/14</td> <td>$327,900</td> <td>6200</td> <td>r.davidson@datatables.net</td> </tr> <tr> <td>Colleen</td> <td>Hurst</td> <td>Javascript Developer</td> <td>San Francisco</td> <td>39</td> <td>2009/09/15</td> <td>$205,500</td> <td>2360</td> <td>c.hurst@datatables.net</td> </tr> <tr> <td>Sonya</td> <td>Frost</td> <td>Software Engineer</td> <td>Edinburgh</td> <td>23</td> <td>2008/12/13</td> <td>$103,600</td> <td>1667</td> <td>s.frost@datatables.net</td> </tr> <tr> <td>Jena</td> <td>Gaines</td> <td>Office Manager</td> <td>London</td> <td>30</td> <td>2008/12/19</td> <td>$90,560</td> <td>3814</td> <td>j.gaines@datatables.net</td> </tr> <tr> <td>Quinn</td> <td>Flynn</td> <td>Support Lead</td> <td>Edinburgh</td> <td>22</td> <td>2013/03/03</td> <td>$342,000</td> <td>9497</td> <td>q.flynn@datatables.net</td> </tr> <tr> <td>Charde</td> <td>Marshall</td> <td>Regional Director</td> <td>San Francisco</td> <td>36</td> <td>2008/10/16</td> <td>$470,600</td> <td>6741</td> <td>c.marshall@datatables.net</td> </tr> <tr> <td>Haley</td> <td>Kennedy</td> <td>Senior Marketing Designer</td> <td>London</td> <td>43</td> <td>2012/12/18</td> <td>$313,500</td> <td>3597</td> <td>h.kennedy@datatables.net</td> </tr> <tr> <td>Tatyana</td> <td>Fitzpatrick</td> <td>Regional Director</td> <td>London</td> <td>19</td> <td>2010/03/17</td> <td>$385,750</td> <td>1965</td> <td>t.fitzpatrick@datatables.net</td> </tr> <tr> <td>Michael</td> <td>Silva</td> <td>Marketing Designer</td> <td>London</td> <td>66</td> <td>2012/11/27</td> <td>$198,500</td> <td>1581</td> <td>m.silva@datatables.net</td> </tr> <tr> <td>Paul</td> <td>Byrd</td> <td>Chief Financial Officer (CFO)</td> <td>New York</td> <td>64</td> <td>2010/06/09</td> <td>$725,000</td> <td>3059</td> <td>p.byrd@datatables.net</td> </tr> <tr> <td>Gloria</td> <td>Little</td> <td>Systems Administrator</td> <td>New York</td> <td>59</td> <td>2009/04/10</td> <td>$237,500</td> <td>1721</td> <td>g.little@datatables.net</td> </tr> <tr> <td>Bradley</td> <td>Greer</td> <td>Software Engineer</td> <td>London</td> <td>41</td> <td>2012/10/13</td> <td>$132,000</td> <td>2558</td> <td>b.greer@datatables.net</td> </tr> <tr> <td>Dai</td> <td>Rios</td> <td>Personnel Lead</td> <td>Edinburgh</td> <td>35</td> <td>2012/09/26</td> <td>$217,500</td> <td>2290</td> <td>d.rios@datatables.net</td> </tr> <tr> <td>Jenette</td> <td>Caldwell</td> <td>Development Lead</td> <td>New York</td> <td>30</td> <td>2011/09/03</td> <td>$345,000</td> <td>1937</td> <td>j.caldwell@datatables.net</td> </tr> <tr> <td>Yuri</td> <td>Berry</td> <td>Chief Marketing Officer (CMO)</td> <td>New York</td> <td>40</td> <td>2009/06/25</td> <td>$675,000</td> <td>6154</td> <td>y.berry@datatables.net</td> </tr> <tr> <td>Caesar</td> <td>Vance</td> <td>Pre-Sales Support</td> <td>New York</td> <td>21</td> <td>2011/12/12</td> <td>$106,450</td> <td>8330</td> <td>c.vance@datatables.net</td> </tr> <tr> <td>Doris</td> <td>Wilder</td> <td>Sales Assistant</td> <td>Sidney</td> <td>23</td> <td>2010/09/20</td> <td>$85,600</td> <td>3023</td> <td>d.wilder@datatables.net</td> </tr> <tr> <td>Angelica</td> <td>Ramos</td> <td>Chief Executive Officer (CEO)</td> <td>London</td> <td>47</td> <td>2009/10/09</td> <td>$1,200,000</td> <td>5797</td> <td>a.ramos@datatables.net</td> </tr> <tr> <td>Gavin</td> <td>Joyce</td> <td>Developer</td> <td>Edinburgh</td> <td>42</td> <td>2010/12/22</td> <td>$92,575</td> <td>8822</td> <td>g.joyce@datatables.net</td> </tr> <tr> <td>Jennifer</td> <td>Chang</td> <td>Regional Director</td> <td>Singapore</td> <td>28</td> <td>2010/11/14</td> <td>$357,650</td> <td>9239</td> <td>j.chang@datatables.net</td> </tr> <tr> <td>Brenden</td> <td>Wagner</td> <td>Software Engineer</td> <td>San Francisco</td> <td>28</td> <td>2011/06/07</td> <td>$206,850</td> <td>1314</td> <td>b.wagner@datatables.net</td> </tr> <tr> <td>Fiona</td> <td>Green</td> <td>Chief Operating Officer (COO)</td> <td>San Francisco</td> <td>48</td> <td>2010/03/11</td> <td>$850,000</td> <td>2947</td> <td>f.green@datatables.net</td> </tr> <tr> <td>Shou</td> <td>Itou</td> <td>Regional Marketing</td> <td>Tokyo</td> <td>20</td> <td>2011/08/14</td> <td>$163,000</td> <td>8899</td> <td>s.itou@datatables.net</td> </tr> <tr> <td>Michelle</td> <td>House</td> <td>Integration Specialist</td> <td>Sidney</td> <td>37</td> <td>2011/06/02</td> <td>$95,400</td> <td>2769</td> <td>m.house@datatables.net</td> </tr> <tr> <td>Suki</td> <td>Burks</td> <td>Developer</td> <td>London</td> <td>53</td> <td>2009/10/22</td> <td>$114,500</td> <td>6832</td> <td>s.burks@datatables.net</td> </tr> <tr> <td>Prescott</td> <td>Bartlett</td> <td>Technical Author</td> <td>London</td> <td>27</td> <td>2011/05/07</td> <td>$145,000</td> <td>3606</td> <td>p.bartlett@datatables.net</td> </tr> <tr> <td>Gavin</td> <td>Cortez</td> <td>Team Leader</td> <td>San Francisco</td> <td>22</td> <td>2008/10/26</td> <td>$235,500</td> <td>2860</td> <td>g.cortez@datatables.net</td> </tr> <tr> <td>Martena</td> <td>Mccray</td> <td>Post-Sales support</td> <td>Edinburgh</td> <td>46</td> <td>2011/03/09</td> <td>$324,050</td> <td>8240</td> <td>m.mccray@datatables.net</td> </tr> <tr> <td>Unity</td> <td>Butler</td> <td>Marketing Designer</td> <td>San Francisco</td> <td>47</td> <td>2009/12/09</td> <td>$85,675</td> <td>5384</td> <td>u.butler@datatables.net</td> </tr> <tr> <td>Howard</td> <td>Hatfield</td> <td>Office Manager</td> <td>San Francisco</td> <td>51</td> <td>2008/12/16</td> <td>$164,500</td> <td>7031</td> <td>h.hatfield@datatables.net</td> </tr> <tr> <td>Hope</td> <td>Fuentes</td> <td>Secretary</td> <td>San Francisco</td> <td>41</td> <td>2010/02/12</td> <td>$109,850</td> <td>6318</td> <td>h.fuentes@datatables.net</td> </tr> <tr> <td>Vivian</td> <td>Harrell</td> <td>Financial Controller</td> <td>San Francisco</td> <td>62</td> <td>2009/02/14</td> <td>$452,500</td> <td>9422</td> <td>v.harrell@datatables.net</td> </tr> <tr> <td>Timothy</td> <td>Mooney</td> <td>Office Manager</td> <td>London</td> <td>37</td> <td>2008/12/11</td> <td>$136,200</td> <td>7580</td> <td>t.mooney@datatables.net</td> </tr> <tr> <td>Jackson</td> <td>Bradshaw</td> <td>Director</td> <td>New York</td> <td>65</td> <td>2008/09/26</td> <td>$645,750</td> <td>1042</td> <td>j.bradshaw@datatables.net</td> </tr> <tr> <td>Olivia</td> <td>Liang</td> <td>Support Engineer</td> <td>Singapore</td> <td>64</td> <td>2011/02/03</td> <td>$234,500</td> <td>2120</td> <td>o.liang@datatables.net</td> </tr> <tr> <td>Bruno</td> <td>Nash</td> <td>Software Engineer</td> <td>London</td> <td>38</td> <td>2011/05/03</td> <td>$163,500</td> <td>6222</td> <td>b.nash@datatables.net</td> </tr> <tr> <td>Sakura</td> <td>Yamamoto</td> <td>Support Engineer</td> <td>Tokyo</td> <td>37</td> <td>2009/08/19</td> <td>$139,575</td> <td>9383</td> <td>s.yamamoto@datatables.net</td> </tr> <tr> <td>Thor</td> <td>Walton</td> <td>Developer</td> <td>New York</td> <td>61</td> <td>2013/08/11</td> <td>$98,540</td> <td>8327</td> <td>t.walton@datatables.net</td> </tr> <tr> <td>Finn</td> <td>Camacho</td> <td>Support Engineer</td> <td>San Francisco</td> <td>47</td> <td>2009/07/07</td> <td>$87,500</td> <td>2927</td> <td>f.camacho@datatables.net</td> </tr> <tr> <td>Serge</td> <td>Baldwin</td> <td>Data Coordinator</td> <td>Singapore</td> <td>64</td> <td>2012/04/09</td> <td>$138,575</td> <td>8352</td> <td>s.baldwin@datatables.net</td> </tr> <tr> <td>Zenaida</td> <td>Frank</td> <td>Software Engineer</td> <td>New York</td> <td>63</td> <td>2010/01/04</td> <td>$125,250</td> <td>7439</td> <td>z.frank@datatables.net</td> </tr> <tr> <td>Zorita</td> <td>Serrano</td> <td>Software Engineer</td> <td>San Francisco</td> <td>56</td> <td>2012/06/01</td> <td>$115,000</td> <td>4389</td> <td>z.serrano@datatables.net</td> </tr> <tr> <td>Jennifer</td> <td>Acosta</td> <td>Junior Javascript Developer</td> <td>Edinburgh</td> <td>43</td> <td>2013/02/01</td> <td>$75,650</td> <td>3431</td> <td>j.acosta@datatables.net</td> </tr> <tr> <td>Cara</td> <td>Stevens</td> <td>Sales Assistant</td> <td>New York</td> <td>46</td> <td>2011/12/06</td> <td>$145,600</td> <td>3990</td> <td>c.stevens@datatables.net</td> </tr> <tr> <td>Hermione</td> <td>Butler</td> <td>Regional Director</td> <td>London</td> <td>47</td> <td>2011/03/21</td> <td>$356,250</td> <td>1016</td> <td>h.butler@datatables.net</td> </tr> <tr> <td>Lael</td> <td>Greer</td> <td>Systems Administrator</td> <td>London</td> <td>21</td> <td>2009/02/27</td> <td>$103,500</td> <td>6733</td> <td>l.greer@datatables.net</td> </tr> <tr> <td>Jonas</td> <td>Alexander</td> <td>Developer</td> <td>San Francisco</td> <td>30</td> <td>2010/07/14</td> <td>$86,500</td> <td>8196</td> <td>j.alexander@datatables.net</td> </tr> <tr> <td>Shad</td> <td>Decker</td> <td>Regional Director</td> <td>Edinburgh</td> <td>51</td> <td>2008/11/13</td> <td>$183,000</td> <td>6373</td> <td>s.decker@datatables.net</td> </tr> <tr> <td>Michael</td> <td>Bruce</td> <td>Javascript Developer</td> <td>Singapore</td> <td>29</td> <td>2011/06/27</td> <td>$183,000</td> <td>5384</td> <td>m.bruce@datatables.net</td> </tr> <tr> <td>Donna</td> <td>Snider</td> <td>Customer Support</td> <td>New York</td> <td>27</td> <td>2011/01/25</td> <td>$112,000</td> <td>4226</td> <td>d.snider@datatables.net</td> </tr> </tbody> </table> <ul class="tabs"> <li class="active">Javascript</li> <li>HTML</li> <li>CSS</li> <li>Ajax</li> <li>Server-side script</li> </ul> <div class="tabs"> <div class="js"> <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() { $('#example').DataTable( { responsive: { details: { renderer: function ( api, rowIdx ) { // Select hidden columns for the given row var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) { var header = $( api.column( cell.column ).header() ); return '&lt;tr&gt;'+ '&lt;td&gt;'+ header.text()+':'+ '&lt;/td&gt; '+ '&lt;td&gt;'+ api.cell( cell ).data()+ '&lt;/td&gt;'+ '&lt;/tr&gt;'; } ).toArray().join(''); return data ? $('&lt;table/&gt;').append( data ) : false; } } } } ); } );</code> <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p> <ul> <li><a href="../../../../media/js/jquery.js">../../../../media/js/jquery.js</a></li> <li><a href="../../../../media/js/jquery.dataTables.js">../../../../media/js/jquery.dataTables.js</a></li> <li><a href="../../js/dataTables.responsive.js">../../js/dataTables.responsive.js</a></li> </ul> </div> <div class="table"> <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p> </div> <div class="css"> <div> <p>This example uses a little bit of additional CSS beyond what is loaded from the library files (below), in order to correctly display the table. The additional CSS used is shown below:</p><code class="multiline language-css"></code> </div> <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p> <ul> <li><a href="../../../../media/css/jquery.dataTables.css">../../../../media/css/jquery.dataTables.css</a></li> <li><a href="../../css/dataTables.responsive.css">../../css/dataTables.responsive.css</a></li> </ul> </div> <div class="ajax"> <p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data will update automatically as any additional data is loaded.</p> </div> <div class="php"> <p>The script used to perform the server-side processing for this table is shown below. Please note that this is just an example script using PHP. Server-side processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables documentation</a>.</p> </div> </div> </section> </div> <section> <div class="footer"> <div class="gradient"></div> <div class="liner"> <h2>Other examples</h2> <div class="toc"> <div class="toc-group"> <h3><a href="../initialisation/index.html">Basic initialisation</a></h3> <ul class="toc"> <li><a href="../initialisation/className.html">Class name</a></li> <li><a href="../initialisation/option.html">Configuration option</a></li> <li><a href="../initialisation/new.html">`new` constructor</a></li> <li><a href="../initialisation/ajax.html">Ajax data</a></li> <li><a href="../initialisation/default.html">Default initialisation</a></li> </ul> </div> <div class="toc-group"> <h3><a href="../styling/index.html">Styling</a></h3> <ul class="toc"> <li><a href="../styling/bootstrap.html">Bootstrap styling</a></li> <li><a href="../styling/foundation.html">Foundation styling</a></li> <li><a href="../styling/scrolling.html">Vertical scrolling</a></li> <li><a href="../styling/compact.html">Compact styling</a></li> </ul> </div> <div class="toc-group"> <h3><a href="../display-control/index.html">Display control</a></h3> <ul class="toc"> <li><a href="../display-control/auto.html">Automatic column hiding</a></li> <li><a href="../display-control/classes.html">Class control</a></li> <li><a href="../display-control/init-classes.html">Assigned class control</a></li> <li><a href="../display-control/fixedHeader.html">With FixedHeader</a></li> <li><a href="../display-control/complexHeader.html">Complex headers (rowspan / colspan)</a></li> </ul> </div> <div class="toc-group"> <h3><a href="./index.html">Child rows</a></h3> <ul class="toc active"> <li><a href="./disable-child-rows.html">Disable child rows</a></li> <li><a href="./column-control.html">Column controlled child rows</a></li> <li><a href="./right-column.html">Column control - right</a></li> <li><a href="./whole-row-control.html">Whole row child row control</a></li> <li class="active"><a href="./custom-renderer.html">Custom child row renderer</a></li> </ul> </div> </div> <div class="epilogue"> <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br> Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and <a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of DataTables.</p> <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2015<br> DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p> </div> </div> </div> </section> </body> </html>
djsoba/djsoba.github.io
plugins/datatables/extensions/Responsive/examples/child-rows/custom-renderer.html
HTML
mit
23,410
angular.module("ngLocale",[],["$provide",function(a){var b={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};a.value("$locale",{NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,macFrac:0,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3,maxFrac:3},{minInt:1,minFrac:2,macFrac:0,posPre:"\u00A4 ",posSuf:"",negPre:"\u00A4 -",negSuf:"",gSize:3,lgSize:3,maxFrac:2}],CURRENCY_SYM:"P"},pluralCat:function(c){if(c==0||c==1){return b.ONE}return b.OTHER},DATETIME_FORMATS:{MONTH:["Enero","Pebrero","Marso","Abril","Mayo","Hunyo","Hulyo","Agosto","Setyembre","Oktubre","Nobyembre","Disyembre"],SHORTMONTH:["Ene","Peb","Mar","Abr","May","Hun","Hul","Ago","Set","Okt","Nob","Dis"],DAY:["Linggo","Lunes","Martes","Miyerkules","Huwebes","Biyernes","Sabado"],SHORTDAY:["Lin","Lun","Mar","Mye","Huw","Bye","Sab"],AMPMS:["AM","PM"],medium:"MMM d, y HH:mm:ss","short":"M/d/yy HH:mm",fullDate:"EEEE, MMMM dd y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"HH:mm:ss",shortTime:"HH:mm"},id:"tl-ph"})}]);
liubo404/cdnjs
ajax/libs/angular-i18n/1.1.1/angular-locale_tl-ph.min.js
JavaScript
mit
1,068
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. ;(function (undefined) { var objectTypes = { 'boolean': false, 'function': true, 'object': true, 'number': false, 'string': false, 'undefined': false }; var root = (objectTypes[typeof window] && window) || this, freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, freeModule = objectTypes[typeof module] && module && !module.nodeType && module, moduleExports = freeModule && freeModule.exports === freeExports && freeExports, freeGlobal = objectTypes[typeof global] && global; if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { root = freeGlobal; } var Rx = { internals: {}, config: { Promise: root.Promise // Detect if promise exists }, helpers: { } }; // Defaults var noop = Rx.helpers.noop = function () { }, notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; }, isScheduler = Rx.helpers.isScheduler = function (x) { return x instanceof Rx.Scheduler; }, identity = Rx.helpers.identity = function (x) { return x; }, pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; }, just = Rx.helpers.just = function (value) { return function () { return value; }; }, defaultNow = Rx.helpers.defaultNow = Date.now, defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); }, defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); }, defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); }, defaultError = Rx.helpers.defaultError = function (err) { throw err; }, isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; }, asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); }, not = Rx.helpers.not = function (a) { return !a; }; // Errors var sequenceContainsNoElements = 'Sequence contains no elements.'; var argumentOutOfRange = 'Argument out of range'; var objectDisposed = 'Object has been disposed'; function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } } // Shim in iterator support var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) || '_es6shim_iterator_'; // Bug for mozilla version if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { $iterator$ = '@@iterator'; } var doneEnumerator = { done: true, value: undefined }; /** `Object#toString` result shortcuts */ var argsClass = '[object Arguments]', arrayClass = '[object Array]', boolClass = '[object Boolean]', dateClass = '[object Date]', errorClass = '[object Error]', funcClass = '[object Function]', numberClass = '[object Number]', objectClass = '[object Object]', regexpClass = '[object RegExp]', stringClass = '[object String]'; var toString = Object.prototype.toString, hasOwnProperty = Object.prototype.hasOwnProperty, supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4 suportNodeClass, errorProto = Error.prototype, objectProto = Object.prototype, propertyIsEnumerable = objectProto.propertyIsEnumerable; try { suportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + '')); } catch(e) { suportNodeClass = true; } var shadowedProps = [ 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf' ]; var nonEnumProps = {}; nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true }; nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true }; nonEnumProps[objectClass] = { 'constructor': true }; var support = {}; (function () { var ctor = function() { this.x = 1; }, props = []; ctor.prototype = { 'valueOf': 1, 'y': 1 }; for (var key in new ctor) { props.push(key); } for (key in arguments) { } // Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); // Detect if `prototype` properties are enumerable by default. support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); // Detect if `arguments` object indexes are non-enumerable support.nonEnumArgs = key != 0; // Detect if properties shadowing those on `Object.prototype` are non-enumerable. support.nonEnumShadows = !/valueOf/.test(props); }(1)); function isObject(value) { // check if the value is the ECMAScript language type of Object // http://es5.github.io/#x8 // and avoid a V8 bug // https://code.google.com/p/v8/issues/detail?id=2291 var type = typeof value; return value && (type == 'function' || type == 'object') || false; } function keysIn(object) { var result = []; if (!isObject(object)) { return result; } if (support.nonEnumArgs && object.length && isArguments(object)) { object = slice.call(object); } var skipProto = support.enumPrototypes && typeof object == 'function', skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error); for (var key in object) { if (!(skipProto && key == 'prototype') && !(skipErrorProps && (key == 'message' || key == 'name'))) { result.push(key); } } if (support.nonEnumShadows && object !== objectProto) { var ctor = object.constructor, index = -1, length = shadowedProps.length; if (object === (ctor && ctor.prototype)) { var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object), nonEnum = nonEnumProps[className]; } while (++index < length) { key = shadowedProps[index]; if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) { result.push(key); } } } return result; } function internalFor(object, callback, keysFunc) { var index = -1, props = keysFunc(object), length = props.length; while (++index < length) { var key = props[index]; if (callback(object[key], key, object) === false) { break; } } return object; } function internalForIn(object, callback) { return internalFor(object, callback, keysIn); } function isNode(value) { // IE < 9 presents DOM nodes as `Object` objects except they have `toString` // methods that are `typeof` "string" and still can coerce nodes to strings return typeof value.toString != 'function' && typeof (value + '') == 'string'; } function isArguments(value) { return (value && typeof value == 'object') ? toString.call(value) == argsClass : false; } // fallback for browsers that can't detect `arguments` objects by [[Class]] if (!supportsArgsClass) { isArguments = function(value) { return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false; }; } function isFunction(value) { return typeof value == 'function' || false; } // fallback for older versions of Chrome and Safari if (isFunction(/x/)) { isFunction = function(value) { return typeof value == 'function' && toString.call(value) == funcClass; }; } var isEqual = Rx.internals.isEqual = function (x, y) { return deepEquals(x, y, [], []); }; /** @private * Used for deep comparison **/ function deepEquals(a, b, stackA, stackB) { // exit early for identical values if (a === b) { // treat `+0` vs. `-0` as not equal return a !== 0 || (1 / a == 1 / b); } var type = typeof a, otherType = typeof b; // exit early for unlike primitive values if (a === a && (a == null || b == null || (type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) { return false; } // compare [[Class]] names var className = toString.call(a), otherClass = toString.call(b); if (className == argsClass) { className = objectClass; } if (otherClass == argsClass) { otherClass = objectClass; } if (className != otherClass) { return false; } switch (className) { case boolClass: case dateClass: // coerce dates and booleans to numbers, dates to milliseconds and booleans // to `1` or `0` treating invalid dates coerced to `NaN` as not equal return +a == +b; case numberClass: // treat `NaN` vs. `NaN` as equal return (a != +a) ? b != +b // but treat `-0` vs. `+0` as not equal : (a == 0 ? (1 / a == 1 / b) : a == +b); case regexpClass: case stringClass: // coerce regexes to strings (http://es5.github.io/#x15.10.6.4) // treat string primitives and their corresponding object instances as equal return a == String(b); } var isArr = className == arrayClass; if (!isArr) { // exit for functions and DOM nodes if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) { return false; } // in older versions of Opera, `arguments` objects have `Array` constructors var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor, ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor; // non `Object` object instances with different constructors are not equal if (ctorA != ctorB && !(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) && !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) && ('constructor' in a && 'constructor' in b) ) { return false; } } // assume cyclic structures are equal // the algorithm for detecting cyclic structures is adapted from ES 5.1 // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3) var initedStack = !stackA; stackA || (stackA = []); stackB || (stackB = []); var length = stackA.length; while (length--) { if (stackA[length] == a) { return stackB[length] == b; } } var size = 0; result = true; // add `a` and `b` to the stack of traversed objects stackA.push(a); stackB.push(b); // recursively compare objects and arrays (susceptible to call stack limits) if (isArr) { // compare lengths to determine if a deep comparison is necessary length = a.length; size = b.length; result = size == length; if (result) { // deep compare the contents, ignoring non-numeric properties while (size--) { var index = length, value = b[size]; if (!(result = deepEquals(a[size], value, stackA, stackB))) { break; } } } } else { // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` // which, in this case, is more costly internalForIn(b, function(value, key, b) { if (hasOwnProperty.call(b, key)) { // count the number of properties. size++; // deep compare each property value. return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB)); } }); if (result) { // ensure both objects have the same number of properties internalForIn(a, function(value, key, a) { if (hasOwnProperty.call(a, key)) { // `size` will be `-1` if `a` has more properties than `b` return (result = --size > -1); } }); } } stackA.pop(); stackB.pop(); return result; } var slice = Array.prototype.slice; function argsOrArray(args, idx) { return args.length === 1 && Array.isArray(args[idx]) ? args[idx] : slice.call(args); } var hasProp = {}.hasOwnProperty; /** @private */ var inherits = this.inherits = Rx.internals.inherits = function (child, parent) { function __() { this.constructor = child; } __.prototype = parent.prototype; child.prototype = new __(); }; /** @private */ var addProperties = Rx.internals.addProperties = function (obj) { var sources = slice.call(arguments, 1); for (var i = 0, len = sources.length; i < len; i++) { var source = sources[i]; for (var prop in source) { obj[prop] = source[prop]; } } }; // Rx Utils var addRef = Rx.internals.addRef = function (xs, r) { return new AnonymousObservable(function (observer) { return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer)); }); }; // Collection polyfills function arrayInitialize(count, factory) { var a = new Array(count); for (var i = 0; i < count; i++) { a[i] = factory(); } return a; } // Collections var IndexedItem = function (id, value) { this.id = id; this.value = value; }; IndexedItem.prototype.compareTo = function (other) { var c = this.value.compareTo(other.value); if (c === 0) { c = this.id - other.id; } return c; }; // Priority Queue for Scheduling var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) { this.items = new Array(capacity); this.length = 0; }; var priorityProto = PriorityQueue.prototype; priorityProto.isHigherPriority = function (left, right) { return this.items[left].compareTo(this.items[right]) < 0; }; priorityProto.percolate = function (index) { if (index >= this.length || index < 0) { return; } var parent = index - 1 >> 1; if (parent < 0 || parent === index) { return; } if (this.isHigherPriority(index, parent)) { var temp = this.items[index]; this.items[index] = this.items[parent]; this.items[parent] = temp; this.percolate(parent); } }; priorityProto.heapify = function (index) { if (index === undefined) { index = 0; } if (index >= this.length || index < 0) { return; } var left = 2 * index + 1, right = 2 * index + 2, first = index; if (left < this.length && this.isHigherPriority(left, first)) { first = left; } if (right < this.length && this.isHigherPriority(right, first)) { first = right; } if (first !== index) { var temp = this.items[index]; this.items[index] = this.items[first]; this.items[first] = temp; this.heapify(first); } }; priorityProto.peek = function () { return this.items[0].value; }; priorityProto.removeAt = function (index) { this.items[index] = this.items[--this.length]; delete this.items[this.length]; this.heapify(); }; priorityProto.dequeue = function () { var result = this.peek(); this.removeAt(0); return result; }; priorityProto.enqueue = function (item) { var index = this.length++; this.items[index] = new IndexedItem(PriorityQueue.count++, item); this.percolate(index); }; priorityProto.remove = function (item) { for (var i = 0; i < this.length; i++) { if (this.items[i].value === item) { this.removeAt(i); return true; } } return false; }; PriorityQueue.count = 0; /** * Represents a group of disposable resources that are disposed together. * @constructor */ var CompositeDisposable = Rx.CompositeDisposable = function () { this.disposables = argsOrArray(arguments, 0); this.isDisposed = false; this.length = this.disposables.length; }; var CompositeDisposablePrototype = CompositeDisposable.prototype; /** * Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed. * @param {Mixed} item Disposable to add. */ CompositeDisposablePrototype.add = function (item) { if (this.isDisposed) { item.dispose(); } else { this.disposables.push(item); this.length++; } }; /** * Removes and disposes the first occurrence of a disposable from the CompositeDisposable. * @param {Mixed} item Disposable to remove. * @returns {Boolean} true if found; false otherwise. */ CompositeDisposablePrototype.remove = function (item) { var shouldDispose = false; if (!this.isDisposed) { var idx = this.disposables.indexOf(item); if (idx !== -1) { shouldDispose = true; this.disposables.splice(idx, 1); this.length--; item.dispose(); } } return shouldDispose; }; /** * Disposes all disposables in the group and removes them from the group. */ CompositeDisposablePrototype.dispose = function () { if (!this.isDisposed) { this.isDisposed = true; var currentDisposables = this.disposables.slice(0); this.disposables = []; this.length = 0; for (var i = 0, len = currentDisposables.length; i < len; i++) { currentDisposables[i].dispose(); } } }; /** * Removes and disposes all disposables from the CompositeDisposable, but does not dispose the CompositeDisposable. */ CompositeDisposablePrototype.clear = function () { var currentDisposables = this.disposables.slice(0); this.disposables = []; this.length = 0; for (var i = 0, len = currentDisposables.length; i < len; i++) { currentDisposables[i].dispose(); } }; /** * Determines whether the CompositeDisposable contains a specific disposable. * @param {Mixed} item Disposable to search for. * @returns {Boolean} true if the disposable was found; otherwise, false. */ CompositeDisposablePrototype.contains = function (item) { return this.disposables.indexOf(item) !== -1; }; /** * Converts the existing CompositeDisposable to an array of disposables * @returns {Array} An array of disposable objects. */ CompositeDisposablePrototype.toArray = function () { return this.disposables.slice(0); }; /** * Provides a set of static methods for creating Disposables. * * @constructor * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. */ var Disposable = Rx.Disposable = function (action) { this.isDisposed = false; this.action = action || noop; }; /** Performs the task of cleaning up resources. */ Disposable.prototype.dispose = function () { if (!this.isDisposed) { this.action(); this.isDisposed = true; } }; /** * Creates a disposable object that invokes the specified action when disposed. * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. * @return {Disposable} The disposable object that runs the given action upon disposal. */ var disposableCreate = Disposable.create = function (action) { return new Disposable(action); }; /** * Gets the disposable that does nothing when disposed. */ var disposableEmpty = Disposable.empty = { dispose: noop }; var BooleanDisposable = (function () { function BooleanDisposable (isSingle) { this.isSingle = isSingle; this.isDisposed = false; this.current = null; } var booleanDisposablePrototype = BooleanDisposable.prototype; /** * Gets the underlying disposable. * @return The underlying disposable. */ booleanDisposablePrototype.getDisposable = function () { return this.current; }; /** * Sets the underlying disposable. * @param {Disposable} value The new underlying disposable. */ booleanDisposablePrototype.setDisposable = function (value) { if (this.current && this.isSingle) { throw new Error('Disposable has already been assigned'); } var shouldDispose = this.isDisposed, old; if (!shouldDispose) { old = this.current; this.current = value; } if (old) { old.dispose(); } if (shouldDispose && value) { value.dispose(); } }; /** * Disposes the underlying disposable as well as all future replacements. */ booleanDisposablePrototype.dispose = function () { var old; if (!this.isDisposed) { this.isDisposed = true; old = this.current; this.current = null; } if (old) { old.dispose(); } }; return BooleanDisposable; }()); /** * Represents a disposable resource which only allows a single assignment of its underlying disposable resource. * If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an Error. */ var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function (super_) { inherits(SingleAssignmentDisposable, super_); function SingleAssignmentDisposable() { super_.call(this, true); } return SingleAssignmentDisposable; }(BooleanDisposable)); /** * Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource. */ var SerialDisposable = Rx.SerialDisposable = (function (super_) { inherits(SerialDisposable, super_); function SerialDisposable() { super_.call(this, false); } return SerialDisposable; }(BooleanDisposable)); /** * Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed. */ var RefCountDisposable = Rx.RefCountDisposable = (function () { function InnerDisposable(disposable) { this.disposable = disposable; this.disposable.count++; this.isInnerDisposed = false; } InnerDisposable.prototype.dispose = function () { if (!this.disposable.isDisposed) { if (!this.isInnerDisposed) { this.isInnerDisposed = true; this.disposable.count--; if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) { this.disposable.isDisposed = true; this.disposable.underlyingDisposable.dispose(); } } } }; /** * Initializes a new instance of the RefCountDisposable with the specified disposable. * @constructor * @param {Disposable} disposable Underlying disposable. */ function RefCountDisposable(disposable) { this.underlyingDisposable = disposable; this.isDisposed = false; this.isPrimaryDisposed = false; this.count = 0; } /** * Disposes the underlying disposable only when all dependent disposables have been disposed */ RefCountDisposable.prototype.dispose = function () { if (!this.isDisposed) { if (!this.isPrimaryDisposed) { this.isPrimaryDisposed = true; if (this.count === 0) { this.isDisposed = true; this.underlyingDisposable.dispose(); } } } }; /** * Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable. * @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime. */ RefCountDisposable.prototype.getDisposable = function () { return this.isDisposed ? disposableEmpty : new InnerDisposable(this); }; return RefCountDisposable; })(); function ScheduledDisposable(scheduler, disposable) { this.scheduler = scheduler; this.disposable = disposable; this.isDisposed = false; } ScheduledDisposable.prototype.dispose = function () { var parent = this; this.scheduler.schedule(function () { if (!parent.isDisposed) { parent.isDisposed = true; parent.disposable.dispose(); } }); }; var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) { this.scheduler = scheduler; this.state = state; this.action = action; this.dueTime = dueTime; this.comparer = comparer || defaultSubComparer; this.disposable = new SingleAssignmentDisposable(); } ScheduledItem.prototype.invoke = function () { this.disposable.setDisposable(this.invokeCore()); }; ScheduledItem.prototype.compareTo = function (other) { return this.comparer(this.dueTime, other.dueTime); }; ScheduledItem.prototype.isCancelled = function () { return this.disposable.isDisposed; }; ScheduledItem.prototype.invokeCore = function () { return this.action(this.scheduler, this.state); }; /** Provides a set of static properties to access commonly used schedulers. */ var Scheduler = Rx.Scheduler = (function () { /** * @constructor * @private */ function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) { this.now = now; this._schedule = schedule; this._scheduleRelative = scheduleRelative; this._scheduleAbsolute = scheduleAbsolute; } function invokeRecImmediate(scheduler, pair) { var state = pair.first, action = pair.second, group = new CompositeDisposable(), recursiveAction = function (state1) { action(state1, function (state2) { var isAdded = false, isDone = false, d = scheduler.scheduleWithState(state2, function (scheduler1, state3) { if (isAdded) { group.remove(d); } else { isDone = true; } recursiveAction(state3); return disposableEmpty; }); if (!isDone) { group.add(d); isAdded = true; } }); }; recursiveAction(state); return group; } function invokeRecDate(scheduler, pair, method) { var state = pair.first, action = pair.second, group = new CompositeDisposable(), recursiveAction = function (state1) { action(state1, function (state2, dueTime1) { var isAdded = false, isDone = false, d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) { if (isAdded) { group.remove(d); } else { isDone = true; } recursiveAction(state3); return disposableEmpty; }); if (!isDone) { group.add(d); isAdded = true; } }); }; recursiveAction(state); return group; } function invokeAction(scheduler, action) { action(); return disposableEmpty; } var schedulerProto = Scheduler.prototype; /** * Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions. * @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false. * @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling. */ schedulerProto.catchException = schedulerProto['catch'] = function (handler) { return new CatchScheduler(this, handler); }; /** * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation. * @param {Number} period Period for running the work periodically. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort). */ schedulerProto.schedulePeriodic = function (period, action) { return this.schedulePeriodicWithState(null, period, function () { action(); }); }; /** * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation. * @param {Mixed} state Initial state passed to the action upon the first iteration. * @param {Number} period Period for running the work periodically. * @param {Function} action Action to be executed, potentially updating the state. * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort). */ schedulerProto.schedulePeriodicWithState = function (state, period, action) { var s = state, id = setInterval(function () { s = action(s); }, period); return disposableCreate(function () { clearInterval(id); }); }; /** * Schedules an action to be executed. * @param {Function} action Action to execute. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.schedule = function (action) { return this._schedule(action, invokeAction); }; /** * Schedules an action to be executed. * @param state State passed to the action to be executed. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithState = function (state, action) { return this._schedule(state, action); }; /** * Schedules an action to be executed after the specified relative due time. * @param {Function} action Action to execute. * @param {Number} dueTime Relative time after which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithRelative = function (dueTime, action) { return this._scheduleRelative(action, dueTime, invokeAction); }; /** * Schedules an action to be executed after dueTime. * @param state State passed to the action to be executed. * @param {Function} action Action to be executed. * @param {Number} dueTime Relative time after which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) { return this._scheduleRelative(state, dueTime, action); }; /** * Schedules an action to be executed at the specified absolute due time. * @param {Function} action Action to execute. * @param {Number} dueTime Absolute time at which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithAbsolute = function (dueTime, action) { return this._scheduleAbsolute(action, dueTime, invokeAction); }; /** * Schedules an action to be executed at dueTime. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to be executed. * @param {Number}dueTime Absolute time at which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) { return this._scheduleAbsolute(state, dueTime, action); }; /** * Schedules an action to be executed recursively. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursive = function (action) { return this.scheduleRecursiveWithState(action, function (_action, self) { _action(function () { self(_action); }); }); }; /** * Schedules an action to be executed recursively. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithState = function (state, action) { return this.scheduleWithState({ first: state, second: action }, function (s, p) { return invokeRecImmediate(s, p); }); }; /** * Schedules an action to be executed recursively after a specified relative due time. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time. * @param {Number}dueTime Relative time after which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) { return this.scheduleRecursiveWithRelativeAndState(action, dueTime, function (_action, self) { _action(function (dt) { self(_action, dt); }); }); }; /** * Schedules an action to be executed recursively after a specified relative due time. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state. * @param {Number}dueTime Relative time after which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) { return this._scheduleRelative({ first: state, second: action }, dueTime, function (s, p) { return invokeRecDate(s, p, 'scheduleWithRelativeAndState'); }); }; /** * Schedules an action to be executed recursively at a specified absolute due time. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time. * @param {Number}dueTime Absolute time at which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) { return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, function (_action, self) { _action(function (dt) { self(_action, dt); }); }); }; /** * Schedules an action to be executed recursively at a specified absolute due time. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state. * @param {Number}dueTime Absolute time at which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) { return this._scheduleAbsolute({ first: state, second: action }, dueTime, function (s, p) { return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState'); }); }; /** Gets the current time according to the local machine's system clock. */ Scheduler.now = defaultNow; /** * Normalizes the specified TimeSpan value to a positive value. * @param {Number} timeSpan The time span value to normalize. * @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0 */ Scheduler.normalize = function (timeSpan) { if (timeSpan < 0) { timeSpan = 0; } return timeSpan; }; return Scheduler; }()); var normalizeTime = Scheduler.normalize; var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () { function tick(command, recurse) { recurse(0, this._period); try { this._state = this._action(this._state); } catch (e) { this._cancel.dispose(); throw e; } } function SchedulePeriodicRecursive(scheduler, state, period, action) { this._scheduler = scheduler; this._state = state; this._period = period; this._action = action; } SchedulePeriodicRecursive.prototype.start = function () { var d = new SingleAssignmentDisposable(); this._cancel = d; d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this))); return d; }; return SchedulePeriodicRecursive; }()); /** * Gets a scheduler that schedules work immediately on the current thread. */ var immediateScheduler = Scheduler.immediate = (function () { function scheduleNow(state, action) { return action(this, state); } function scheduleRelative(state, dueTime, action) { var dt = normalizeTime(dt); while (dt - this.now() > 0) { } return action(this, state); } function scheduleAbsolute(state, dueTime, action) { return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action); } return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute); }()); /** * Gets a scheduler that schedules work as soon as possible on the current thread. */ var currentThreadScheduler = Scheduler.currentThread = (function () { var queue; function runTrampoline (q) { var item; while (q.length > 0) { item = q.dequeue(); if (!item.isCancelled()) { // Note, do not schedule blocking work! while (item.dueTime - Scheduler.now() > 0) { } if (!item.isCancelled()) { item.invoke(); } } } } function scheduleNow(state, action) { return this.scheduleWithRelativeAndState(state, 0, action); } function scheduleRelative(state, dueTime, action) { var dt = this.now() + Scheduler.normalize(dueTime), si = new ScheduledItem(this, state, action, dt); if (!queue) { queue = new PriorityQueue(4); queue.enqueue(si); try { runTrampoline(queue); } catch (e) { throw e; } finally { queue = null; } } else { queue.enqueue(si); } return si.disposable; } function scheduleAbsolute(state, dueTime, action) { return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action); } var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute); currentScheduler.scheduleRequired = function () { return !queue; }; currentScheduler.ensureTrampoline = function (action) { if (!queue) { this.schedule(action); } else { action(); } }; return currentScheduler; }()); var scheduleMethod, clearMethod = noop; (function () { var reNative = RegExp('^' + String(toString) .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') .replace(/toString| for [^\]]+/g, '.*?') + '$' ); var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' && !reNative.test(setImmediate) && setImmediate, clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' && !reNative.test(clearImmediate) && clearImmediate; function postMessageSupported () { // Ensure not in a worker if (!root.postMessage || root.importScripts) { return false; } var isAsync = false, oldHandler = root.onmessage; // Test for async root.onmessage = function () { isAsync = true; }; root.postMessage('','*'); root.onmessage = oldHandler; return isAsync; } // Use in order, nextTick, setImmediate, postMessage, MessageChannel, script readystatechanged, setTimeout if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { scheduleMethod = process.nextTick; } else if (typeof setImmediate === 'function') { scheduleMethod = setImmediate; clearMethod = clearImmediate; } else if (postMessageSupported()) { var MSG_PREFIX = 'ms.rx.schedule' + Math.random(), tasks = {}, taskId = 0; function onGlobalPostMessage(event) { // Only if we're a match to avoid any other global events if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) { var handleId = event.data.substring(MSG_PREFIX.length), action = tasks[handleId]; action(); delete tasks[handleId]; } } if (root.addEventListener) { root.addEventListener('message', onGlobalPostMessage, false); } else { root.attachEvent('onmessage', onGlobalPostMessage, false); } scheduleMethod = function (action) { var currentId = taskId++; tasks[currentId] = action; root.postMessage(MSG_PREFIX + currentId, '*'); }; } else if (!!root.MessageChannel) { var channel = new root.MessageChannel(), channelTasks = {}, channelTaskId = 0; channel.port1.onmessage = function (event) { var id = event.data, action = channelTasks[id]; action(); delete channelTasks[id]; }; scheduleMethod = function (action) { var id = channelTaskId++; channelTasks[id] = action; channel.port2.postMessage(id); }; } else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) { scheduleMethod = function (action) { var scriptElement = root.document.createElement('script'); scriptElement.onreadystatechange = function () { action(); scriptElement.onreadystatechange = null; scriptElement.parentNode.removeChild(scriptElement); scriptElement = null; }; root.document.documentElement.appendChild(scriptElement); }; } else { scheduleMethod = function (action) { return setTimeout(action, 0); }; clearMethod = clearTimeout; } }()); /** * Gets a scheduler that schedules work via a timed callback based upon platform. */ var timeoutScheduler = Scheduler.timeout = (function () { function scheduleNow(state, action) { var scheduler = this, disposable = new SingleAssignmentDisposable(); var id = scheduleMethod(function () { if (!disposable.isDisposed) { disposable.setDisposable(action(scheduler, state)); } }); return new CompositeDisposable(disposable, disposableCreate(function () { clearMethod(id); })); } function scheduleRelative(state, dueTime, action) { var scheduler = this, dt = Scheduler.normalize(dueTime); if (dt === 0) { return scheduler.scheduleWithState(state, action); } var disposable = new SingleAssignmentDisposable(); var id = setTimeout(function () { if (!disposable.isDisposed) { disposable.setDisposable(action(scheduler, state)); } }, dt); return new CompositeDisposable(disposable, disposableCreate(function () { clearTimeout(id); })); } function scheduleAbsolute(state, dueTime, action) { return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action); } return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute); })(); /** @private */ var CatchScheduler = (function (_super) { function localNow() { return this._scheduler.now(); } function scheduleNow(state, action) { return this._scheduler.scheduleWithState(state, this._wrap(action)); } function scheduleRelative(state, dueTime, action) { return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action)); } function scheduleAbsolute(state, dueTime, action) { return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action)); } inherits(CatchScheduler, _super); /** @private */ function CatchScheduler(scheduler, handler) { this._scheduler = scheduler; this._handler = handler; this._recursiveOriginal = null; this._recursiveWrapper = null; _super.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute); } /** @private */ CatchScheduler.prototype._clone = function (scheduler) { return new CatchScheduler(scheduler, this._handler); }; /** @private */ CatchScheduler.prototype._wrap = function (action) { var parent = this; return function (self, state) { try { return action(parent._getRecursiveWrapper(self), state); } catch (e) { if (!parent._handler(e)) { throw e; } return disposableEmpty; } }; }; /** @private */ CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) { if (this._recursiveOriginal !== scheduler) { this._recursiveOriginal = scheduler; var wrapper = this._clone(scheduler); wrapper._recursiveOriginal = scheduler; wrapper._recursiveWrapper = wrapper; this._recursiveWrapper = wrapper; } return this._recursiveWrapper; }; /** @private */ CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) { var self = this, failed = false, d = new SingleAssignmentDisposable(); d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) { if (failed) { return null; } try { return action(state1); } catch (e) { failed = true; if (!self._handler(e)) { throw e; } d.dispose(); return null; } })); return d; }; return CatchScheduler; }(Scheduler)); /** * Represents a notification to an observer. */ var Notification = Rx.Notification = (function () { function Notification(kind, hasValue) { this.hasValue = hasValue == null ? false : hasValue; this.kind = kind; } /** * Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result. * * @memberOf Notification * @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on.. * @param {Function} onError Delegate to invoke for an OnError notification. * @param {Function} onCompleted Delegate to invoke for an OnCompleted notification. * @returns {Any} Result produced by the observation. */ Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) { return observerOrOnNext && typeof observerOrOnNext === 'object' ? this._acceptObservable(observerOrOnNext) : this._accept(observerOrOnNext, onError, onCompleted); }; /** * Returns an observable sequence with a single notification. * * @memberOf Notifications * @param {Scheduler} [scheduler] Scheduler to send out the notification calls on. * @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription. */ Notification.prototype.toObservable = function (scheduler) { var notification = this; isScheduler(scheduler) || (scheduler = immediateScheduler); return new AnonymousObservable(function (observer) { return scheduler.schedule(function () { notification._acceptObservable(observer); notification.kind === 'N' && observer.onCompleted(); }); }); }; return Notification; })(); /** * Creates an object that represents an OnNext notification to an observer. * @param {Any} value The value contained in the notification. * @returns {Notification} The OnNext notification containing the value. */ var notificationCreateOnNext = Notification.createOnNext = (function () { function _accept (onNext) { return onNext(this.value); } function _acceptObservable(observer) { return observer.onNext(this.value); } function toString () { return 'OnNext(' + this.value + ')'; } return function (value) { var notification = new Notification('N', true); notification.value = value; notification._accept = _accept; notification._acceptObservable = _acceptObservable; notification.toString = toString; return notification; }; }()); /** * Creates an object that represents an OnError notification to an observer. * @param {Any} error The exception contained in the notification. * @returns {Notification} The OnError notification containing the exception. */ var notificationCreateOnError = Notification.createOnError = (function () { function _accept (onNext, onError) { return onError(this.exception); } function _acceptObservable(observer) { return observer.onError(this.exception); } function toString () { return 'OnError(' + this.exception + ')'; } return function (exception) { var notification = new Notification('E'); notification.exception = exception; notification._accept = _accept; notification._acceptObservable = _acceptObservable; notification.toString = toString; return notification; }; }()); /** * Creates an object that represents an OnCompleted notification to an observer. * @returns {Notification} The OnCompleted notification. */ var notificationCreateOnCompleted = Notification.createOnCompleted = (function () { function _accept (onNext, onError, onCompleted) { return onCompleted(); } function _acceptObservable(observer) { return observer.onCompleted(); } function toString () { return 'OnCompleted()'; } return function () { var notification = new Notification('C'); notification._accept = _accept; notification._acceptObservable = _acceptObservable; notification.toString = toString; return notification; }; }()); var Enumerator = Rx.internals.Enumerator = function (next) { this._next = next; }; Enumerator.prototype.next = function () { return this._next(); }; Enumerator.prototype[$iterator$] = function () { return this; } var Enumerable = Rx.internals.Enumerable = function (iterator) { this._iterator = iterator; }; Enumerable.prototype[$iterator$] = function () { return this._iterator(); }; Enumerable.prototype.concat = function () { var sources = this; return new AnonymousObservable(function (observer) { var e; try { e = sources[$iterator$](); } catch(err) { observer.onError(); return; } var isDisposed, subscription = new SerialDisposable(); var cancelable = immediateScheduler.scheduleRecursive(function (self) { var currentItem; if (isDisposed) { return; } try { currentItem = e.next(); } catch (ex) { observer.onError(ex); return; } if (currentItem.done) { observer.onCompleted(); return; } // Check if promise var currentValue = currentItem.value; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(currentValue.subscribe( observer.onNext.bind(observer), observer.onError.bind(observer), function () { self(); }) ); }); return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }); }; Enumerable.prototype.catchException = function () { var sources = this; return new AnonymousObservable(function (observer) { var e; try { e = sources[$iterator$](); } catch(err) { observer.onError(); return; } var isDisposed, lastException, subscription = new SerialDisposable(); var cancelable = immediateScheduler.scheduleRecursive(function (self) { if (isDisposed) { return; } var currentItem; try { currentItem = e.next(); } catch (ex) { observer.onError(ex); return; } if (currentItem.done) { if (lastException) { observer.onError(lastException); } else { observer.onCompleted(); } return; } // Check if promise var currentValue = currentItem.value; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(currentValue.subscribe( observer.onNext.bind(observer), function (exn) { lastException = exn; self(); }, observer.onCompleted.bind(observer))); }); return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }); }; var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { if (repeatCount == null) { repeatCount = -1; } return new Enumerable(function () { var left = repeatCount; return new Enumerator(function () { if (left === 0) { return doneEnumerator; } if (left > 0) { left--; } return { done: false, value: value }; }); }); }; var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) { selector || (selector = identity); return new Enumerable(function () { var index = -1; return new Enumerator( function () { return ++index < source.length ? { done: false, value: selector.call(thisArg, source[index], index, source) } : doneEnumerator; }); }); }; /** * Supports push-style iteration over an observable sequence. */ var Observer = Rx.Observer = function () { }; /** * Creates a notification callback from an observer. * * @param observer Observer object. * @returns The action that forwards its input notification to the underlying observer. */ Observer.prototype.toNotifier = function () { var observer = this; return function (n) { return n.accept(observer); }; }; /** * Hides the identity of an observer. * @returns An observer that hides the identity of the specified observer. */ Observer.prototype.asObserver = function () { return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this)); }; /** * Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods. * If a violation is detected, an Error is thrown from the offending observer method call. * * @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer. */ Observer.prototype.checked = function () { return new CheckedObserver(this); }; /** * Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions. * * @static * @memberOf Observer * @param {Function} [onNext] Observer's OnNext action implementation. * @param {Function} [onError] Observer's OnError action implementation. * @param {Function} [onCompleted] Observer's OnCompleted action implementation. * @returns {Observer} The observer object implemented using the given actions. */ var observerCreate = Observer.create = function (onNext, onError, onCompleted) { onNext || (onNext = noop); onError || (onError = defaultError); onCompleted || (onCompleted = noop); return new AnonymousObserver(onNext, onError, onCompleted); }; /** * Creates an observer from a notification callback. * * @static * @memberOf Observer * @param {Function} handler Action that handles a notification. * @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives. */ Observer.fromNotifier = function (handler) { return new AnonymousObserver(function (x) { return handler(notificationCreateOnNext(x)); }, function (exception) { return handler(notificationCreateOnError(exception)); }, function () { return handler(notificationCreateOnCompleted()); }); }; /** * Schedules the invocation of observer methods on the given scheduler. * @param {Scheduler} scheduler Scheduler to schedule observer messages on. * @returns {Observer} Observer whose messages are scheduled on the given scheduler. */ Observer.notifyOn = function (scheduler) { return new ObserveOnObserver(scheduler, this); }; /** * Abstract base class for implementations of the Observer class. * This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages. */ var AbstractObserver = Rx.internals.AbstractObserver = (function (_super) { inherits(AbstractObserver, _super); /** * Creates a new observer in a non-stopped state. * * @constructor */ function AbstractObserver() { this.isStopped = false; _super.call(this); } /** * Notifies the observer of a new element in the sequence. * * @memberOf AbstractObserver * @param {Any} value Next element in the sequence. */ AbstractObserver.prototype.onNext = function (value) { if (!this.isStopped) { this.next(value); } }; /** * Notifies the observer that an exception has occurred. * * @memberOf AbstractObserver * @param {Any} error The error that has occurred. */ AbstractObserver.prototype.onError = function (error) { if (!this.isStopped) { this.isStopped = true; this.error(error); } }; /** * Notifies the observer of the end of the sequence. */ AbstractObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.completed(); } }; /** * Disposes the observer, causing it to transition to the stopped state. */ AbstractObserver.prototype.dispose = function () { this.isStopped = true; }; AbstractObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.error(e); return true; } return false; }; return AbstractObserver; }(Observer)); /** * Class to create an Observer instance from delegate-based implementations of the on* methods. */ var AnonymousObserver = Rx.AnonymousObserver = (function (_super) { inherits(AnonymousObserver, _super); /** * Creates an observer from the specified OnNext, OnError, and OnCompleted actions. * @param {Any} onNext Observer's OnNext action implementation. * @param {Any} onError Observer's OnError action implementation. * @param {Any} onCompleted Observer's OnCompleted action implementation. */ function AnonymousObserver(onNext, onError, onCompleted) { _super.call(this); this._onNext = onNext; this._onError = onError; this._onCompleted = onCompleted; } /** * Calls the onNext action. * @param {Any} value Next element in the sequence. */ AnonymousObserver.prototype.next = function (value) { this._onNext(value); }; /** * Calls the onError action. * @param {Any} error The error that has occurred. */ AnonymousObserver.prototype.error = function (exception) { this._onError(exception); }; /** * Calls the onCompleted action. */ AnonymousObserver.prototype.completed = function () { this._onCompleted(); }; return AnonymousObserver; }(AbstractObserver)); var CheckedObserver = (function (_super) { inherits(CheckedObserver, _super); function CheckedObserver(observer) { _super.call(this); this._observer = observer; this._state = 0; // 0 - idle, 1 - busy, 2 - done } var CheckedObserverPrototype = CheckedObserver.prototype; CheckedObserverPrototype.onNext = function (value) { this.checkAccess(); try { this._observer.onNext(value); } catch (e) { throw e; } finally { this._state = 0; } }; CheckedObserverPrototype.onError = function (err) { this.checkAccess(); try { this._observer.onError(err); } catch (e) { throw e; } finally { this._state = 2; } }; CheckedObserverPrototype.onCompleted = function () { this.checkAccess(); try { this._observer.onCompleted(); } catch (e) { throw e; } finally { this._state = 2; } }; CheckedObserverPrototype.checkAccess = function () { if (this._state === 1) { throw new Error('Re-entrancy detected'); } if (this._state === 2) { throw new Error('Observer completed'); } if (this._state === 0) { this._state = 1; } }; return CheckedObserver; }(Observer)); var ScheduledObserver = Rx.internals.ScheduledObserver = (function (_super) { inherits(ScheduledObserver, _super); function ScheduledObserver(scheduler, observer) { _super.call(this); this.scheduler = scheduler; this.observer = observer; this.isAcquired = false; this.hasFaulted = false; this.queue = []; this.disposable = new SerialDisposable(); } ScheduledObserver.prototype.next = function (value) { var self = this; this.queue.push(function () { self.observer.onNext(value); }); }; ScheduledObserver.prototype.error = function (exception) { var self = this; this.queue.push(function () { self.observer.onError(exception); }); }; ScheduledObserver.prototype.completed = function () { var self = this; this.queue.push(function () { self.observer.onCompleted(); }); }; ScheduledObserver.prototype.ensureActive = function () { var isOwner = false, parent = this; if (!this.hasFaulted && this.queue.length > 0) { isOwner = !this.isAcquired; this.isAcquired = true; } if (isOwner) { this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) { var work; if (parent.queue.length > 0) { work = parent.queue.shift(); } else { parent.isAcquired = false; return; } try { work(); } catch (ex) { parent.queue = []; parent.hasFaulted = true; throw ex; } self(); })); } }; ScheduledObserver.prototype.dispose = function () { _super.prototype.dispose.call(this); this.disposable.dispose(); }; return ScheduledObserver; }(AbstractObserver)); /** @private */ var ObserveOnObserver = (function (_super) { inherits(ObserveOnObserver, _super); /** @private */ function ObserveOnObserver() { _super.apply(this, arguments); } /** @private */ ObserveOnObserver.prototype.next = function (value) { _super.prototype.next.call(this, value); this.ensureActive(); }; /** @private */ ObserveOnObserver.prototype.error = function (e) { _super.prototype.error.call(this, e); this.ensureActive(); }; /** @private */ ObserveOnObserver.prototype.completed = function () { _super.prototype.completed.call(this); this.ensureActive(); }; return ObserveOnObserver; })(ScheduledObserver); var observableProto; /** * Represents a push-style collection. */ var Observable = Rx.Observable = (function () { function Observable(subscribe) { this._subscribe = subscribe; } observableProto = Observable.prototype; /** * Subscribes an observer to the observable sequence. * * @example * 1 - source.subscribe(); * 2 - source.subscribe(observer); * 3 - source.subscribe(function (x) { console.log(x); }); * 4 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }); * 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); }); * @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence. * @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. * @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. * @returns {Diposable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler. */ observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) { var subscriber = typeof observerOrOnNext === 'object' ? observerOrOnNext : observerCreate(observerOrOnNext, onError, onCompleted); return this._subscribe(subscriber); }; return Observable; })(); var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) { inherits(AnonymousObservable, __super__); // Fix subscriber to check for undefined or function returned to decorate as Disposable function fixSubscriber(subscriber) { if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; } return typeof subscriber === 'function' ? disposableCreate(subscriber) : disposableEmpty; } function AnonymousObservable(subscribe) { if (!(this instanceof AnonymousObservable)) { return new AnonymousObservable(subscribe); } function s(observer) { var setDisposable = function () { try { autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver))); } catch (e) { if (!autoDetachObserver.fail(e)) { throw e; } } }; var autoDetachObserver = new AutoDetachObserver(observer); if (currentThreadScheduler.scheduleRequired()) { currentThreadScheduler.schedule(setDisposable); } else { setDisposable(); } return autoDetachObserver; } __super__.call(this, s); } return AnonymousObservable; }(Observable)); /** @private */ var AutoDetachObserver = (function (_super) { inherits(AutoDetachObserver, _super); function AutoDetachObserver(observer) { _super.call(this); this.observer = observer; this.m = new SingleAssignmentDisposable(); } var AutoDetachObserverPrototype = AutoDetachObserver.prototype; AutoDetachObserverPrototype.next = function (value) { var noError = false; try { this.observer.onNext(value); noError = true; } catch (e) { throw e; } finally { if (!noError) { this.dispose(); } } }; AutoDetachObserverPrototype.error = function (exn) { try { this.observer.onError(exn); } catch (e) { throw e; } finally { this.dispose(); } }; AutoDetachObserverPrototype.completed = function () { try { this.observer.onCompleted(); } catch (e) { throw e; } finally { this.dispose(); } }; AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); }; AutoDetachObserverPrototype.getDisposable = function (value) { return this.m.getDisposable(); }; /* @private */ AutoDetachObserverPrototype.disposable = function (value) { return arguments.length ? this.getDisposable() : setDisposable(value); }; AutoDetachObserverPrototype.dispose = function () { _super.prototype.dispose.call(this); this.m.dispose(); }; return AutoDetachObserver; }(AbstractObserver)); /** @private */ var InnerSubscription = function (subject, observer) { this.subject = subject; this.observer = observer; }; /** * @private * @memberOf InnerSubscription */ InnerSubscription.prototype.dispose = function () { if (!this.subject.isDisposed && this.observer !== null) { var idx = this.subject.observers.indexOf(this.observer); this.subject.observers.splice(idx, 1); this.observer = null; } }; /** * Represents an object that is both an observable sequence as well as an observer. * Each notification is broadcasted to all subscribed observers. */ var Subject = Rx.Subject = (function (_super) { function subscribe(observer) { checkDisposed.call(this); if (!this.isStopped) { this.observers.push(observer); return new InnerSubscription(this, observer); } if (this.exception) { observer.onError(this.exception); return disposableEmpty; } observer.onCompleted(); return disposableEmpty; } inherits(Subject, _super); /** * Creates a subject. * @constructor */ function Subject() { _super.call(this, subscribe); this.isDisposed = false, this.isStopped = false, this.observers = []; } addProperties(Subject.prototype, Observer, { /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { return this.observers.length > 0; }, /** * Notifies all subscribed observers about the end of the sequence. */ onCompleted: function () { checkDisposed.call(this); if (!this.isStopped) { var os = this.observers.slice(0); this.isStopped = true; for (var i = 0, len = os.length; i < len; i++) { os[i].onCompleted(); } this.observers = []; } }, /** * Notifies all subscribed observers about the exception. * @param {Mixed} error The exception to send to all observers. */ onError: function (exception) { checkDisposed.call(this); if (!this.isStopped) { var os = this.observers.slice(0); this.isStopped = true; this.exception = exception; for (var i = 0, len = os.length; i < len; i++) { os[i].onError(exception); } this.observers = []; } }, /** * Notifies all subscribed observers about the arrival of the specified element in the sequence. * @param {Mixed} value The value to send to all observers. */ onNext: function (value) { checkDisposed.call(this); if (!this.isStopped) { var os = this.observers.slice(0); for (var i = 0, len = os.length; i < len; i++) { os[i].onNext(value); } } }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; } }); /** * Creates a subject from the specified observer and observable. * @param {Observer} observer The observer used to send messages to the subject. * @param {Observable} observable The observable used to subscribe to messages sent from the subject. * @returns {Subject} Subject implemented using the given observer and observable. */ Subject.create = function (observer, observable) { return new AnonymousSubject(observer, observable); }; return Subject; }(Observable)); /** * Represents the result of an asynchronous operation. * The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers. */ var AsyncSubject = Rx.AsyncSubject = (function (_super) { function subscribe(observer) { checkDisposed.call(this); if (!this.isStopped) { this.observers.push(observer); return new InnerSubscription(this, observer); } var ex = this.exception, hv = this.hasValue, v = this.value; if (ex) { observer.onError(ex); } else if (hv) { observer.onNext(v); observer.onCompleted(); } else { observer.onCompleted(); } return disposableEmpty; } inherits(AsyncSubject, _super); /** * Creates a subject that can only receive one value and that value is cached for all future observations. * @constructor */ function AsyncSubject() { _super.call(this, subscribe); this.isDisposed = false; this.isStopped = false; this.value = null; this.hasValue = false; this.observers = []; this.exception = null; } addProperties(AsyncSubject.prototype, Observer, { /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { checkDisposed.call(this); return this.observers.length > 0; }, /** * Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any). */ onCompleted: function () { var o, i, len; checkDisposed.call(this); if (!this.isStopped) { this.isStopped = true; var os = this.observers.slice(0), v = this.value, hv = this.hasValue; if (hv) { for (i = 0, len = os.length; i < len; i++) { o = os[i]; o.onNext(v); o.onCompleted(); } } else { for (i = 0, len = os.length; i < len; i++) { os[i].onCompleted(); } } this.observers = []; } }, /** * Notifies all subscribed observers about the exception. * @param {Mixed} error The exception to send to all observers. */ onError: function (exception) { checkDisposed.call(this); if (!this.isStopped) { var os = this.observers.slice(0); this.isStopped = true; this.exception = exception; for (var i = 0, len = os.length; i < len; i++) { os[i].onError(exception); } this.observers = []; } }, /** * Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers. * @param {Mixed} value The value to store in the subject. */ onNext: function (value) { checkDisposed.call(this); if (!this.isStopped) { this.value = value; this.hasValue = true; } }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; this.exception = null; this.value = null; } }); return AsyncSubject; }(Observable)); var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) { inherits(AnonymousSubject, __super__); function AnonymousSubject(observer, observable) { this.observer = observer; this.observable = observable; __super__.call(this, this.observable.subscribe.bind(this.observable)); } addProperties(AnonymousSubject.prototype, Observer, { onCompleted: function () { this.observer.onCompleted(); }, onError: function (exception) { this.observer.onError(exception); }, onNext: function (value) { this.observer.onNext(value); } }); return AnonymousSubject; }(Observable)); if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { root.Rx = Rx; define(function() { return Rx; }); } else if (freeExports && freeModule) { // in Node.js or RingoJS if (moduleExports) { (freeModule.exports = Rx).Rx = Rx; } else { freeExports.Rx = Rx; } } else { // in a browser or Rhino root.Rx = Rx; } }.call(this));
aeharding/cdnjs
ajax/libs/rxjs/2.3.5/rx.core.js
JavaScript
mit
88,094
/* * Pig Latin Mode for CodeMirror 2 * @author Prasanth Jayachandran * @link https://github.com/prasanthj/pig-codemirror-2 * This implementation is adapted from PL/SQL mode in CodeMirror 2. */ CodeMirror.defineMode("pig", function(_config, parserConfig) { var keywords = parserConfig.keywords, builtins = parserConfig.builtins, types = parserConfig.types, multiLineStrings = parserConfig.multiLineStrings; var isOperatorChar = /[*+\-%<>=&?:\/!|]/; function chain(stream, state, f) { state.tokenize = f; return f(stream, state); } var type; function ret(tp, style) { type = tp; return style; } function tokenComment(stream, state) { var isEnd = false; var ch; while(ch = stream.next()) { if(ch == "/" && isEnd) { state.tokenize = tokenBase; break; } isEnd = (ch == "*"); } return ret("comment", "comment"); } function tokenString(quote) { return function(stream, state) { var escaped = false, next, end = false; while((next = stream.next()) != null) { if (next == quote && !escaped) { end = true; break; } escaped = !escaped && next == "\\"; } if (end || !(escaped || multiLineStrings)) state.tokenize = tokenBase; return ret("string", "error"); }; } function tokenBase(stream, state) { var ch = stream.next(); // is a start of string? if (ch == '"' || ch == "'") return chain(stream, state, tokenString(ch)); // is it one of the special chars else if(/[\[\]{}\(\),;\.]/.test(ch)) return ret(ch); // is it a number? else if(/\d/.test(ch)) { stream.eatWhile(/[\w\.]/); return ret("number", "number"); } // multi line comment or operator else if (ch == "/") { if (stream.eat("*")) { return chain(stream, state, tokenComment); } else { stream.eatWhile(isOperatorChar); return ret("operator", "operator"); } } // single line comment or operator else if (ch=="-") { if(stream.eat("-")){ stream.skipToEnd(); return ret("comment", "comment"); } else { stream.eatWhile(isOperatorChar); return ret("operator", "operator"); } } // is it an operator else if (isOperatorChar.test(ch)) { stream.eatWhile(isOperatorChar); return ret("operator", "operator"); } else { // get the while word stream.eatWhile(/[\w\$_]/); // is it one of the listed keywords? if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) { if (stream.eat(")") || stream.eat(".")) { //keywords can be used as variables like flatten(group), group.$0 etc.. } else { return ("keyword", "keyword"); } } // is it one of the builtin functions? if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase())) { return ("keyword", "variable-2"); } // is it one of the listed types? if (types && types.propertyIsEnumerable(stream.current().toUpperCase())) return ("keyword", "variable-3"); // default is a 'variable' return ret("variable", "pig-word"); } } // Interface return { startState: function() { return { tokenize: tokenBase, startOfLine: true }; }, token: function(stream, state) { if(stream.eatSpace()) return null; var style = state.tokenize(stream, state); return style; } }; }); (function() { function keywords(str) { var obj = {}, words = str.split(" "); for (var i = 0; i < words.length; ++i) obj[words[i]] = true; return obj; } // builtin funcs taken from trunk revision 1303237 var pBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL " + "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS " + "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG " + "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN " + "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER " + "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS " + "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA " + "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE " + "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG " + "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER "; // taken from QueryLexer.g var pKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP " + "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL " + "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE " + "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE " + "NEQ MATCHES TRUE FALSE "; // data types var pTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP "; CodeMirror.defineMIME("text/x-pig", { name: "pig", builtins: keywords(pBuiltins), keywords: keywords(pKeywords), types: keywords(pTypes) }); }());
hongkheng/cdnjs
ajax/libs/codemirror/3.13.0/mode/pig/pig.js
JavaScript
mit
5,552
/*! * Bootstrap v3.3.2 (http://getbootstrap.com) * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */.btn-danger,.btn-default,.btn-info,.btn-primary,.btn-success,.btn-warning{text-shadow:0 -1px 0 rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.btn-danger.active,.btn-danger:active,.btn-default.active,.btn-default:active,.btn-info.active,.btn-info:active,.btn-primary.active,.btn-primary:active,.btn-success.active,.btn-success:active,.btn-warning.active,.btn-warning:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-danger .badge,.btn-default .badge,.btn-info .badge,.btn-primary .badge,.btn-success .badge,.btn-warning .badge{text-shadow:none}.btn.active,.btn:active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-o-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e0e0e0));background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc}.btn-default:focus,.btn-default:hover{background-color:#e0e0e0;background-position:0 -15px}.btn-default.active,.btn-default:active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-default.disabled,.btn-default:disabled,.btn-default[disabled]{background-color:#e0e0e0;background-image:none}.btn-primary{background-image:-webkit-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-o-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#265a88));background-image:linear-gradient(to bottom,#337ab7 0,#265a88 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#245580}.btn-primary:focus,.btn-primary:hover{background-color:#265a88;background-position:0 -15px}.btn-primary.active,.btn-primary:active{background-color:#265a88;border-color:#245580}.btn-primary.disabled,.btn-primary:disabled,.btn-primary[disabled]{background-color:#265a88;background-image:none}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#419641));background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#3e8f3e}.btn-success:focus,.btn-success:hover{background-color:#419641;background-position:0 -15px}.btn-success.active,.btn-success:active{background-color:#419641;border-color:#3e8f3e}.btn-success.disabled,.btn-success:disabled,.btn-success[disabled]{background-color:#419641;background-image:none}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#2aabd2));background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#28a4c9}.btn-info:focus,.btn-info:hover{background-color:#2aabd2;background-position:0 -15px}.btn-info.active,.btn-info:active{background-color:#2aabd2;border-color:#28a4c9}.btn-info.disabled,.btn-info:disabled,.btn-info[disabled]{background-color:#2aabd2;background-image:none}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#eb9316));background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#e38d13}.btn-warning:focus,.btn-warning:hover{background-color:#eb9316;background-position:0 -15px}.btn-warning.active,.btn-warning:active{background-color:#eb9316;border-color:#e38d13}.btn-warning.disabled,.btn-warning:disabled,.btn-warning[disabled]{background-color:#eb9316;background-image:none}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c12e2a));background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#b92c28}.btn-danger:focus,.btn-danger:hover{background-color:#c12e2a;background-position:0 -15px}.btn-danger.active,.btn-danger:active{background-color:#c12e2a;border-color:#b92c28}.btn-danger.disabled,.btn-danger:disabled,.btn-danger[disabled]{background-color:#c12e2a;background-image:none}.img-thumbnail,.thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{background-color:#2e6da4;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-o-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f8f8f8));background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-o-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dbdbdb),to(#e2e2e2));background-image:linear-gradient(to bottom,#dbdbdb 0,#e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-o-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#222));background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-o-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#080808),to(#0f0f0f));background-image:linear-gradient(to bottom,#080808 0,#0f0f0f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-fixed-bottom,.navbar-fixed-top,.navbar-static-top{border-radius:0}@media (max-width:767px){.navbar .navbar-nav .open .dropdown-menu>.active>a,.navbar .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#c8e5bc));background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);background-repeat:repeat-x;border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#b9def0));background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);background-repeat:repeat-x;border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#f8efc0));background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);background-repeat:repeat-x;border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-o-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#e7c3c3));background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);background-repeat:repeat-x;border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f5f5f5));background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x}.progress-bar{background-image:-webkit-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-o-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#286090));background-image:linear-gradient(to bottom,#337ab7 0,#286090 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);background-repeat:repeat-x}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#449d44));background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);background-repeat:repeat-x}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#31b0d5));background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);background-repeat:repeat-x}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#ec971f));background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);background-repeat:repeat-x}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c9302c));background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);background-repeat:repeat-x}.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{text-shadow:0 -1px 0 #286090;background-image:-webkit-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2b669a));background-image:linear-gradient(to bottom,#337ab7 0,#2b669a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);background-repeat:repeat-x;border-color:#2b669a}.list-group-item.active .badge,.list-group-item.active:focus .badge,.list-group-item.active:hover .badge{text-shadow:none}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#d0e9c6));background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);background-repeat:repeat-x}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#c4e3f3));background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);background-repeat:repeat-x}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#faf2cc));background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);background-repeat:repeat-x}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-o-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#ebcccc));background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);background-repeat:repeat-x}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#e8e8e8),to(#f5f5f5));background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x;border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)}
aspose-words/Aspose.Words-for-.NET
Showcases/Document_Comparison_by_Aspose_Words_for_NET/DocumentComparison/Content/bootstrap-theme.min.css
CSS
mit
19,963
webshims.register("form-native-extend",function(a,b,c,d){"use strict";var e=b.support;if(e.formvalidation&&!b.bugs.bustedValidity){var f=b.inputTypes,g=!1,h={},i=function(){var b,c=function(){a(this).prop("validity")},d=function(){a("input").each(c)};return function(){clearTimeout(b),b=setTimeout(d,9)}}();b.addInputType=function(c,d){f[c]=d,g=!0,a.isDOMReady&&e.formvalidation&&!b.bugs.bustedValidity&&i()},b.addValidityRule=function(a,b){h[a]=b},a.each({typeMismatch:"mismatch",badInput:"bad"},function(a,c){b.addValidityRule(a,function(b,d,e,g){if(""===d)return!1;var h=g[a];return"type"in e||(e.type=(b[0].getAttribute("type")||"").toLowerCase()),f[e.type]&&f[e.type][c]&&(h=f[e.type][c](d,b)),h||!1})});var j=b.modules["form-number-date-api"],k=j.loaded&&!j.test(),l=["customError","badInput","typeMismatch","rangeUnderflow","rangeOverflow","stepMismatch","tooLong","tooShort","patternMismatch","valueMissing","valid"],m=["value"],n=[],o=function(b){if(b||g){var c=(b.getAttribute&&b.getAttribute("type")||b.type||"").toLowerCase();f[c]&&a.prop(b,"validity")}},p={};if(["input","textarea","select"].forEach(function(c){var d=b.defineNodeNameProperty(c,"setCustomValidity",{prop:{value:function(e){e+="";var f="input"==c?a(this).getNativeElement()[0]:this;d.prop._supvalue.call(f,e),k&&(b.data(f,"hasCustomError",!!e),o(f))}}});p[c]=d.prop._supvalue}),k&&(m.push("min"),m.push("max"),m.push("step"),n.push("input")),k){var q;if(n.forEach(function(c){var d=b.defineNodeNameProperty(c,"validity",{prop:{get:function(){if(!q){var e="input"==c?a(this).getNativeElement()[0]:this,g=d.prop._supget.call(e);if(!g)return g;var i={};if(l.forEach(function(a){i[a]=g[a]||!1}),!a.prop(e,"willValidate"))return i;q=!0;var j,k=a(e),m={type:(e.getAttribute&&e.getAttribute("type")||e.type||"").toLowerCase(),nodeName:(e.nodeName||"").toLowerCase()},n=k.val(),o=!!b.data(e,"hasCustomError");if(q=!1,i.customError=o,i.valid&&i.customError)i.valid=!1;else if(!i.valid){var r=!0;a.each(i,function(a,b){return b?(r=!1,!1):void 0}),r&&(i.valid=!0)}return a.each(h,function(a,d){i[a]=d(k,n,m,i),i[a]&&(i.valid||!j)&&f[m.type]&&(p[c].call(e,b.createValidationMessage(e,a)),i.valid=!1,j=!0)}),i.valid&&(p[c].call(e,""),b.data(e,"hasCustomError",!1)),i}},writeable:!1}})}),m.forEach(function(a){b.onNodeNamesPropertyModify(n,a,function(){o(this)})}),d.addEventListener){var r,s=function(a){"form"in a.target&&(clearTimeout(r),o(a.target))};d.addEventListener("change",s,!0),d.addEventListener("input",function(a){clearTimeout(r),r=setTimeout(function(){o(a.target)},290)},!0)}var t=n.join(",");b.addReady(function(b,c){g&&a(t,b).add(c.filter(t)).each(function(){o(this)})})}b.defineNodeNameProperty("input","type",{prop:{get:function(){var a=this,c=(a.getAttribute&&a.getAttribute("type")||"").toLowerCase();return b.inputTypes[c]?c:a.type}}})}}),webshims.register("form-number-date-api",function(a,b){"use strict";b.addInputType||b.error("you can not call forms-ext feature after calling forms feature. call both at once instead: $.webshims.polyfill('forms forms-ext')"),b.getStep||(b.getStep=function(b,c){var e=a.attr(b,"step");return"any"===e?e:(c=c||g(b),d[c]&&d[c].step?(e=o.number.asNumber(e),(!isNaN(e)&&e>0?e:d[c].step)*(d[c].stepScaleFactor||1)):e)}),b.addMinMaxNumberToCache||(b.addMinMaxNumberToCache=function(a,b,c){a+"AsNumber"in c||(c[a+"AsNumber"]=d[c.type].asNumber(b.attr(a)),isNaN(c[a+"AsNumber"])&&a+"Default"in d[c.type]&&(c[a+"AsNumber"]=d[c.type][a+"Default"]))});var c=parseInt("NaN",10),d=b.inputTypes,e=function(a){return"number"==typeof a||a&&a==1*a},f=function(b){return a('<input type="'+b+'" />').prop("type")===b},g=function(a){return(a.getAttribute("type")||"").toLowerCase()},h=function(a){return a&&!isNaN(1*a)},i=b.addMinMaxNumberToCache,j=function(a,b){a=""+a,b-=a.length;for(var c=0;b>c;c++)a="0"+a;return a},k=1e-7,l=b.bugs.bustedValidity;b.addValidityRule("stepMismatch",function(a,c,e,f){if(""===c)return!1;if("type"in e||(e.type=g(a[0])),"week"==e.type)return!1;var h,j,l=(f||{}).stepMismatch||!1;if(d[e.type]&&d[e.type].step){if("step"in e||(e.step=b.getStep(a[0],e.type)),"any"==e.step)return!1;if("valueAsNumber"in e||(e.valueAsNumber=d[e.type].asNumber(c)),isNaN(e.valueAsNumber))return!1;i("min",a,e),h=e.minAsNumber,isNaN(h)&&(j=a.prop("defaultValue"))&&(h=d[e.type].asNumber(j)),isNaN(h)&&(h=d[e.type].stepBase||0),l=Math.abs((e.valueAsNumber-h)%e.step),l=!(k>=l||Math.abs(l-e.step)<=k)}return l}),[{name:"rangeOverflow",attr:"max",factor:1},{name:"rangeUnderflow",attr:"min",factor:-1}].forEach(function(a){b.addValidityRule(a.name,function(b,c,e,f){var h=(f||{})[a.name]||!1;if(""===c)return h;if("type"in e||(e.type=g(b[0])),d[e.type]&&d[e.type].asNumber){if("valueAsNumber"in e||(e.valueAsNumber=d[e.type].asNumber(c)),isNaN(e.valueAsNumber))return!1;if(i(a.attr,b,e),isNaN(e[a.attr+"AsNumber"]))return h;h=e[a.attr+"AsNumber"]*a.factor<e.valueAsNumber*a.factor-k}return h})}),b.reflectProperties(["input"],["max","min","step"]);var m=b.defineNodeNameProperty("input","valueAsNumber",{prop:{get:function(){var b=this,e=g(b),f=d[e]&&d[e].asNumber?d[e].asNumber(a.prop(b,"value")):m.prop._supget&&m.prop._supget.apply(b,arguments);return null==f&&(f=c),f},set:function(c){var e=this,f=g(e);if(d[f]&&d[f].numberToString){if(isNaN(c))return void a.prop(e,"value","");var h=d[f].numberToString(c);h!==!1?a.prop(e,"value",h):b.error("INVALID_STATE_ERR: DOM Exception 11")}else m.prop._supset&&m.prop._supset.apply(e,arguments)}}}),n=b.defineNodeNameProperty("input","valueAsDate",{prop:{get:function(){var b=this,c=g(b);return d[c]&&d[c].asDate&&!d[c].noAsDate?d[c].asDate(a.prop(b,"value")):n.prop._supget&&n.prop._supget.call(b)||null},set:function(c){var e=this,f=g(e);if(!d[f]||!d[f].dateToString||d[f].noAsDate)return n.prop._supset&&n.prop._supset.apply(e,arguments)||null;if(null===c)return a.prop(e,"value",""),"";var h=d[f].dateToString(c);return h!==!1?(a.prop(e,"value",h),h):void b.error("INVALID_STATE_ERR: DOM Exception 11")}}});a.each({stepUp:1,stepDown:-1},function(c,e){var f=b.defineNodeNameProperty("input",c,{prop:{value:function(c){var h,i,j,l,m,n,o,p=g(this);if(!d[p]||!d[p].asNumber){if(f.prop&&f.prop._supvalue)return f.prop._supvalue.apply(this,arguments);throw b.info("no step method for type: "+p),"invalid state error"}if(m={type:p},c||(c=1,b.warn("you should always use a factor for stepUp/stepDown")),c*=e,h=b.getStep(this,p),"any"==h)throw b.info("step is 'any' can't apply stepUp/stepDown"),"invalid state error";return b.addMinMaxNumberToCache("min",a(this),m),b.addMinMaxNumberToCache("max",a(this),m),i=a.prop(this,"valueAsNumber"),c>0&&!isNaN(m.minAsNumber)&&(isNaN(i)||m.minAsNumber>i)?void a.prop(this,"valueAsNumber",m.minAsNumber):0>c&&!isNaN(m.maxAsNumber)&&(isNaN(i)||m.maxAsNumber<i)?void a.prop(this,"valueAsNumber",m.maxAsNumber):(isNaN(i)&&(i=0),n=m.minAsNumber,isNaN(n)&&(o=a.prop(this,"defaultValue"))&&(n=d[p].asNumber(o)),n||(n=0),h*=c,i=1*(i+h).toFixed(5),j=(i-n)%h,j&&Math.abs(j)>k&&(l=i-j,l+=j>0?h:-h,i=1*l.toFixed(5)),!isNaN(m.maxAsNumber)&&i>m.maxAsNumber||!isNaN(m.minAsNumber)&&i<m.minAsNumber?void b.info("max/min overflow can't apply stepUp/stepDown"):void a.prop(this,"valueAsNumber",i))}}})});var o={number:{bad:function(a){return!e(a)},step:1,stepScaleFactor:1,asNumber:function(a){return e(a)?1*a:c},numberToString:function(a){return e(a)?a:!1}},range:{minDefault:0,maxDefault:100},color:{bad:function(){var a=/^\u0023[a-f0-9]{6}$/;return function(b){return!b||7!=b.length||!a.test(b)}}()},date:{bad:function(a){if(!a||!a.split||!/\d$/.test(a))return!0;var b,c=a.split(/\u002D/);if(3!==c.length)return!0;var d=!1;if(c[0].length<4||2!=c[1].length||c[1]>12||2!=c[2].length||c[2]>33)d=!0;else for(b=0;3>b;b++)if(!h(c[b])){d=!0;break}return d||a!==this.dateToString(this.asDate(a,!0))},step:1,stepScaleFactor:864e5,asDate:function(a,b){return!b&&this.bad(a)?null:new Date(this.asNumber(a,!0))},asNumber:function(a,b){var d=c;return(b||!this.bad(a))&&(a=a.split(/\u002D/),d=Date.UTC(a[0],a[1]-1,a[2])),d},numberToString:function(a){return e(a)?this.dateToString(new Date(1*a)):!1},dateToString:function(a){return a&&a.getFullYear?j(a.getUTCFullYear(),4)+"-"+j(a.getUTCMonth()+1,2)+"-"+j(a.getUTCDate(),2):!1}},time:{bad:function(b,c){if(!b||!b.split||!/\d$/.test(b))return!0;if(b=b.split(/\u003A/),b.length<2||b.length>3)return!0;var d,e=!1;return b[2]&&(b[2]=b[2].split(/\u002E/),d=parseInt(b[2][1],10),b[2]=b[2][0]),a.each(b,function(a,b){return h(b)&&2===b.length?void 0:(e=!0,!1)}),e?!0:b[0]>23||b[0]<0||b[1]>59||b[1]<0?!0:b[2]&&(b[2]>59||b[2]<0)?!0:d&&isNaN(d)?!0:(d&&(100>d?d*=100:10>d&&(d*=10)),c===!0?[b,d]:!1)},step:60,stepBase:0,stepScaleFactor:1e3,asDate:function(a){return a=new Date(this.asNumber(a)),isNaN(a)?null:a},asNumber:function(a){var b=c;return a=this.bad(a,!0),a!==!0&&(b=Date.UTC("1970",0,1,a[0][0],a[0][1],a[0][2]||0),a[1]&&(b+=a[1])),b},dateToString:function(a){if(a&&a.getUTCHours){var b=j(a.getUTCHours(),2)+":"+j(a.getUTCMinutes(),2),c=a.getSeconds();return"0"!=c&&(b+=":"+j(c,2)),c=a.getUTCMilliseconds(),"0"!=c&&(b+="."+j(c,3)),b}return!1}},month:{bad:function(a){return o.date.bad(a+"-01")},step:1,stepScaleFactor:!1,asDate:function(a){return new Date(o.date.asNumber(a+"-01"))},asNumber:function(a){var b=c;return a&&!this.bad(a)&&(a=a.split(/\u002D/),a[0]=1*a[0]-1970,a[1]=1*a[1]-1,b=12*a[0]+a[1]),b},numberToString:function(a){var b,c=!1;return e(a)&&(b=a%12,a=(a-b)/12+1970,b+=1,1>b&&(a-=1,b+=12),c=j(a,4)+"-"+j(b,2)),c},dateToString:function(a){if(a&&a.getUTCHours){var b=o.date.dateToString(a);return b.split&&(b=b.split(/\u002D/))?b[0]+"-"+b[1]:!1}return!1}},"datetime-local":{bad:function(a,b){return a&&a.split&&2===(a+"special").split(/\u0054/).length?(a=a.split(/\u0054/),o.date.bad(a[0])||o.time.bad(a[1],b)):!0},noAsDate:!0,asDate:function(a){return a=new Date(this.asNumber(a)),isNaN(a)?null:a},asNumber:function(a){var b=c,d=this.bad(a,!0);return d!==!0&&(a=a.split(/\u0054/)[0].split(/\u002D/),b=Date.UTC(a[0],a[1]-1,a[2],d[0][0],d[0][1],d[0][2]||0),d[1]&&(b+=d[1])),b},dateToString:function(a,b){return o.date.dateToString(a)+"T"+o.time.dateToString(a,b)}}};!l&&f("range")&&f("time")&&f("month")&&f("datetime-local")||(o.range=a.extend({},o.number,o.range),o.time=a.extend({},o.date,o.time),o.month=a.extend({},o.date,o.month),o["datetime-local"]=a.extend({},o.date,o.time,o["datetime-local"])),["number","month","range","date","time","color","datetime-local"].forEach(function(a){(l||!f(a))&&b.addInputType(a,o[a])}),null==a("<input />").prop("labels")&&b.defineNodeNamesProperty("button, input, keygen, meter, output, progress, select, textarea","labels",{prop:{get:function(){if("hidden"==this.type)return null;var b=this.id,c=a(this).closest("label").filter(function(){var a=this.attributes["for"]||{};return!a.specified||a.value==b});return b&&(c=c.add('label[for="'+b+'"]')),c.get()},writeable:!1}})});
vuonghuuphuc/cdnjs
ajax/libs/webshim/1.15.4/minified/shims/combos/29.js
JavaScript
mit
10,841
webshims.register("form-number-date-api",function(a,b){"use strict";b.addInputType||b.error("you can not call forms-ext feature after calling forms feature. call both at once instead: $.webshims.polyfill('forms forms-ext')"),b.getStep||(b.getStep=function(b,c){var e=a.attr(b,"step");return"any"===e?e:(c=c||g(b),d[c]&&d[c].step?(e=o.number.asNumber(e),(!isNaN(e)&&e>0?e:d[c].step)*(d[c].stepScaleFactor||1)):e)}),b.addMinMaxNumberToCache||(b.addMinMaxNumberToCache=function(a,b,c){a+"AsNumber"in c||(c[a+"AsNumber"]=d[c.type].asNumber(b.attr(a)),isNaN(c[a+"AsNumber"])&&a+"Default"in d[c.type]&&(c[a+"AsNumber"]=d[c.type][a+"Default"]))});var c=parseInt("NaN",10),d=b.inputTypes,e=function(a){return"number"==typeof a||a&&a==1*a},f=function(b){return a('<input type="'+b+'" />').prop("type")===b},g=function(a){return(a.getAttribute("type")||"").toLowerCase()},h=function(a){return a&&!isNaN(1*a)},i=b.addMinMaxNumberToCache,j=function(a,b){a=""+a,b-=a.length;for(var c=0;b>c;c++)a="0"+a;return a},k=1e-7,l=b.bugs.bustedValidity;b.addValidityRule("stepMismatch",function(a,c,e,f){if(""===c)return!1;if("type"in e||(e.type=g(a[0])),"week"==e.type)return!1;var h,j,l=(f||{}).stepMismatch||!1;if(d[e.type]&&d[e.type].step){if("step"in e||(e.step=b.getStep(a[0],e.type)),"any"==e.step)return!1;if("valueAsNumber"in e||(e.valueAsNumber=d[e.type].asNumber(c)),isNaN(e.valueAsNumber))return!1;i("min",a,e),h=e.minAsNumber,isNaN(h)&&(j=a.prop("defaultValue"))&&(h=d[e.type].asNumber(j)),isNaN(h)&&(h=d[e.type].stepBase||0),l=Math.abs((e.valueAsNumber-h)%e.step),l=!(k>=l||Math.abs(l-e.step)<=k)}return l}),[{name:"rangeOverflow",attr:"max",factor:1},{name:"rangeUnderflow",attr:"min",factor:-1}].forEach(function(a){b.addValidityRule(a.name,function(b,c,e,f){var h=(f||{})[a.name]||!1;if(""===c)return h;if("type"in e||(e.type=g(b[0])),d[e.type]&&d[e.type].asNumber){if("valueAsNumber"in e||(e.valueAsNumber=d[e.type].asNumber(c)),isNaN(e.valueAsNumber))return!1;if(i(a.attr,b,e),isNaN(e[a.attr+"AsNumber"]))return h;h=e[a.attr+"AsNumber"]*a.factor<e.valueAsNumber*a.factor-k}return h})}),b.reflectProperties(["input"],["max","min","step"]);var m=b.defineNodeNameProperty("input","valueAsNumber",{prop:{get:function(){var b=this,e=g(b),f=d[e]&&d[e].asNumber?d[e].asNumber(a.prop(b,"value")):m.prop._supget&&m.prop._supget.apply(b,arguments);return null==f&&(f=c),f},set:function(c){var e=this,f=g(e);if(d[f]&&d[f].numberToString){if(isNaN(c))return void a.prop(e,"value","");var h=d[f].numberToString(c);h!==!1?a.prop(e,"value",h):b.error("INVALID_STATE_ERR: DOM Exception 11")}else m.prop._supset&&m.prop._supset.apply(e,arguments)}}}),n=b.defineNodeNameProperty("input","valueAsDate",{prop:{get:function(){var b=this,c=g(b);return d[c]&&d[c].asDate&&!d[c].noAsDate?d[c].asDate(a.prop(b,"value")):n.prop._supget&&n.prop._supget.call(b)||null},set:function(c){var e=this,f=g(e);if(!d[f]||!d[f].dateToString||d[f].noAsDate)return n.prop._supset&&n.prop._supset.apply(e,arguments)||null;if(null===c)return a.prop(e,"value",""),"";var h=d[f].dateToString(c);return h!==!1?(a.prop(e,"value",h),h):void b.error("INVALID_STATE_ERR: DOM Exception 11")}}});a.each({stepUp:1,stepDown:-1},function(c,e){var f=b.defineNodeNameProperty("input",c,{prop:{value:function(c){var h,i,j,l,m,n,o,p=g(this);if(!d[p]||!d[p].asNumber){if(f.prop&&f.prop._supvalue)return f.prop._supvalue.apply(this,arguments);throw b.info("no step method for type: "+p),"invalid state error"}if(m={type:p},c||(c=1,b.warn("you should always use a factor for stepUp/stepDown")),c*=e,h=b.getStep(this,p),"any"==h)throw b.info("step is 'any' can't apply stepUp/stepDown"),"invalid state error";return b.addMinMaxNumberToCache("min",a(this),m),b.addMinMaxNumberToCache("max",a(this),m),i=a.prop(this,"valueAsNumber"),c>0&&!isNaN(m.minAsNumber)&&(isNaN(i)||m.minAsNumber>i)?void a.prop(this,"valueAsNumber",m.minAsNumber):0>c&&!isNaN(m.maxAsNumber)&&(isNaN(i)||m.maxAsNumber<i)?void a.prop(this,"valueAsNumber",m.maxAsNumber):(isNaN(i)&&(i=0),n=m.minAsNumber,isNaN(n)&&(o=a.prop(this,"defaultValue"))&&(n=d[p].asNumber(o)),n||(n=0),h*=c,i=1*(i+h).toFixed(5),j=(i-n)%h,j&&Math.abs(j)>k&&(l=i-j,l+=j>0?h:-h,i=1*l.toFixed(5)),!isNaN(m.maxAsNumber)&&i>m.maxAsNumber||!isNaN(m.minAsNumber)&&i<m.minAsNumber?void b.info("max/min overflow can't apply stepUp/stepDown"):void a.prop(this,"valueAsNumber",i))}}})});var o={number:{bad:function(a){return!e(a)},step:1,stepScaleFactor:1,asNumber:function(a){return e(a)?1*a:c},numberToString:function(a){return e(a)?a:!1}},range:{minDefault:0,maxDefault:100},color:{bad:function(){var a=/^\u0023[a-f0-9]{6}$/;return function(b){return!b||7!=b.length||!a.test(b)}}()},date:{bad:function(a){if(!a||!a.split||!/\d$/.test(a))return!0;var b,c=a.split(/\u002D/);if(3!==c.length)return!0;var d=!1;if(c[0].length<4||2!=c[1].length||c[1]>12||2!=c[2].length||c[2]>33)d=!0;else for(b=0;3>b;b++)if(!h(c[b])){d=!0;break}return d||a!==this.dateToString(this.asDate(a,!0))},step:1,stepScaleFactor:864e5,asDate:function(a,b){return!b&&this.bad(a)?null:new Date(this.asNumber(a,!0))},asNumber:function(a,b){var d=c;return(b||!this.bad(a))&&(a=a.split(/\u002D/),d=Date.UTC(a[0],a[1]-1,a[2])),d},numberToString:function(a){return e(a)?this.dateToString(new Date(1*a)):!1},dateToString:function(a){return a&&a.getFullYear?j(a.getUTCFullYear(),4)+"-"+j(a.getUTCMonth()+1,2)+"-"+j(a.getUTCDate(),2):!1}},time:{bad:function(b,c){if(!b||!b.split||!/\d$/.test(b))return!0;if(b=b.split(/\u003A/),b.length<2||b.length>3)return!0;var d,e=!1;return b[2]&&(b[2]=b[2].split(/\u002E/),d=parseInt(b[2][1],10),b[2]=b[2][0]),a.each(b,function(a,b){return h(b)&&2===b.length?void 0:(e=!0,!1)}),e?!0:b[0]>23||b[0]<0||b[1]>59||b[1]<0?!0:b[2]&&(b[2]>59||b[2]<0)?!0:d&&isNaN(d)?!0:(d&&(100>d?d*=100:10>d&&(d*=10)),c===!0?[b,d]:!1)},step:60,stepBase:0,stepScaleFactor:1e3,asDate:function(a){return a=new Date(this.asNumber(a)),isNaN(a)?null:a},asNumber:function(a){var b=c;return a=this.bad(a,!0),a!==!0&&(b=Date.UTC("1970",0,1,a[0][0],a[0][1],a[0][2]||0),a[1]&&(b+=a[1])),b},dateToString:function(a){if(a&&a.getUTCHours){var b=j(a.getUTCHours(),2)+":"+j(a.getUTCMinutes(),2),c=a.getSeconds();return"0"!=c&&(b+=":"+j(c,2)),c=a.getUTCMilliseconds(),"0"!=c&&(b+="."+j(c,3)),b}return!1}},month:{bad:function(a){return o.date.bad(a+"-01")},step:1,stepScaleFactor:!1,asDate:function(a){return new Date(o.date.asNumber(a+"-01"))},asNumber:function(a){var b=c;return a&&!this.bad(a)&&(a=a.split(/\u002D/),a[0]=1*a[0]-1970,a[1]=1*a[1]-1,b=12*a[0]+a[1]),b},numberToString:function(a){var b,c=!1;return e(a)&&(b=a%12,a=(a-b)/12+1970,b+=1,1>b&&(a-=1,b+=12),c=j(a,4)+"-"+j(b,2)),c},dateToString:function(a){if(a&&a.getUTCHours){var b=o.date.dateToString(a);return b.split&&(b=b.split(/\u002D/))?b[0]+"-"+b[1]:!1}return!1}},"datetime-local":{bad:function(a,b){return a&&a.split&&2===(a+"special").split(/\u0054/).length?(a=a.split(/\u0054/),o.date.bad(a[0])||o.time.bad(a[1],b)):!0},noAsDate:!0,asDate:function(a){return a=new Date(this.asNumber(a)),isNaN(a)?null:a},asNumber:function(a){var b=c,d=this.bad(a,!0);return d!==!0&&(a=a.split(/\u0054/)[0].split(/\u002D/),b=Date.UTC(a[0],a[1]-1,a[2],d[0][0],d[0][1],d[0][2]||0),d[1]&&(b+=d[1])),b},dateToString:function(a,b){return o.date.dateToString(a)+"T"+o.time.dateToString(a,b)}}};!l&&f("range")&&f("time")&&f("month")&&f("datetime-local")||(o.range=a.extend({},o.number,o.range),o.time=a.extend({},o.date,o.time),o.month=a.extend({},o.date,o.month),o["datetime-local"]=a.extend({},o.date,o.time,o["datetime-local"])),["number","month","range","date","time","color","datetime-local"].forEach(function(a){(l||!f(a))&&b.addInputType(a,o[a])}),null==a("<input />").prop("labels")&&b.defineNodeNamesProperty("button, input, keygen, meter, output, progress, select, textarea","labels",{prop:{get:function(){if("hidden"==this.type)return null;var b=this.id,c=a(this).closest("label").filter(function(){var a=this.attributes["for"]||{};return!a.specified||a.value==b});return b&&(c=c.add('label[for="'+b+'"]')),c.get()},writeable:!1}})}),webshims.register("form-datalist",function(a,b,c,d,e,f){"use strict";var g=function(a){a&&"string"==typeof a||(a="DOM"),g[a+"Loaded"]||(g[a+"Loaded"]=!0,b.ready(a,function(){b.loader.loadList(["form-datalist-lazy"])}))},h={submit:1,button:1,reset:1,hidden:1,range:1,date:1,month:1};b.modules["form-number-date-ui"].loaded&&a.extend(h,{number:1,time:1}),b.propTypes.element=function(c,e){b.createPropDefault(c,"attr"),c.prop||(c.prop={get:function(){var b=a.attr(this,e);return b&&(b=d.getElementById(b),b&&c.propNodeName&&!a.nodeName(b,c.propNodeName)&&(b=null)),b||null},writeable:!1})},function(){var i=b.cfg.forms,j=b.support.datalist;if(!j||i.customDatalist){var k=function(){var c=function(){var b;!a.data(this,"datalistWidgetData")&&(b=a.prop(this,"id"))?a('input[list="'+b+'"], input[data-wslist="'+b+'"]').eq(0).attr("list",b):a(this).triggerHandler("updateDatalist")},d={autocomplete:{attr:{get:function(){var b=this,c=a.data(b,"datalistWidget");return c?c._autocomplete:"autocomplete"in b?b.autocomplete:b.getAttribute("autocomplete")},set:function(b){var c=this,d=a.data(c,"datalistWidget");d?(d._autocomplete=b,"off"==b&&d.hideList()):"autocomplete"in c?c.autocomplete=b:c.setAttribute("autocomplete",b)}}}};j?((a("<datalist><select><option></option></select></datalist>").prop("options")||[]).length||b.defineNodeNameProperty("datalist","options",{prop:{writeable:!1,get:function(){var b=this.options||[];if(!b.length){var c=this,d=a("select",c);d[0]&&d[0].options&&d[0].options.length&&(b=d[0].options)}return b}}}),d.list={attr:{get:function(){var c=b.contentAttr(this,"list");return null!=c?(a.data(this,"datalistListAttr",c),h[a.prop(this,"type")]||h[a.attr(this,"type")]||this.removeAttribute("list")):c=a.data(this,"datalistListAttr"),null==c?e:c},set:function(c){var d=this;a.data(d,"datalistListAttr",c),h[a.prop(this,"type")]||h[a.attr(this,"type")]?d.setAttribute("list",c):(b.objectCreate(l,e,{input:d,id:c,datalist:a.prop(d,"list")}),d.setAttribute("data-wslist",c)),a(d).triggerHandler("listdatalistchange")}},initAttr:!0,reflect:!0,propType:"element",propNodeName:"datalist"}):b.defineNodeNameProperties("input",{list:{attr:{get:function(){var a=b.contentAttr(this,"list");return null==a?e:a},set:function(c){var d=this;b.contentAttr(d,"list",c),b.objectCreate(f.shadowListProto,e,{input:d,id:c,datalist:a.prop(d,"list")}),a(d).triggerHandler("listdatalistchange")}},initAttr:!0,reflect:!0,propType:"element",propNodeName:"datalist"}}),b.defineNodeNameProperties("input",d),b.addReady(function(a,b){b.filter("datalist > select, datalist, datalist > option, datalist > select > option").closest("datalist").each(c)})},l={_create:function(d){if(!h[a.prop(d.input,"type")]&&!h[a.attr(d.input,"type")]){var e=d.datalist,f=a.data(d.input,"datalistWidget"),i=this;return e&&f&&f.datalist!==e?(f.datalist=e,f.id=d.id,a(f.datalist).off("updateDatalist.datalistWidget").on("updateDatalist.datalistWidget",a.proxy(f,"_resetListCached")),void f._resetListCached()):e?void(f&&f.datalist===e||(this.datalist=e,this.id=d.id,this.hasViewableData=!0,this._autocomplete=a.attr(d.input,"autocomplete"),a.data(d.input,"datalistWidget",this),a.data(e,"datalistWidgetData",this),g("WINDOWLOAD"),b.isReady("form-datalist-lazy")?c.QUnit?i._lazyCreate(d):setTimeout(function(){i._lazyCreate(d)},9):(a(d.input).one("focus",g),b.ready("form-datalist-lazy",function(){i._destroyed||i._lazyCreate(d)})))):void(f&&f.destroy())}},destroy:function(b){var f,g=a.attr(this.input,"autocomplete");a(this.input).off(".datalistWidget").removeData("datalistWidget"),this.shadowList.remove(),a(d).off(".datalist"+this.id),a(c).off(".datalist"+this.id),this.input.form&&this.input.id&&a(this.input.form).off("submit.datalistWidget"+this.input.id),this.input.removeAttribute("aria-haspopup"),g===e?this.input.removeAttribute("autocomplete"):a(this.input).attr("autocomplete",g),b&&"beforeunload"==b.type&&(f=this.input,setTimeout(function(){a.attr(f,"list",a.attr(f,"list"))},9)),this._destroyed=!0}};b.loader.addModule("form-datalist-lazy",{noAutoCallback:!0,options:a.extend(f,{shadowListProto:l})}),f.list||(f.list={}),k()}}()});
askehansen/cdnjs
ajax/libs/webshim/1.15.3/minified/shims/combos/33.js
JavaScript
mit
12,132
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Sensio\Bundle\GeneratorBundle\Generator; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpKernel\Bundle\BundleInterface; /** * Generates a Controller inside a bundle. * * @author Wouter J <wouter@wouterj.nl> */ class ControllerGenerator extends Generator { private $filesystem; private $skeletonDir; public function __construct(Filesystem $filesystem, $skeletonDir) { $this->filesystem = $filesystem; $this->skeletonDir = $skeletonDir; } public function generate(BundleInterface $bundle, $controller, $routeFormat, $templateFormat, array $actions = array()) { $dir = $bundle->getPath(); $controllerFile = $dir.'/Controller/'.$controller.'Controller.php'; if (file_exists($controllerFile)) { throw new \RuntimeException(sprintf('Controller "%s" already exists', $controller)); } $parameters = array( 'namespace' => $bundle->getNamespace(), 'bundle' => $bundle->getName(), 'format' => array( 'routing' => $routeFormat, 'templating' => $templateFormat, ), 'controller' => $controller, ); foreach ($actions as $i => $action) { // get the actioname without the sufix Action (for the template logical name) $actions[$i]['basename'] = $basename = substr($action['name'], 0, -6); $params = $parameters; $params['action'] = $actions[$i]; // create a template $template = $actions[$i]['template']; if ('default' == $template) { $template = $bundle->getName().':'.$controller.':'.substr($action['name'], 0, -6).'.html.'.$templateFormat; } if ('twig' == $templateFormat) { $this->renderFile($this->skeletonDir, 'Template.html.twig', $dir.'/Resources/views/'.$this->parseTemplatePath($template), $params); } else { $this->renderFile($this->skeletonDir, 'Template.html.php', $dir.'/Resources/views/'.$this->parseTemplatePath($template), $params); } $this->generateRouting($bundle, $controller, $actions[$i], $routeFormat); } $parameters['actions'] = $actions; $this->renderFile($this->skeletonDir, 'Controller.php', $controllerFile, $parameters); $this->renderFile($this->skeletonDir, 'ControllerTest.php', $dir.'/Tests/Controller/'.$controller.'ControllerTest.php', $parameters); } public function generateRouting(BundleInterface $bundle, $controller, array $action, $format) { // annotation is generated in the templates if ('annotation' == $format) { return true; } $file = $bundle->getPath().'/Resources/config/routing.'.$format; if (file_exists($file)) { $content = file_get_contents($file); } elseif (!is_dir($dir = $bundle->getPath().'/Resources/config')) { mkdir($dir); } $controller = $bundle->getName().':'.$controller.':'.$action['basename']; $name = strtolower(preg_replace('/([A-Z])/', '_\\1', $action['basename'])); if ('yml' == $format) { // yaml if (!isset($content)) { $content = ''; } $content .= sprintf( "\n%s:\n pattern: %s\n defaults: { _controller: %s }\n", $name, $action['route'], $controller ); } elseif ('xml' == $format) { // xml if (!isset($content)) { // new file $content = <<<EOT <?xml version="1.0" encoding="UTF-8" ?> <routes xmlns="http://symfony.com/schema/routing" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> </routes> EOT; } $sxe = simplexml_load_string($content); $route = $sxe->addChild('route'); $route->addAttribute('id', $name); $route->addAttribute('pattern', $action['route']); $default = $route->addChild('default', $controller); $default->addAttribute('key', '_controller'); $dom = new \DOMDocument('1.0'); $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->loadXML($sxe->asXML()); $content = $dom->saveXML(); } elseif ('php' == $format) { // php if (isset($content)) { // edit current file $pointer = strpos($content, 'return'); if (!preg_match('/(\$[^ ]*).*?new RouteCollection\(\)/', $content, $collection) || false === $pointer) { throw new \RunTimeException('Routing.php file is not correct, please initialize RouteCollection.'); } $content = substr($content, 0, $pointer); $content .= sprintf("%s->add('%s', new Route('%s', array(", $collection[1], $name, $action['route']); $content .= sprintf("\n '_controller' => '%s',", $controller); $content .= "\n)));\n\nreturn ".$collection[1]; } else { // new file $content = <<<EOT <?php use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\Route; \$collection = new RouteCollection(); EOT; $content .= sprintf("\n\$collection->add('%s', new Route('%s', array(", $name, $action['route']); $content .= sprintf("\n '_controller' => '%s',", $controller); $content .= "\n)));\n\nreturn \$collection"; } } $flink = fopen($file, 'w'); if ($flink) { $write = fwrite($flink, $content); if ($write) { fclose($flink); } else { throw new \RunTimeException(sprintf('We cannot write into file "%s", has that file the correct access level?', $file)); } } else { throw new \RunTimeException(sprintf('Problems with generating file "%s", did you gave write access to that directory?', $file)); } } protected function parseTemplatePath($template) { $data = $this->parseLogicalTemplateName($template); return $data['controller'].'/'.$data['template']; } protected function parseLogicalTemplateName($logicalname, $part = '') { $data = array(); list($data['bundle'], $data['controller'], $data['template']) = explode(':', $logicalname); return ($part ? $data[$part] : $data); } }
YosriBecks/iGreg_sf
vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Generator/ControllerGenerator.php
PHP
mit
7,020
.loading:before{content:"";display:block;position:absolute;left:50%;top:50%;font-size:10px;text-indent:-9999em}.loader-animation-3 .loading:before,.loading:before{width:0;height:0;margin:0;border:none;-webkit-border-radius:0;border-radius:0;background:0 0;-webkit-animation:loader-animation-3 1s infinite linear;animation:loader-animation-3 1s infinite linear;-webkit-transform:translateZ(0);transform:translateZ(0)}@-webkit-keyframes loader-animation-3{0%{-webkit-box-shadow:-2.2em -2.2em 0 1.7em #000,-2.2em 2.2em 0 .9em #000,2.2em 2.2em 0 1.7em #000,2.2em -2.2em 0 .9em #000;box-shadow:-2.2em -2.2em 0 1.7em #000,-2.2em 2.2em 0 .9em #000,2.2em 2.2em 0 1.7em #000,2.2em -2.2em 0 .9em #000;-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-box-shadow:-2.2em -2.2em 0 .9em #000,-2.2em 2.2em 0 1.7em #000,2.2em 2.2em 0 .9em #000,2.2em -2.2em 0 1.7em #000;box-shadow:-2.2em -2.2em 0 .9em #000,-2.2em 2.2em 0 1.7em #000,2.2em 2.2em 0 .9em #000,2.2em -2.2em 0 1.7em #000;-webkit-transform:rotate(90deg);transform:rotate(90deg)}}@keyframes loader-animation-3{0%{-webkit-box-shadow:-2.2em -2.2em 0 1.7em #000,-2.2em 2.2em 0 .9em #000,2.2em 2.2em 0 1.7em #000,2.2em -2.2em 0 .9em #000;box-shadow:-2.2em -2.2em 0 1.7em #000,-2.2em 2.2em 0 .9em #000,2.2em 2.2em 0 1.7em #000,2.2em -2.2em 0 .9em #000;-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-box-shadow:-2.2em -2.2em 0 .9em #000,-2.2em 2.2em 0 1.7em #000,2.2em 2.2em 0 .9em #000,2.2em -2.2em 0 1.7em #000;box-shadow:-2.2em -2.2em 0 .9em #000,-2.2em 2.2em 0 1.7em #000,2.2em 2.2em 0 .9em #000,2.2em -2.2em 0 1.7em #000;-webkit-transform:rotate(90deg);transform:rotate(90deg)}}
Sneezry/cdnjs
ajax/libs/css-spinning-spinners/1.1.1/load3.css
CSS
mit
1,646
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\CssSelector\Tests\XPath; use Symfony\Component\CssSelector\XPath\Extension\HtmlExtension; use Symfony\Component\CssSelector\XPath\Translator; class TranslatorTest extends \PHPUnit_Framework_TestCase { /** @dataProvider getXpathLiteralTestData */ public function testXpathLiteral($value, $literal) { $this->assertEquals($literal, Translator::getXpathLiteral($value)); } /** @dataProvider getCssToXPathTestData */ public function testCssToXPath($css, $xpath) { $translator = new Translator(); $translator->registerExtension(new HtmlExtension($translator)); $this->assertEquals($xpath, $translator->cssToXPath($css, '')); } /** @dataProvider getXmlLangTestData */ public function testXmlLang($css, array $elementsId) { $translator = new Translator(); $document = new \SimpleXMLElement(file_get_contents(__DIR__.'/Fixtures/lang.xml')); $elements = $document->xpath($translator->cssToXPath($css)); $this->assertEquals(count($elementsId), count($elements)); foreach ($elements as $element) { $this->assertTrue(in_array($element->attributes()->id, $elementsId)); } } /** @dataProvider getHtmlIdsTestData */ public function testHtmlIds($css, array $elementsId) { $translator = new Translator(); $translator->registerExtension(new HtmlExtension($translator)); $document = new \DOMDocument(); $document->strictErrorChecking = false; $internalErrors = libxml_use_internal_errors(true); $document->loadHTMLFile(__DIR__.'/Fixtures/ids.html'); $document = simplexml_import_dom($document); $elements = $document->xpath($translator->cssToXPath($css)); $this->assertCount(count($elementsId), $elementsId); foreach ($elements as $element) { if (null !== $element->attributes()->id) { $this->assertTrue(in_array($element->attributes()->id, $elementsId)); } } libxml_clear_errors(); libxml_use_internal_errors($internalErrors); } /** @dataProvider getHtmlShakespearTestData */ public function testHtmlShakespear($css, $count) { $translator = new Translator(); $translator->registerExtension(new HtmlExtension($translator)); $document = new \DOMDocument(); $document->strictErrorChecking = false; $document->loadHTMLFile(__DIR__.'/Fixtures/shakespear.html'); $document = simplexml_import_dom($document); $bodies = $document->xpath('//body'); $elements = $bodies[0]->xpath($translator->cssToXPath($css)); $this->assertEquals($count, count($elements)); } public function getXpathLiteralTestData() { return array( array('foo', "'foo'"), array("foo's bar", '"foo\'s bar"'), array("foo's \"middle\" bar", 'concat(\'foo\', "\'", \'s "middle" bar\')'), array("foo's 'middle' \"bar\"", 'concat(\'foo\', "\'", \'s \', "\'", \'middle\', "\'", \' "bar"\')'), ); } public function getCssToXPathTestData() { return array( array('*', '*'), array('e', 'e'), array('*|e', 'e'), array('e|f', 'e:f'), array('e[foo]', 'e[@foo]'), array('e[foo|bar]', 'e[@foo:bar]'), array('e[foo="bar"]', "e[@foo = 'bar']"), array('e[foo~="bar"]', "e[@foo and contains(concat(' ', normalize-space(@foo), ' '), ' bar ')]"), array('e[foo^="bar"]', "e[@foo and starts-with(@foo, 'bar')]"), array('e[foo$="bar"]', "e[@foo and substring(@foo, string-length(@foo)-2) = 'bar']"), array('e[foo*="bar"]', "e[@foo and contains(@foo, 'bar')]"), array('e[hreflang|="en"]', "e[@hreflang and (@hreflang = 'en' or starts-with(@hreflang, 'en-'))]"), array('e:nth-child(1)', "*/*[name() = 'e' and (position() = 1)]"), array('e:nth-last-child(1)', "*/*[name() = 'e' and (position() = last() - 0)]"), array('e:nth-last-child(2n+2)', "*/*[name() = 'e' and (last() - position() - 1 >= 0 and (last() - position() - 1) mod 2 = 0)]"), array('e:nth-of-type(1)', '*/e[position() = 1]'), array('e:nth-last-of-type(1)', '*/e[position() = last() - 0]'), array('div e:nth-last-of-type(1) .aclass', "div/descendant-or-self::*/e[position() = last() - 0]/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' aclass ')]"), array('e:first-child', "*/*[name() = 'e' and (position() = 1)]"), array('e:last-child', "*/*[name() = 'e' and (position() = last())]"), array('e:first-of-type', '*/e[position() = 1]'), array('e:last-of-type', '*/e[position() = last()]'), array('e:only-child', "*/*[name() = 'e' and (last() = 1)]"), array('e:only-of-type', 'e[last() = 1]'), array('e:empty', 'e[not(*) and not(string-length())]'), array('e:EmPTY', 'e[not(*) and not(string-length())]'), array('e:root', 'e[not(parent::*)]'), array('e:hover', 'e[0]'), array('e:contains("foo")', "e[contains(string(.), 'foo')]"), array('e:ConTains(foo)', "e[contains(string(.), 'foo')]"), array('e.warning', "e[@class and contains(concat(' ', normalize-space(@class), ' '), ' warning ')]"), array('e#myid', "e[@id = 'myid']"), array('e:not(:nth-child(odd))', 'e[not(position() - 1 >= 0 and (position() - 1) mod 2 = 0)]'), array('e:nOT(*)', 'e[0]'), array('e f', 'e/descendant-or-self::*/f'), array('e > f', 'e/f'), array('e + f', "e/following-sibling::*[name() = 'f' and (position() = 1)]"), array('e ~ f', 'e/following-sibling::f'), array('div#container p', "div[@id = 'container']/descendant-or-self::*/p"), ); } public function getXmlLangTestData() { return array( array(':lang("EN")', array('first', 'second', 'third', 'fourth')), array(':lang("en-us")', array('second', 'fourth')), array(':lang(en-nz)', array('third')), array(':lang(fr)', array('fifth')), array(':lang(ru)', array('sixth')), array(":lang('ZH')", array('eighth')), array(':lang(de) :lang(zh)', array('eighth')), array(':lang(en), :lang(zh)', array('first', 'second', 'third', 'fourth', 'eighth')), array(':lang(es)', array()), ); } public function getHtmlIdsTestData() { return array( array('div', array('outer-div', 'li-div', 'foobar-div')), array('DIV', array('outer-div', 'li-div', 'foobar-div')), // case-insensitive in HTML array('div div', array('li-div')), array('div, div div', array('outer-div', 'li-div', 'foobar-div')), array('a[name]', array('name-anchor')), array('a[NAme]', array('name-anchor')), // case-insensitive in HTML: array('a[rel]', array('tag-anchor', 'nofollow-anchor')), array('a[rel="tag"]', array('tag-anchor')), array('a[href*="localhost"]', array('tag-anchor')), array('a[href*=""]', array()), array('a[href^="http"]', array('tag-anchor', 'nofollow-anchor')), array('a[href^="http:"]', array('tag-anchor')), array('a[href^=""]', array()), array('a[href$="org"]', array('nofollow-anchor')), array('a[href$=""]', array()), array('div[foobar~="bc"]', array('foobar-div')), array('div[foobar~="cde"]', array('foobar-div')), array('[foobar~="ab bc"]', array('foobar-div')), array('[foobar~=""]', array()), array('[foobar~=" \t"]', array()), array('div[foobar~="cd"]', array()), array('*[lang|="En"]', array('second-li')), array('[lang|="En-us"]', array('second-li')), // Attribute values are case sensitive array('*[lang|="en"]', array()), array('[lang|="en-US"]', array()), array('*[lang|="e"]', array()), // ... :lang() is not. array(':lang("EN")', array('second-li', 'li-div')), array('*:lang(en-US)', array('second-li', 'li-div')), array(':lang("e")', array()), array('li:nth-child(3)', array('third-li')), array('li:nth-child(10)', array()), array('li:nth-child(2n)', array('second-li', 'fourth-li', 'sixth-li')), array('li:nth-child(even)', array('second-li', 'fourth-li', 'sixth-li')), array('li:nth-child(2n+0)', array('second-li', 'fourth-li', 'sixth-li')), array('li:nth-child(+2n+1)', array('first-li', 'third-li', 'fifth-li', 'seventh-li')), array('li:nth-child(odd)', array('first-li', 'third-li', 'fifth-li', 'seventh-li')), array('li:nth-child(2n+4)', array('fourth-li', 'sixth-li')), array('li:nth-child(3n+1)', array('first-li', 'fourth-li', 'seventh-li')), array('li:nth-child(n)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), array('li:nth-child(n-1)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), array('li:nth-child(n+1)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), array('li:nth-child(n+3)', array('third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), array('li:nth-child(-n)', array()), array('li:nth-child(-n-1)', array()), array('li:nth-child(-n+1)', array('first-li')), array('li:nth-child(-n+3)', array('first-li', 'second-li', 'third-li')), array('li:nth-last-child(0)', array()), array('li:nth-last-child(2n)', array('second-li', 'fourth-li', 'sixth-li')), array('li:nth-last-child(even)', array('second-li', 'fourth-li', 'sixth-li')), array('li:nth-last-child(2n+2)', array('second-li', 'fourth-li', 'sixth-li')), array('li:nth-last-child(n)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), array('li:nth-last-child(n-1)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), array('li:nth-last-child(n-3)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), array('li:nth-last-child(n+1)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), array('li:nth-last-child(n+3)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li')), array('li:nth-last-child(-n)', array()), array('li:nth-last-child(-n-1)', array()), array('li:nth-last-child(-n+1)', array('seventh-li')), array('li:nth-last-child(-n+3)', array('fifth-li', 'sixth-li', 'seventh-li')), array('ol:first-of-type', array('first-ol')), array('ol:nth-child(1)', array('first-ol')), array('ol:nth-of-type(2)', array('second-ol')), array('ol:nth-last-of-type(1)', array('second-ol')), array('span:only-child', array('foobar-span')), array('li div:only-child', array('li-div')), array('div *:only-child', array('li-div', 'foobar-span')), array('p:only-of-type', array('paragraph')), array('a:empty', array('name-anchor')), array('a:EMpty', array('name-anchor')), array('li:empty', array('third-li', 'fourth-li', 'fifth-li', 'sixth-li')), array(':root', array('html')), array('html:root', array('html')), array('li:root', array()), array('* :root', array()), array('*:contains("link")', array('html', 'outer-div', 'tag-anchor', 'nofollow-anchor')), array(':CONtains("link")', array('html', 'outer-div', 'tag-anchor', 'nofollow-anchor')), array('*:contains("LInk")', array()), // case sensitive array('*:contains("e")', array('html', 'nil', 'outer-div', 'first-ol', 'first-li', 'paragraph', 'p-em')), array('*:contains("E")', array()), // case-sensitive array('.a', array('first-ol')), array('.b', array('first-ol')), array('*.a', array('first-ol')), array('ol.a', array('first-ol')), array('.c', array('first-ol', 'third-li', 'fourth-li')), array('*.c', array('first-ol', 'third-li', 'fourth-li')), array('ol *.c', array('third-li', 'fourth-li')), array('ol li.c', array('third-li', 'fourth-li')), array('li ~ li.c', array('third-li', 'fourth-li')), array('ol > li.c', array('third-li', 'fourth-li')), array('#first-li', array('first-li')), array('li#first-li', array('first-li')), array('*#first-li', array('first-li')), array('li div', array('li-div')), array('li > div', array('li-div')), array('div div', array('li-div')), array('div > div', array()), array('div>.c', array('first-ol')), array('div > .c', array('first-ol')), array('div + div', array('foobar-div')), array('a ~ a', array('tag-anchor', 'nofollow-anchor')), array('a[rel="tag"] ~ a', array('nofollow-anchor')), array('ol#first-ol li:last-child', array('seventh-li')), array('ol#first-ol *:last-child', array('li-div', 'seventh-li')), array('#outer-div:first-child', array('outer-div')), array('#outer-div :first-child', array('name-anchor', 'first-li', 'li-div', 'p-b', 'checkbox-fieldset-disabled', 'area-href')), array('a[href]', array('tag-anchor', 'nofollow-anchor')), array(':not(*)', array()), array('a:not([href])', array('name-anchor')), array('ol :Not(li[class])', array('first-li', 'second-li', 'li-div', 'fifth-li', 'sixth-li', 'seventh-li')), // HTML-specific array(':link', array('link-href', 'tag-anchor', 'nofollow-anchor', 'area-href')), array(':visited', array()), array(':enabled', array('link-href', 'tag-anchor', 'nofollow-anchor', 'checkbox-unchecked', 'text-checked', 'checkbox-checked', 'area-href')), array(':disabled', array('checkbox-disabled', 'checkbox-disabled-checked', 'fieldset', 'checkbox-fieldset-disabled')), array(':checked', array('checkbox-checked', 'checkbox-disabled-checked')), ); } public function getHtmlShakespearTestData() { return array( array('*', 246), array('div:contains(CELIA)', 26), array('div:only-child', 22), // ? array('div:nth-child(even)', 106), array('div:nth-child(2n)', 106), array('div:nth-child(odd)', 137), array('div:nth-child(2n+1)', 137), array('div:nth-child(n)', 243), array('div:last-child', 53), array('div:first-child', 51), array('div > div', 242), array('div + div', 190), array('div ~ div', 190), array('body', 1), array('body div', 243), array('div', 243), array('div div', 242), array('div div div', 241), array('div, div, div', 243), array('div, a, span', 243), array('.dialog', 51), array('div.dialog', 51), array('div .dialog', 51), array('div.character, div.dialog', 99), array('div.direction.dialog', 0), array('div.dialog.direction', 0), array('div.dialog.scene', 1), array('div.scene.scene', 1), array('div.scene .scene', 0), array('div.direction .dialog ', 0), array('div .dialog .direction', 4), array('div.dialog .dialog .direction', 4), array('#speech5', 1), array('div#speech5', 1), array('div #speech5', 1), array('div.scene div.dialog', 49), array('div#scene1 div.dialog div', 142), array('#scene1 #speech1', 1), array('div[class]', 103), array('div[class=dialog]', 50), array('div[class^=dia]', 51), array('div[class$=log]', 50), array('div[class*=sce]', 1), array('div[class|=dialog]', 50), // ? Seems right array('div[class!=madeup]', 243), // ? Seems right array('div[class~=dialog]', 51), // ? Seems right ); } }
IUQOL/Capacitation
vendor/symfony/symfony/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php
PHP
mit
17,224
//>>built define("dojo/data/ItemFileReadStore", ["../_base/kernel", "../_base/lang", "../_base/declare", "../_base/array", "../_base/xhr", "../Evented", "../_base/window", "./util/filter", "./util/simpleFetch", "../date/stamp" ], function(kernel, lang, declare, array, xhr, Evented, window, filterUtil, simpleFetch, dateStamp) { // module: // dojo/data/ItemFileReadStore // summary: // TODOC var ItemFileReadStore = declare("dojo.data.ItemFileReadStore", [Evented],{ // summary: // The ItemFileReadStore implements the dojo.data.api.Read API and reads // data from JSON files that have contents in this format -- // { items: [ // { name:'Kermit', color:'green', age:12, friends:['Gonzo', {_reference:{name:'Fozzie Bear'}}]}, // { name:'Fozzie Bear', wears:['hat', 'tie']}, // { name:'Miss Piggy', pets:'Foo-Foo'} // ]} // Note that it can also contain an 'identifer' property that specified which attribute on the items // in the array of items that acts as the unique identifier for that item. // constructor: function(/* Object */ keywordParameters){ // summary: constructor // keywordParameters: {url: String} // keywordParameters: {data: jsonObject} // keywordParameters: {typeMap: object) // The structure of the typeMap object is as follows: // { // type0: function || object, // type1: function || object, // ... // typeN: function || object // } // Where if it is a function, it is assumed to be an object constructor that takes the // value of _value as the initialization parameters. If it is an object, then it is assumed // to be an object of general form: // { // type: function, //constructor. // deserialize: function(value) //The function that parses the value and constructs the object defined by type appropriately. // } this._arrayOfAllItems = []; this._arrayOfTopLevelItems = []; this._loadFinished = false; this._jsonFileUrl = keywordParameters.url; this._ccUrl = keywordParameters.url; this.url = keywordParameters.url; this._jsonData = keywordParameters.data; this.data = null; this._datatypeMap = keywordParameters.typeMap || {}; if(!this._datatypeMap['Date']){ //If no default mapping for dates, then set this as default. //We use the dojo.date.stamp here because the ISO format is the 'dojo way' //of generically representing dates. this._datatypeMap['Date'] = { type: Date, deserialize: function(value){ return dateStamp.fromISOString(value); } }; } this._features = {'dojo.data.api.Read':true, 'dojo.data.api.Identity':true}; this._itemsByIdentity = null; this._storeRefPropName = "_S"; // Default name for the store reference to attach to every item. this._itemNumPropName = "_0"; // Default Item Id for isItem to attach to every item. this._rootItemPropName = "_RI"; // Default Item Id for isItem to attach to every item. this._reverseRefMap = "_RRM"; // Default attribute for constructing a reverse reference map for use with reference integrity this._loadInProgress = false; //Got to track the initial load to prevent duelling loads of the dataset. this._queuedFetches = []; if(keywordParameters.urlPreventCache !== undefined){ this.urlPreventCache = keywordParameters.urlPreventCache?true:false; } if(keywordParameters.hierarchical !== undefined){ this.hierarchical = keywordParameters.hierarchical?true:false; } if(keywordParameters.clearOnClose){ this.clearOnClose = true; } if("failOk" in keywordParameters){ this.failOk = keywordParameters.failOk?true:false; } }, url: "", // use "" rather than undefined for the benefit of the parser (#3539) //Internal var, crossCheckUrl. Used so that setting either url or _jsonFileUrl, can still trigger a reload //when clearOnClose and close is used. _ccUrl: "", data: null, // define this so that the parser can populate it typeMap: null, //Define so parser can populate. //Parameter to allow users to specify if a close call should force a reload or not. //By default, it retains the old behavior of not clearing if close is called. But //if set true, the store will be reset to default state. Note that by doing this, //all item handles will become invalid and a new fetch must be issued. clearOnClose: false, //Parameter to allow specifying if preventCache should be passed to the xhrGet call or not when loading data from a url. //Note this does not mean the store calls the server on each fetch, only that the data load has preventCache set as an option. //Added for tracker: #6072 urlPreventCache: false, //Parameter for specifying that it is OK for the xhrGet call to fail silently. failOk: false, //Parameter to indicate to process data from the url as hierarchical //(data items can contain other data items in js form). Default is true //for backwards compatibility. False means only root items are processed //as items, all child objects outside of type-mapped objects and those in //specific reference format, are left straight JS data objects. hierarchical: true, _assertIsItem: function(/* item */ item){ // summary: // This function tests whether the item passed in is indeed an item in the store. // item: // The item to test for being contained by the store. if(!this.isItem(item)){ throw new Error("dojo.data.ItemFileReadStore: Invalid item argument."); } }, _assertIsAttribute: function(/* attribute-name-string */ attribute){ // summary: // This function tests whether the item passed in is indeed a valid 'attribute' like type for the store. // attribute: // The attribute to test for being contained by the store. if(typeof attribute !== "string"){ throw new Error("dojo.data.ItemFileReadStore: Invalid attribute argument."); } }, getValue: function( /* item */ item, /* attribute-name-string */ attribute, /* value? */ defaultValue){ // summary: // See dojo.data.api.Read.getValue() var values = this.getValues(item, attribute); return (values.length > 0)?values[0]:defaultValue; // mixed }, getValues: function(/* item */ item, /* attribute-name-string */ attribute){ // summary: // See dojo.data.api.Read.getValues() this._assertIsItem(item); this._assertIsAttribute(attribute); // Clone it before returning. refs: #10474 return (item[attribute] || []).slice(0); // Array }, getAttributes: function(/* item */ item){ // summary: // See dojo.data.api.Read.getAttributes() this._assertIsItem(item); var attributes = []; for(var key in item){ // Save off only the real item attributes, not the special id marks for O(1) isItem. if((key !== this._storeRefPropName) && (key !== this._itemNumPropName) && (key !== this._rootItemPropName) && (key !== this._reverseRefMap)){ attributes.push(key); } } return attributes; // Array }, hasAttribute: function( /* item */ item, /* attribute-name-string */ attribute){ // summary: // See dojo.data.api.Read.hasAttribute() this._assertIsItem(item); this._assertIsAttribute(attribute); return (attribute in item); }, containsValue: function(/* item */ item, /* attribute-name-string */ attribute, /* anything */ value){ // summary: // See dojo.data.api.Read.containsValue() var regexp = undefined; if(typeof value === "string"){ regexp = filterUtil.patternToRegExp(value, false); } return this._containsValue(item, attribute, value, regexp); //boolean. }, _containsValue: function( /* item */ item, /* attribute-name-string */ attribute, /* anything */ value, /* RegExp?*/ regexp){ // summary: // Internal function for looking at the values contained by the item. // description: // Internal function for looking at the values contained by the item. This // function allows for denoting if the comparison should be case sensitive for // strings or not (for handling filtering cases where string case should not matter) // // item: // The data item to examine for attribute values. // attribute: // The attribute to inspect. // value: // The value to match. // regexp: // Optional regular expression generated off value if value was of string type to handle wildcarding. // If present and attribute values are string, then it can be used for comparison instead of 'value' return array.some(this.getValues(item, attribute), function(possibleValue){ if(possibleValue !== null && !lang.isObject(possibleValue) && regexp){ if(possibleValue.toString().match(regexp)){ return true; // Boolean } }else if(value === possibleValue){ return true; // Boolean } }); }, isItem: function(/* anything */ something){ // summary: // See dojo.data.api.Read.isItem() if(something && something[this._storeRefPropName] === this){ if(this._arrayOfAllItems[something[this._itemNumPropName]] === something){ return true; } } return false; // Boolean }, isItemLoaded: function(/* anything */ something){ // summary: // See dojo.data.api.Read.isItemLoaded() return this.isItem(something); //boolean }, loadItem: function(/* object */ keywordArgs){ // summary: // See dojo.data.api.Read.loadItem() this._assertIsItem(keywordArgs.item); }, getFeatures: function(){ // summary: // See dojo.data.api.Read.getFeatures() return this._features; //Object }, getLabel: function(/* item */ item){ // summary: // See dojo.data.api.Read.getLabel() if(this._labelAttr && this.isItem(item)){ return this.getValue(item,this._labelAttr); //String } return undefined; //undefined }, getLabelAttributes: function(/* item */ item){ // summary: // See dojo.data.api.Read.getLabelAttributes() if(this._labelAttr){ return [this._labelAttr]; //array } return null; //null }, _fetchItems: function( /* Object */ keywordArgs, /* Function */ findCallback, /* Function */ errorCallback){ // summary: // See dojo.data.util.simpleFetch.fetch() var self = this, filter = function(requestArgs, arrayOfItems){ var items = [], i, key; if(requestArgs.query){ var value, ignoreCase = requestArgs.queryOptions ? requestArgs.queryOptions.ignoreCase : false; //See if there are any string values that can be regexp parsed first to avoid multiple regexp gens on the //same value for each item examined. Much more efficient. var regexpList = {}; for(key in requestArgs.query){ value = requestArgs.query[key]; if(typeof value === "string"){ regexpList[key] = filterUtil.patternToRegExp(value, ignoreCase); }else if(value instanceof RegExp){ regexpList[key] = value; } } for(i = 0; i < arrayOfItems.length; ++i){ var match = true; var candidateItem = arrayOfItems[i]; if(candidateItem === null){ match = false; }else{ for(key in requestArgs.query){ value = requestArgs.query[key]; if(!self._containsValue(candidateItem, key, value, regexpList[key])){ match = false; } } } if(match){ items.push(candidateItem); } } findCallback(items, requestArgs); }else{ // We want a copy to pass back in case the parent wishes to sort the array. // We shouldn't allow resort of the internal list, so that multiple callers // can get lists and sort without affecting each other. We also need to // filter out any null values that have been left as a result of deleteItem() // calls in ItemFileWriteStore. for(i = 0; i < arrayOfItems.length; ++i){ var item = arrayOfItems[i]; if(item !== null){ items.push(item); } } findCallback(items, requestArgs); } }; if(this._loadFinished){ filter(keywordArgs, this._getItemsArray(keywordArgs.queryOptions)); }else{ //Do a check on the JsonFileUrl and crosscheck it. //If it doesn't match the cross-check, it needs to be updated //This allows for either url or _jsonFileUrl to he changed to //reset the store load location. Done this way for backwards //compatibility. People use _jsonFileUrl (even though officially //private. if(this._jsonFileUrl !== this._ccUrl){ kernel.deprecated("dojo.data.ItemFileReadStore: ", "To change the url, set the url property of the store," + " not _jsonFileUrl. _jsonFileUrl support will be removed in 2.0"); this._ccUrl = this._jsonFileUrl; this.url = this._jsonFileUrl; }else if(this.url !== this._ccUrl){ this._jsonFileUrl = this.url; this._ccUrl = this.url; } //See if there was any forced reset of data. if(this.data != null){ this._jsonData = this.data; this.data = null; } if(this._jsonFileUrl){ //If fetches come in before the loading has finished, but while //a load is in progress, we have to defer the fetching to be //invoked in the callback. if(this._loadInProgress){ this._queuedFetches.push({args: keywordArgs, filter: filter}); }else{ this._loadInProgress = true; var getArgs = { url: self._jsonFileUrl, handleAs: "json-comment-optional", preventCache: this.urlPreventCache, failOk: this.failOk }; var getHandler = xhr.get(getArgs); getHandler.addCallback(function(data){ try{ self._getItemsFromLoadedData(data); self._loadFinished = true; self._loadInProgress = false; filter(keywordArgs, self._getItemsArray(keywordArgs.queryOptions)); self._handleQueuedFetches(); }catch(e){ self._loadFinished = true; self._loadInProgress = false; errorCallback(e, keywordArgs); } }); getHandler.addErrback(function(error){ self._loadInProgress = false; errorCallback(error, keywordArgs); }); //Wire up the cancel to abort of the request //This call cancel on the deferred if it hasn't been called //yet and then will chain to the simple abort of the //simpleFetch keywordArgs var oldAbort = null; if(keywordArgs.abort){ oldAbort = keywordArgs.abort; } keywordArgs.abort = function(){ var df = getHandler; if(df && df.fired === -1){ df.cancel(); df = null; } if(oldAbort){ oldAbort.call(keywordArgs); } }; } }else if(this._jsonData){ try{ this._loadFinished = true; this._getItemsFromLoadedData(this._jsonData); this._jsonData = null; filter(keywordArgs, this._getItemsArray(keywordArgs.queryOptions)); }catch(e){ errorCallback(e, keywordArgs); } }else{ errorCallback(new Error("dojo.data.ItemFileReadStore: No JSON source data was provided as either URL or a nested Javascript object."), keywordArgs); } } }, _handleQueuedFetches: function(){ // summary: // Internal function to execute delayed request in the store. //Execute any deferred fetches now. if(this._queuedFetches.length > 0){ for(var i = 0; i < this._queuedFetches.length; i++){ var fData = this._queuedFetches[i], delayedQuery = fData.args, delayedFilter = fData.filter; if(delayedFilter){ delayedFilter(delayedQuery, this._getItemsArray(delayedQuery.queryOptions)); }else{ this.fetchItemByIdentity(delayedQuery); } } this._queuedFetches = []; } }, _getItemsArray: function(/*object?*/queryOptions){ // summary: // Internal function to determine which list of items to search over. // queryOptions: The query options parameter, if any. if(queryOptions && queryOptions.deep){ return this._arrayOfAllItems; } return this._arrayOfTopLevelItems; }, close: function(/*dojo.data.api.Request || keywordArgs || null */ request){ // summary: // See dojo.data.api.Read.close() if(this.clearOnClose && this._loadFinished && !this._loadInProgress){ //Reset all internalsback to default state. This will force a reload //on next fetch. This also checks that the data or url param was set //so that the store knows it can get data. Without one of those being set, //the next fetch will trigger an error. if(((this._jsonFileUrl == "" || this._jsonFileUrl == null) && (this.url == "" || this.url == null) ) && this.data == null){ console.debug("dojo.data.ItemFileReadStore: WARNING! Data reload " + " information has not been provided." + " Please set 'url' or 'data' to the appropriate value before" + " the next fetch"); } this._arrayOfAllItems = []; this._arrayOfTopLevelItems = []; this._loadFinished = false; this._itemsByIdentity = null; this._loadInProgress = false; this._queuedFetches = []; } }, _getItemsFromLoadedData: function(/* Object */ dataObject){ // summary: // Function to parse the loaded data into item format and build the internal items array. // description: // Function to parse the loaded data into item format and build the internal items array. // // dataObject: // The JS data object containing the raw data to convery into item format. // // returns: array // Array of items in store item format. // First, we define a couple little utility functions... var addingArrays = false, self = this; function valueIsAnItem(/* anything */ aValue){ // summary: // Given any sort of value that could be in the raw json data, // return true if we should interpret the value as being an // item itself, rather than a literal value or a reference. // example: // | false == valueIsAnItem("Kermit"); // | false == valueIsAnItem(42); // | false == valueIsAnItem(new Date()); // | false == valueIsAnItem({_type:'Date', _value:'1802-05-14'}); // | false == valueIsAnItem({_reference:'Kermit'}); // | true == valueIsAnItem({name:'Kermit', color:'green'}); // | true == valueIsAnItem({iggy:'pop'}); // | true == valueIsAnItem({foo:42}); return (aValue !== null) && (typeof aValue === "object") && (!lang.isArray(aValue) || addingArrays) && (!lang.isFunction(aValue)) && (aValue.constructor == Object || lang.isArray(aValue)) && (typeof aValue._reference === "undefined") && (typeof aValue._type === "undefined") && (typeof aValue._value === "undefined") && self.hierarchical; } function addItemAndSubItemsToArrayOfAllItems(/* Item */ anItem){ self._arrayOfAllItems.push(anItem); for(var attribute in anItem){ var valueForAttribute = anItem[attribute]; if(valueForAttribute){ if(lang.isArray(valueForAttribute)){ var valueArray = valueForAttribute; for(var k = 0; k < valueArray.length; ++k){ var singleValue = valueArray[k]; if(valueIsAnItem(singleValue)){ addItemAndSubItemsToArrayOfAllItems(singleValue); } } }else{ if(valueIsAnItem(valueForAttribute)){ addItemAndSubItemsToArrayOfAllItems(valueForAttribute); } } } } } this._labelAttr = dataObject.label; // We need to do some transformations to convert the data structure // that we read from the file into a format that will be convenient // to work with in memory. // Step 1: Walk through the object hierarchy and build a list of all items var i, item; this._arrayOfAllItems = []; this._arrayOfTopLevelItems = dataObject.items; for(i = 0; i < this._arrayOfTopLevelItems.length; ++i){ item = this._arrayOfTopLevelItems[i]; if(lang.isArray(item)){ addingArrays = true; } addItemAndSubItemsToArrayOfAllItems(item); item[this._rootItemPropName]=true; } // Step 2: Walk through all the attribute values of all the items, // and replace single values with arrays. For example, we change this: // { name:'Miss Piggy', pets:'Foo-Foo'} // into this: // { name:['Miss Piggy'], pets:['Foo-Foo']} // // We also store the attribute names so we can validate our store // reference and item id special properties for the O(1) isItem var allAttributeNames = {}, key; for(i = 0; i < this._arrayOfAllItems.length; ++i){ item = this._arrayOfAllItems[i]; for(key in item){ if(key !== this._rootItemPropName){ var value = item[key]; if(value !== null){ if(!lang.isArray(value)){ item[key] = [value]; } }else{ item[key] = [null]; } } allAttributeNames[key]=key; } } // Step 3: Build unique property names to use for the _storeRefPropName and _itemNumPropName // This should go really fast, it will generally never even run the loop. while(allAttributeNames[this._storeRefPropName]){ this._storeRefPropName += "_"; } while(allAttributeNames[this._itemNumPropName]){ this._itemNumPropName += "_"; } while(allAttributeNames[this._reverseRefMap]){ this._reverseRefMap += "_"; } // Step 4: Some data files specify an optional 'identifier', which is // the name of an attribute that holds the identity of each item. // If this data file specified an identifier attribute, then build a // hash table of items keyed by the identity of the items. var arrayOfValues; var identifier = dataObject.identifier; if(identifier){ this._itemsByIdentity = {}; this._features['dojo.data.api.Identity'] = identifier; for(i = 0; i < this._arrayOfAllItems.length; ++i){ item = this._arrayOfAllItems[i]; arrayOfValues = item[identifier]; var identity = arrayOfValues[0]; if(!Object.hasOwnProperty.call(this._itemsByIdentity, identity)){ this._itemsByIdentity[identity] = item; }else{ if(this._jsonFileUrl){ throw new Error("dojo.data.ItemFileReadStore: The json data as specified by: [" + this._jsonFileUrl + "] is malformed. Items within the list have identifier: [" + identifier + "]. Value collided: [" + identity + "]"); }else if(this._jsonData){ throw new Error("dojo.data.ItemFileReadStore: The json data provided by the creation arguments is malformed. Items within the list have identifier: [" + identifier + "]. Value collided: [" + identity + "]"); } } } }else{ this._features['dojo.data.api.Identity'] = Number; } // Step 5: Walk through all the items, and set each item's properties // for _storeRefPropName and _itemNumPropName, so that store.isItem() will return true. for(i = 0; i < this._arrayOfAllItems.length; ++i){ item = this._arrayOfAllItems[i]; item[this._storeRefPropName] = this; item[this._itemNumPropName] = i; } // Step 6: We walk through all the attribute values of all the items, // looking for type/value literals and item-references. // // We replace item-references with pointers to items. For example, we change: // { name:['Kermit'], friends:[{_reference:{name:'Miss Piggy'}}] } // into this: // { name:['Kermit'], friends:[miss_piggy] } // (where miss_piggy is the object representing the 'Miss Piggy' item). // // We replace type/value pairs with typed-literals. For example, we change: // { name:['Nelson Mandela'], born:[{_type:'Date', _value:'1918-07-18'}] } // into this: // { name:['Kermit'], born:(new Date(1918, 6, 18)) } // // We also generate the associate map for all items for the O(1) isItem function. for(i = 0; i < this._arrayOfAllItems.length; ++i){ item = this._arrayOfAllItems[i]; // example: { name:['Kermit'], friends:[{_reference:{name:'Miss Piggy'}}] } for(key in item){ arrayOfValues = item[key]; // example: [{_reference:{name:'Miss Piggy'}}] for(var j = 0; j < arrayOfValues.length; ++j){ value = arrayOfValues[j]; // example: {_reference:{name:'Miss Piggy'}} if(value !== null && typeof value == "object"){ if(("_type" in value) && ("_value" in value)){ var type = value._type; // examples: 'Date', 'Color', or 'ComplexNumber' var mappingObj = this._datatypeMap[type]; // examples: Date, dojo.Color, foo.math.ComplexNumber, {type: dojo.Color, deserialize(value){ return new dojo.Color(value)}} if(!mappingObj){ throw new Error("dojo.data.ItemFileReadStore: in the typeMap constructor arg, no object class was specified for the datatype '" + type + "'"); }else if(lang.isFunction(mappingObj)){ arrayOfValues[j] = new mappingObj(value._value); }else if(lang.isFunction(mappingObj.deserialize)){ arrayOfValues[j] = mappingObj.deserialize(value._value); }else{ throw new Error("dojo.data.ItemFileReadStore: Value provided in typeMap was neither a constructor, nor a an object with a deserialize function"); } } if(value._reference){ var referenceDescription = value._reference; // example: {name:'Miss Piggy'} if(!lang.isObject(referenceDescription)){ // example: 'Miss Piggy' // from an item like: { name:['Kermit'], friends:[{_reference:'Miss Piggy'}]} arrayOfValues[j] = this._getItemByIdentity(referenceDescription); }else{ // example: {name:'Miss Piggy'} // from an item like: { name:['Kermit'], friends:[{_reference:{name:'Miss Piggy'}}] } for(var k = 0; k < this._arrayOfAllItems.length; ++k){ var candidateItem = this._arrayOfAllItems[k], found = true; for(var refKey in referenceDescription){ if(candidateItem[refKey] != referenceDescription[refKey]){ found = false; } } if(found){ arrayOfValues[j] = candidateItem; } } } if(this.referenceIntegrity){ var refItem = arrayOfValues[j]; if(this.isItem(refItem)){ this._addReferenceToMap(refItem, item, key); } } }else if(this.isItem(value)){ //It's a child item (not one referenced through _reference). //We need to treat this as a referenced item, so it can be cleaned up //in a write store easily. if(this.referenceIntegrity){ this._addReferenceToMap(value, item, key); } } } } } } }, _addReferenceToMap: function(/*item*/ refItem, /*item*/ parentItem, /*string*/ attribute){ // summary: // Method to add an reference map entry for an item and attribute. // description: // Method to add an reference map entry for an item and attribute. // // refItem: // The item that is referenced. // parentItem: // The item that holds the new reference to refItem. // attribute: // The attribute on parentItem that contains the new reference. //Stub function, does nothing. Real processing is in ItemFileWriteStore. }, getIdentity: function(/* item */ item){ // summary: // See dojo.data.api.Identity.getIdentity() var identifier = this._features['dojo.data.api.Identity']; if(identifier === Number){ return item[this._itemNumPropName]; // Number }else{ var arrayOfValues = item[identifier]; if(arrayOfValues){ return arrayOfValues[0]; // Object || String } } return null; // null }, fetchItemByIdentity: function(/* Object */ keywordArgs){ // summary: // See dojo.data.api.Identity.fetchItemByIdentity() // Hasn't loaded yet, we have to trigger the load. var item, scope; if(!this._loadFinished){ var self = this; //Do a check on the JsonFileUrl and crosscheck it. //If it doesn't match the cross-check, it needs to be updated //This allows for either url or _jsonFileUrl to he changed to //reset the store load location. Done this way for backwards //compatibility. People use _jsonFileUrl (even though officially //private. if(this._jsonFileUrl !== this._ccUrl){ kernel.deprecated("dojo.data.ItemFileReadStore: ", "To change the url, set the url property of the store," + " not _jsonFileUrl. _jsonFileUrl support will be removed in 2.0"); this._ccUrl = this._jsonFileUrl; this.url = this._jsonFileUrl; }else if(this.url !== this._ccUrl){ this._jsonFileUrl = this.url; this._ccUrl = this.url; } //See if there was any forced reset of data. if(this.data != null && this._jsonData == null){ this._jsonData = this.data; this.data = null; } if(this._jsonFileUrl){ if(this._loadInProgress){ this._queuedFetches.push({args: keywordArgs}); }else{ this._loadInProgress = true; var getArgs = { url: self._jsonFileUrl, handleAs: "json-comment-optional", preventCache: this.urlPreventCache, failOk: this.failOk }; var getHandler = xhr.get(getArgs); getHandler.addCallback(function(data){ var scope = keywordArgs.scope?keywordArgs.scope:window.global; try{ self._getItemsFromLoadedData(data); self._loadFinished = true; self._loadInProgress = false; item = self._getItemByIdentity(keywordArgs.identity); if(keywordArgs.onItem){ keywordArgs.onItem.call(scope, item); } self._handleQueuedFetches(); }catch(error){ self._loadInProgress = false; if(keywordArgs.onError){ keywordArgs.onError.call(scope, error); } } }); getHandler.addErrback(function(error){ self._loadInProgress = false; if(keywordArgs.onError){ var scope = keywordArgs.scope?keywordArgs.scope:window.global; keywordArgs.onError.call(scope, error); } }); } }else if(this._jsonData){ // Passed in data, no need to xhr. self._getItemsFromLoadedData(self._jsonData); self._jsonData = null; self._loadFinished = true; item = self._getItemByIdentity(keywordArgs.identity); if(keywordArgs.onItem){ scope = keywordArgs.scope?keywordArgs.scope:window.global; keywordArgs.onItem.call(scope, item); } } }else{ // Already loaded. We can just look it up and call back. item = this._getItemByIdentity(keywordArgs.identity); if(keywordArgs.onItem){ scope = keywordArgs.scope?keywordArgs.scope:window.global; keywordArgs.onItem.call(scope, item); } } }, _getItemByIdentity: function(/* Object */ identity){ // summary: // Internal function to look an item up by its identity map. var item = null; if(this._itemsByIdentity){ // If this map is defined, we need to just try to get it. If it fails // the item does not exist. if(Object.hasOwnProperty.call(this._itemsByIdentity, identity)){ item = this._itemsByIdentity[identity]; } }else if (Object.hasOwnProperty.call(this._arrayOfAllItems, identity)){ item = this._arrayOfAllItems[identity]; } if(item === undefined){ item = null; } return item; // Object }, getIdentityAttributes: function(/* item */ item){ // summary: // See dojo.data.api.Identity.getIdentityAttributes() var identifier = this._features['dojo.data.api.Identity']; if(identifier === Number){ // If (identifier === Number) it means getIdentity() just returns // an integer item-number for each item. The dojo.data.api.Identity // spec says we need to return null if the identity is not composed // of attributes return null; // null }else{ return [identifier]; // Array } }, _forceLoad: function(){ // summary: // Internal function to force a load of the store if it hasn't occurred yet. This is required // for specific functions to work properly. var self = this; //Do a check on the JsonFileUrl and crosscheck it. //If it doesn't match the cross-check, it needs to be updated //This allows for either url or _jsonFileUrl to he changed to //reset the store load location. Done this way for backwards //compatibility. People use _jsonFileUrl (even though officially //private. if(this._jsonFileUrl !== this._ccUrl){ kernel.deprecated("dojo.data.ItemFileReadStore: ", "To change the url, set the url property of the store," + " not _jsonFileUrl. _jsonFileUrl support will be removed in 2.0"); this._ccUrl = this._jsonFileUrl; this.url = this._jsonFileUrl; }else if(this.url !== this._ccUrl){ this._jsonFileUrl = this.url; this._ccUrl = this.url; } //See if there was any forced reset of data. if(this.data != null){ this._jsonData = this.data; this.data = null; } if(this._jsonFileUrl){ var getArgs = { url: this._jsonFileUrl, handleAs: "json-comment-optional", preventCache: this.urlPreventCache, failOk: this.failOk, sync: true }; var getHandler = xhr.get(getArgs); getHandler.addCallback(function(data){ try{ //Check to be sure there wasn't another load going on concurrently //So we don't clobber data that comes in on it. If there is a load going on //then do not save this data. It will potentially clobber current data. //We mainly wanted to sync/wait here. //TODO: Revisit the loading scheme of this store to improve multi-initial //request handling. if(self._loadInProgress !== true && !self._loadFinished){ self._getItemsFromLoadedData(data); self._loadFinished = true; }else if(self._loadInProgress){ //Okay, we hit an error state we can't recover from. A forced load occurred //while an async load was occurring. Since we cannot block at this point, the best //that can be managed is to throw an error. throw new Error("dojo.data.ItemFileReadStore: Unable to perform a synchronous load, an async load is in progress."); } }catch(e){ console.log(e); throw e; } }); getHandler.addErrback(function(error){ throw error; }); }else if(this._jsonData){ self._getItemsFromLoadedData(self._jsonData); self._jsonData = null; self._loadFinished = true; } } }); //Mix in the simple fetch implementation to this class. lang.extend(ItemFileReadStore,simpleFetch); return ItemFileReadStore; });
hanbyul-here/cdnjs
ajax/libs/dojo/1.7.1/data/ItemFileReadStore.js.uncompressed.js
JavaScript
mit
33,856
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/model-list/model-list.js']) { __coverage__['build/model-list/model-list.js'] = {"path":"build/model-list/model-list.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0,"139":0,"140":0,"141":0,"142":0,"143":0,"144":0,"145":0,"146":0,"147":0,"148":0,"149":0,"150":0,"151":0,"152":0,"153":0,"154":0,"155":0,"156":0,"157":0,"158":0,"159":0,"160":0,"161":0,"162":0,"163":0,"164":0,"165":0,"166":0,"167":0,"168":0,"169":0,"170":0,"171":0,"172":0,"173":0,"174":0,"175":0,"176":0,"177":0,"178":0,"179":0,"180":0,"181":0,"182":0,"183":0,"184":0,"185":0,"186":0,"187":0,"188":0,"189":0,"190":0,"191":0,"192":0,"193":0,"194":0,"195":0,"196":0,"197":0,"198":0,"199":0,"200":0,"201":0,"202":0,"203":0,"204":0,"205":0,"206":0,"207":0,"208":0,"209":0,"210":0,"211":0,"212":0,"213":0,"214":0,"215":0,"216":0,"217":0,"218":0,"219":0,"220":0,"221":0,"222":0,"223":0,"224":0,"225":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0],"32":[0,0],"33":[0,0],"34":[0,0],"35":[0,0],"36":[0,0],"37":[0,0],"38":[0,0],"39":[0,0],"40":[0,0],"41":[0,0],"42":[0,0],"43":[0,0],"44":[0,0],"45":[0,0],"46":[0,0],"47":[0,0],"48":[0,0],"49":[0,0],"50":[0,0],"51":[0,0],"52":[0,0],"53":[0,0,0],"54":[0,0],"55":[0,0],"56":[0,0],"57":[0,0],"58":[0,0],"59":[0,0],"60":[0,0],"61":[0,0],"62":[0,0],"63":[0,0],"64":[0,0],"65":[0,0],"66":[0,0],"67":[0,0],"68":[0,0],"69":[0,0],"70":[0,0],"71":[0,0],"72":[0,0],"73":[0,0],"74":[0,0],"75":[0,0],"76":[0,0],"77":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":41}}},"2":{"name":"ModelList","line":137,"loc":{"start":{"line":137,"column":0},"end":{"line":137,"column":21}}},"3":{"name":"(anonymous_3)","line":177,"loc":{"start":{"line":177,"column":17},"end":{"line":177,"column":35}}},"4":{"name":"(anonymous_4)","line":204,"loc":{"start":{"line":204,"column":16},"end":{"line":204,"column":28}}},"5":{"name":"(anonymous_5)","line":250,"loc":{"start":{"line":250,"column":9},"end":{"line":250,"column":36}}},"6":{"name":"(anonymous_6)","line":254,"loc":{"start":{"line":254,"column":66},"end":{"line":254,"column":90}}},"7":{"name":"(anonymous_7)","line":315,"loc":{"start":{"line":315,"column":12},"end":{"line":315,"column":48}}},"8":{"name":"(anonymous_8)","line":334,"loc":{"start":{"line":334,"column":35},"end":{"line":334,"column":50}}},"9":{"name":"(anonymous_9)","line":365,"loc":{"start":{"line":365,"column":10},"end":{"line":365,"column":39}}},"10":{"name":"(anonymous_10)","line":415,"loc":{"start":{"line":415,"column":12},"end":{"line":415,"column":41}}},"11":{"name":"(anonymous_11)","line":457,"loc":{"start":{"line":457,"column":9},"end":{"line":457,"column":25}}},"12":{"name":"(anonymous_12)","line":479,"loc":{"start":{"line":479,"column":15},"end":{"line":479,"column":31}}},"13":{"name":"(anonymous_13)","line":500,"loc":{"start":{"line":500,"column":14},"end":{"line":500,"column":30}}},"14":{"name":"(anonymous_14)","line":515,"loc":{"start":{"line":515,"column":19},"end":{"line":515,"column":39}}},"15":{"name":"(anonymous_15)","line":530,"loc":{"start":{"line":530,"column":13},"end":{"line":530,"column":27}}},"16":{"name":"(anonymous_16)","line":544,"loc":{"start":{"line":544,"column":12},"end":{"line":544,"column":41}}},"17":{"name":"(anonymous_17)","line":582,"loc":{"start":{"line":582,"column":10},"end":{"line":582,"column":39}}},"18":{"name":"(anonymous_18)","line":593,"loc":{"start":{"line":593,"column":35},"end":{"line":593,"column":60}}},"19":{"name":"(anonymous_19)","line":640,"loc":{"start":{"line":640,"column":9},"end":{"line":640,"column":32}}},"20":{"name":"(anonymous_20)","line":662,"loc":{"start":{"line":662,"column":11},"end":{"line":662,"column":31}}},"21":{"name":"(anonymous_21)","line":697,"loc":{"start":{"line":697,"column":12},"end":{"line":697,"column":39}}},"22":{"name":"(anonymous_22)","line":704,"loc":{"start":{"line":704,"column":68},"end":{"line":704,"column":85}}},"23":{"name":"(anonymous_23)","line":712,"loc":{"start":{"line":712,"column":38},"end":{"line":712,"column":55}}},"24":{"name":"(anonymous_24)","line":742,"loc":{"start":{"line":742,"column":11},"end":{"line":742,"column":38}}},"25":{"name":"(anonymous_25)","line":751,"loc":{"start":{"line":751,"column":40},"end":{"line":751,"column":57}}},"26":{"name":"(anonymous_26)","line":794,"loc":{"start":{"line":794,"column":10},"end":{"line":794,"column":39}}},"27":{"name":"(anonymous_27)","line":826,"loc":{"start":{"line":826,"column":10},"end":{"line":826,"column":29}}},"28":{"name":"(anonymous_28)","line":882,"loc":{"start":{"line":882,"column":10},"end":{"line":882,"column":53}}},"29":{"name":"(anonymous_29)","line":896,"loc":{"start":{"line":896,"column":13},"end":{"line":896,"column":25}}},"30":{"name":"(anonymous_30)","line":911,"loc":{"start":{"line":911,"column":12},"end":{"line":911,"column":24}}},"31":{"name":"(anonymous_31)","line":912,"loc":{"start":{"line":912,"column":24},"end":{"line":912,"column":41}}},"32":{"name":"(anonymous_32)","line":934,"loc":{"start":{"line":934,"column":10},"end":{"line":934,"column":36}}},"33":{"name":"(anonymous_33)","line":978,"loc":{"start":{"line":978,"column":17},"end":{"line":978,"column":34}}},"34":{"name":"(anonymous_34)","line":991,"loc":{"start":{"line":991,"column":12},"end":{"line":991,"column":24}}},"35":{"name":"(anonymous_35)","line":1013,"loc":{"start":{"line":1013,"column":14},"end":{"line":1013,"column":30}}},"36":{"name":"(anonymous_36)","line":1024,"loc":{"start":{"line":1024,"column":17},"end":{"line":1024,"column":34}}},"37":{"name":"(anonymous_37)","line":1042,"loc":{"start":{"line":1042,"column":16},"end":{"line":1042,"column":33}}},"38":{"name":"(anonymous_38)","line":1084,"loc":{"start":{"line":1084,"column":12},"end":{"line":1084,"column":32}}},"39":{"name":"(anonymous_39)","line":1100,"loc":{"start":{"line":1100,"column":13},"end":{"line":1100,"column":39}}},"40":{"name":"(anonymous_40)","line":1150,"loc":{"start":{"line":1150,"column":11},"end":{"line":1150,"column":36}}},"41":{"name":"(anonymous_41)","line":1171,"loc":{"start":{"line":1171,"column":20},"end":{"line":1171,"column":33}}},"42":{"name":"(anonymous_42)","line":1206,"loc":{"start":{"line":1206,"column":15},"end":{"line":1206,"column":28}}},"43":{"name":"(anonymous_43)","line":1227,"loc":{"start":{"line":1227,"column":18},"end":{"line":1227,"column":31}}},"44":{"name":"(anonymous_44)","line":1248,"loc":{"start":{"line":1248,"column":17},"end":{"line":1248,"column":30}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":1269,"column":124}},"2":{"start":{"line":35,"column":0},"end":{"line":135,"column":24}},"3":{"start":{"line":137,"column":0},"end":{"line":139,"column":1}},"4":{"start":{"line":138,"column":4},"end":{"line":138,"column":60}},"5":{"start":{"line":141,"column":0},"end":{"line":1264,"column":3}},"6":{"start":{"line":178,"column":8},"end":{"line":178,"column":32}},"7":{"start":{"line":180,"column":8},"end":{"line":180,"column":60}},"8":{"start":{"line":182,"column":8},"end":{"line":189,"column":9}},"9":{"start":{"line":184,"column":12},"end":{"line":184,"column":64}},"10":{"start":{"line":186,"column":12},"end":{"line":188,"column":13}},"11":{"start":{"line":187,"column":16},"end":{"line":187,"column":70}},"12":{"start":{"line":191,"column":8},"end":{"line":191,"column":62}},"13":{"start":{"line":192,"column":8},"end":{"line":192,"column":64}},"14":{"start":{"line":193,"column":8},"end":{"line":193,"column":65}},"15":{"start":{"line":195,"column":8},"end":{"line":195,"column":54}},"16":{"start":{"line":197,"column":8},"end":{"line":197,"column":22}},"17":{"start":{"line":199,"column":8},"end":{"line":201,"column":9}},"18":{"start":{"line":200,"column":12},"end":{"line":200,"column":51}},"19":{"start":{"line":205,"column":8},"end":{"line":205,"column":22}},"20":{"start":{"line":251,"column":8},"end":{"line":251,"column":44}},"21":{"start":{"line":253,"column":8},"end":{"line":270,"column":9}},"22":{"start":{"line":254,"column":12},"end":{"line":267,"column":21}},"23":{"start":{"line":255,"column":16},"end":{"line":255,"column":49}},"24":{"start":{"line":260,"column":16},"end":{"line":264,"column":17}},"25":{"start":{"line":261,"column":20},"end":{"line":263,"column":23}},"26":{"start":{"line":266,"column":16},"end":{"line":266,"column":54}},"27":{"start":{"line":269,"column":12},"end":{"line":269,"column":46}},"28":{"start":{"line":316,"column":8},"end":{"line":316,"column":24}},"29":{"start":{"line":319,"column":8},"end":{"line":322,"column":9}},"30":{"start":{"line":320,"column":12},"end":{"line":320,"column":31}},"31":{"start":{"line":321,"column":12},"end":{"line":321,"column":26}},"32":{"start":{"line":324,"column":8},"end":{"line":324,"column":34}},"33":{"start":{"line":326,"column":8},"end":{"line":328,"column":9}},"34":{"start":{"line":327,"column":12},"end":{"line":327,"column":42}},"35":{"start":{"line":330,"column":8},"end":{"line":332,"column":12}},"36":{"start":{"line":334,"column":8},"end":{"line":342,"column":11}},"37":{"start":{"line":335,"column":12},"end":{"line":337,"column":13}},"38":{"start":{"line":336,"column":16},"end":{"line":336,"column":41}},"39":{"start":{"line":339,"column":12},"end":{"line":341,"column":13}},"40":{"start":{"line":340,"column":16},"end":{"line":340,"column":48}},"41":{"start":{"line":366,"column":8},"end":{"line":367,"column":25}},"42":{"start":{"line":369,"column":8},"end":{"line":372,"column":9}},"43":{"start":{"line":370,"column":12},"end":{"line":370,"column":28}},"44":{"start":{"line":371,"column":12},"end":{"line":371,"column":58}},"45":{"start":{"line":374,"column":8},"end":{"line":374,"column":20}},"46":{"start":{"line":416,"column":8},"end":{"line":418,"column":31}},"47":{"start":{"line":421,"column":8},"end":{"line":424,"column":9}},"48":{"start":{"line":422,"column":12},"end":{"line":422,"column":31}},"49":{"start":{"line":423,"column":12},"end":{"line":423,"column":26}},"50":{"start":{"line":426,"column":8},"end":{"line":432,"column":9}},"51":{"start":{"line":427,"column":12},"end":{"line":427,"column":28}},"52":{"start":{"line":429,"column":12},"end":{"line":431,"column":13}},"53":{"start":{"line":430,"column":16},"end":{"line":430,"column":36}},"54":{"start":{"line":434,"column":8},"end":{"line":444,"column":9}},"55":{"start":{"line":435,"column":12},"end":{"line":435,"column":61}},"56":{"start":{"line":437,"column":12},"end":{"line":439,"column":13}},"57":{"start":{"line":438,"column":16},"end":{"line":438,"column":51}},"58":{"start":{"line":441,"column":12},"end":{"line":441,"column":24}},"59":{"start":{"line":443,"column":12},"end":{"line":443,"column":28}},"60":{"start":{"line":458,"column":8},"end":{"line":460,"column":9}},"61":{"start":{"line":459,"column":12},"end":{"line":459,"column":56}},"62":{"start":{"line":462,"column":8},"end":{"line":462,"column":40}},"63":{"start":{"line":480,"column":8},"end":{"line":482,"column":9}},"64":{"start":{"line":481,"column":12},"end":{"line":481,"column":71}},"65":{"start":{"line":484,"column":8},"end":{"line":484,"column":46}},"66":{"start":{"line":501,"column":8},"end":{"line":503,"column":9}},"67":{"start":{"line":502,"column":12},"end":{"line":502,"column":76}},"68":{"start":{"line":505,"column":8},"end":{"line":505,"column":45}},"69":{"start":{"line":516,"column":8},"end":{"line":516,"column":51}},"70":{"start":{"line":531,"column":8},"end":{"line":531,"column":39}},"71":{"start":{"line":545,"column":8},"end":{"line":545,"column":74}},"72":{"start":{"line":546,"column":8},"end":{"line":546,"column":49}},"73":{"start":{"line":583,"column":8},"end":{"line":583,"column":24}},"74":{"start":{"line":586,"column":8},"end":{"line":589,"column":9}},"75":{"start":{"line":587,"column":12},"end":{"line":587,"column":31}},"76":{"start":{"line":588,"column":12},"end":{"line":588,"column":26}},"77":{"start":{"line":591,"column":8},"end":{"line":591,"column":34}},"78":{"start":{"line":593,"column":8},"end":{"line":623,"column":11}},"79":{"start":{"line":594,"column":12},"end":{"line":599,"column":23}},"80":{"start":{"line":601,"column":12},"end":{"line":618,"column":13}},"81":{"start":{"line":602,"column":16},"end":{"line":602,"column":35}},"82":{"start":{"line":603,"column":16},"end":{"line":603,"column":38}},"83":{"start":{"line":605,"column":16},"end":{"line":605,"column":45}},"84":{"start":{"line":608,"column":16},"end":{"line":612,"column":17}},"85":{"start":{"line":609,"column":20},"end":{"line":611,"column":23}},"86":{"start":{"line":614,"column":16},"end":{"line":614,"column":63}},"87":{"start":{"line":616,"column":16},"end":{"line":616,"column":44}},"88":{"start":{"line":617,"column":16},"end":{"line":617,"column":44}},"89":{"start":{"line":620,"column":12},"end":{"line":622,"column":13}},"90":{"start":{"line":621,"column":16},"end":{"line":621,"column":48}},"91":{"start":{"line":625,"column":8},"end":{"line":625,"column":20}},"92":{"start":{"line":641,"column":8},"end":{"line":641,"column":52}},"93":{"start":{"line":663,"column":8},"end":{"line":675,"column":9}},"94":{"start":{"line":664,"column":12},"end":{"line":674,"column":13}},"95":{"start":{"line":665,"column":16},"end":{"line":665,"column":52}},"96":{"start":{"line":667,"column":16},"end":{"line":671,"column":19}},"97":{"start":{"line":673,"column":16},"end":{"line":673,"column":28}},"98":{"start":{"line":677,"column":8},"end":{"line":677,"column":30}},"99":{"start":{"line":698,"column":8},"end":{"line":698,"column":44}},"100":{"start":{"line":700,"column":8},"end":{"line":717,"column":9}},"101":{"start":{"line":704,"column":12},"end":{"line":710,"column":21}},"102":{"start":{"line":705,"column":16},"end":{"line":707,"column":17}},"103":{"start":{"line":706,"column":20},"end":{"line":706,"column":44}},"104":{"start":{"line":709,"column":16},"end":{"line":709,"column":29}},"105":{"start":{"line":712,"column":12},"end":{"line":714,"column":21}},"106":{"start":{"line":713,"column":16},"end":{"line":713,"column":52}},"107":{"start":{"line":716,"column":12},"end":{"line":716,"column":49}},"108":{"start":{"line":743,"column":8},"end":{"line":743,"column":34}},"109":{"start":{"line":744,"column":8},"end":{"line":744,"column":34}},"110":{"start":{"line":746,"column":8},"end":{"line":746,"column":54}},"111":{"start":{"line":748,"column":8},"end":{"line":754,"column":9}},"112":{"start":{"line":749,"column":12},"end":{"line":749,"column":38}},"113":{"start":{"line":751,"column":12},"end":{"line":753,"column":21}},"114":{"start":{"line":752,"column":16},"end":{"line":752,"column":73}},"115":{"start":{"line":756,"column":8},"end":{"line":756,"column":31}},"116":{"start":{"line":758,"column":8},"end":{"line":767,"column":9}},"117":{"start":{"line":759,"column":12},"end":{"line":759,"column":37}},"118":{"start":{"line":762,"column":12},"end":{"line":764,"column":13}},"119":{"start":{"line":763,"column":16},"end":{"line":763,"column":54}},"120":{"start":{"line":766,"column":12},"end":{"line":766,"column":41}},"121":{"start":{"line":769,"column":8},"end":{"line":769,"column":20}},"122":{"start":{"line":795,"column":8},"end":{"line":796,"column":25}},"123":{"start":{"line":798,"column":8},"end":{"line":804,"column":9}},"124":{"start":{"line":799,"column":12},"end":{"line":799,"column":28}},"125":{"start":{"line":801,"column":12},"end":{"line":803,"column":13}},"126":{"start":{"line":802,"column":16},"end":{"line":802,"column":28}},"127":{"start":{"line":806,"column":8},"end":{"line":806,"column":21}},"128":{"start":{"line":827,"column":8},"end":{"line":829,"column":9}},"129":{"start":{"line":828,"column":12},"end":{"line":828,"column":24}},"130":{"start":{"line":831,"column":8},"end":{"line":832,"column":19}},"131":{"start":{"line":834,"column":8},"end":{"line":834,"column":34}},"132":{"start":{"line":836,"column":8},"end":{"line":836,"column":56}},"133":{"start":{"line":838,"column":8},"end":{"line":841,"column":11}},"134":{"start":{"line":843,"column":8},"end":{"line":847,"column":9}},"135":{"start":{"line":844,"column":12},"end":{"line":844,"column":37}},"136":{"start":{"line":846,"column":12},"end":{"line":846,"column":41}},"137":{"start":{"line":849,"column":8},"end":{"line":849,"column":20}},"138":{"start":{"line":883,"column":8},"end":{"line":883,"column":56}},"139":{"start":{"line":885,"column":8},"end":{"line":887,"column":9}},"140":{"start":{"line":886,"column":12},"end":{"line":886,"column":23}},"141":{"start":{"line":897,"column":8},"end":{"line":897,"column":36}},"142":{"start":{"line":912,"column":8},"end":{"line":914,"column":11}},"143":{"start":{"line":913,"column":12},"end":{"line":913,"column":34}},"144":{"start":{"line":935,"column":8},"end":{"line":935,"column":23}},"145":{"start":{"line":937,"column":8},"end":{"line":937,"column":34}},"146":{"start":{"line":939,"column":8},"end":{"line":941,"column":9}},"147":{"start":{"line":940,"column":12},"end":{"line":940,"column":42}},"148":{"start":{"line":943,"column":8},"end":{"line":943,"column":29}},"149":{"start":{"line":945,"column":8},"end":{"line":955,"column":9}},"150":{"start":{"line":948,"column":12},"end":{"line":952,"column":15}},"151":{"start":{"line":954,"column":12},"end":{"line":954,"column":19}},"152":{"start":{"line":957,"column":8},"end":{"line":960,"column":11}},"153":{"start":{"line":962,"column":8},"end":{"line":966,"column":9}},"154":{"start":{"line":963,"column":12},"end":{"line":963,"column":35}},"155":{"start":{"line":965,"column":12},"end":{"line":965,"column":39}},"156":{"start":{"line":968,"column":8},"end":{"line":968,"column":21}},"157":{"start":{"line":980,"column":8},"end":{"line":980,"column":31}},"158":{"start":{"line":981,"column":8},"end":{"line":981,"column":30}},"159":{"start":{"line":992,"column":8},"end":{"line":992,"column":57}},"160":{"start":{"line":994,"column":8},"end":{"line":994,"column":31}},"161":{"start":{"line":995,"column":8},"end":{"line":995,"column":31}},"162":{"start":{"line":996,"column":8},"end":{"line":996,"column":31}},"163":{"start":{"line":1014,"column":8},"end":{"line":1014,"column":44}},"164":{"start":{"line":1025,"column":8},"end":{"line":1025,"column":54}},"165":{"start":{"line":1027,"column":8},"end":{"line":1030,"column":9}},"166":{"start":{"line":1028,"column":12},"end":{"line":1028,"column":41}},"167":{"start":{"line":1029,"column":12},"end":{"line":1029,"column":37}},"168":{"start":{"line":1043,"column":8},"end":{"line":1046,"column":33}},"169":{"start":{"line":1048,"column":8},"end":{"line":1050,"column":9}},"170":{"start":{"line":1049,"column":12},"end":{"line":1049,"column":23}},"171":{"start":{"line":1052,"column":8},"end":{"line":1052,"column":40}},"172":{"start":{"line":1056,"column":8},"end":{"line":1065,"column":9}},"173":{"start":{"line":1057,"column":12},"end":{"line":1057,"column":38}},"174":{"start":{"line":1058,"column":12},"end":{"line":1058,"column":35}},"175":{"start":{"line":1060,"column":12},"end":{"line":1064,"column":13}},"176":{"start":{"line":1061,"column":16},"end":{"line":1061,"column":33}},"177":{"start":{"line":1063,"column":16},"end":{"line":1063,"column":29}},"178":{"start":{"line":1067,"column":8},"end":{"line":1067,"column":19}},"179":{"start":{"line":1085,"column":8},"end":{"line":1085,"column":36}},"180":{"start":{"line":1101,"column":8},"end":{"line":1101,"column":26}},"181":{"start":{"line":1103,"column":8},"end":{"line":1103,"column":34}},"182":{"start":{"line":1105,"column":8},"end":{"line":1110,"column":9}},"183":{"start":{"line":1106,"column":12},"end":{"line":1106,"column":26}},"184":{"start":{"line":1107,"column":12},"end":{"line":1107,"column":37}},"185":{"start":{"line":1109,"column":12},"end":{"line":1109,"column":40}},"186":{"start":{"line":1112,"column":8},"end":{"line":1121,"column":9}},"187":{"start":{"line":1113,"column":12},"end":{"line":1118,"column":15}},"188":{"start":{"line":1120,"column":12},"end":{"line":1120,"column":19}},"189":{"start":{"line":1123,"column":8},"end":{"line":1126,"column":11}},"190":{"start":{"line":1128,"column":8},"end":{"line":1132,"column":9}},"191":{"start":{"line":1129,"column":12},"end":{"line":1129,"column":38}},"192":{"start":{"line":1131,"column":12},"end":{"line":1131,"column":42}},"193":{"start":{"line":1134,"column":8},"end":{"line":1134,"column":21}},"194":{"start":{"line":1151,"column":8},"end":{"line":1151,"column":75}},"195":{"start":{"line":1154,"column":8},"end":{"line":1156,"column":9}},"196":{"start":{"line":1155,"column":12},"end":{"line":1155,"column":26}},"197":{"start":{"line":1159,"column":8},"end":{"line":1159,"column":64}},"198":{"start":{"line":1172,"column":8},"end":{"line":1174,"column":31}},"199":{"start":{"line":1176,"column":8},"end":{"line":1190,"column":9}},"200":{"start":{"line":1177,"column":12},"end":{"line":1183,"column":13}},"201":{"start":{"line":1178,"column":16},"end":{"line":1178,"column":44}},"202":{"start":{"line":1182,"column":16},"end":{"line":1182,"column":23}},"203":{"start":{"line":1187,"column":12},"end":{"line":1189,"column":13}},"204":{"start":{"line":1188,"column":16},"end":{"line":1188,"column":23}},"205":{"start":{"line":1192,"column":8},"end":{"line":1194,"column":9}},"206":{"start":{"line":1193,"column":12},"end":{"line":1193,"column":41}},"207":{"start":{"line":1207,"column":8},"end":{"line":1208,"column":36}},"208":{"start":{"line":1210,"column":8},"end":{"line":1210,"column":57}},"209":{"start":{"line":1212,"column":8},"end":{"line":1214,"column":9}},"210":{"start":{"line":1213,"column":12},"end":{"line":1213,"column":36}},"211":{"start":{"line":1216,"column":8},"end":{"line":1216,"column":32}},"212":{"start":{"line":1217,"column":8},"end":{"line":1217,"column":46}},"213":{"start":{"line":1228,"column":8},"end":{"line":1229,"column":36}},"214":{"start":{"line":1231,"column":8},"end":{"line":1231,"column":32}},"215":{"start":{"line":1232,"column":8},"end":{"line":1232,"column":56}},"216":{"start":{"line":1234,"column":8},"end":{"line":1236,"column":9}},"217":{"start":{"line":1235,"column":12},"end":{"line":1235,"column":35}},"218":{"start":{"line":1238,"column":8},"end":{"line":1238,"column":39}},"219":{"start":{"line":1251,"column":8},"end":{"line":1254,"column":9}},"220":{"start":{"line":1252,"column":12},"end":{"line":1252,"column":44}},"221":{"start":{"line":1253,"column":12},"end":{"line":1253,"column":19}},"222":{"start":{"line":1256,"column":8},"end":{"line":1256,"column":22}},"223":{"start":{"line":1258,"column":8},"end":{"line":1260,"column":9}},"224":{"start":{"line":1259,"column":12},"end":{"line":1259,"column":47}},"225":{"start":{"line":1266,"column":0},"end":{"line":1266,"column":34}}},"branchMap":{"1":{"line":178,"type":"binary-expr","locations":[{"start":{"line":178,"column":8},"end":{"line":178,"column":14}},{"start":{"line":178,"column":19},"end":{"line":178,"column":30}}]},"2":{"line":180,"type":"binary-expr","locations":[{"start":{"line":180,"column":33},"end":{"line":180,"column":45}},{"start":{"line":180,"column":49},"end":{"line":180,"column":59}}]},"3":{"line":182,"type":"if","locations":[{"start":{"line":182,"column":8},"end":{"line":182,"column":8}},{"start":{"line":182,"column":8},"end":{"line":182,"column":8}}]},"4":{"line":186,"type":"if","locations":[{"start":{"line":186,"column":12},"end":{"line":186,"column":12}},{"start":{"line":186,"column":12},"end":{"line":186,"column":12}}]},"5":{"line":199,"type":"if","locations":[{"start":{"line":199,"column":8},"end":{"line":199,"column":8}},{"start":{"line":199,"column":8},"end":{"line":199,"column":8}}]},"6":{"line":253,"type":"if","locations":[{"start":{"line":253,"column":8},"end":{"line":253,"column":8}},{"start":{"line":253,"column":8},"end":{"line":253,"column":8}}]},"7":{"line":253,"type":"binary-expr","locations":[{"start":{"line":253,"column":12},"end":{"line":253,"column":18}},{"start":{"line":253,"column":22},"end":{"line":253,"column":42}}]},"8":{"line":254,"type":"cond-expr","locations":[{"start":{"line":254,"column":39},"end":{"line":254,"column":55}},{"start":{"line":254,"column":58},"end":{"line":254,"column":64}}]},"9":{"line":255,"type":"binary-expr","locations":[{"start":{"line":255,"column":35},"end":{"line":255,"column":42}},{"start":{"line":255,"column":46},"end":{"line":255,"column":48}}]},"10":{"line":260,"type":"if","locations":[{"start":{"line":260,"column":16},"end":{"line":260,"column":16}},{"start":{"line":260,"column":16},"end":{"line":260,"column":16}}]},"11":{"line":319,"type":"if","locations":[{"start":{"line":319,"column":8},"end":{"line":319,"column":8}},{"start":{"line":319,"column":8},"end":{"line":319,"column":8}}]},"12":{"line":324,"type":"binary-expr","locations":[{"start":{"line":324,"column":8},"end":{"line":324,"column":15}},{"start":{"line":324,"column":20},"end":{"line":324,"column":32}}]},"13":{"line":326,"type":"if","locations":[{"start":{"line":326,"column":8},"end":{"line":326,"column":8}},{"start":{"line":326,"column":8},"end":{"line":326,"column":8}}]},"14":{"line":335,"type":"if","locations":[{"start":{"line":335,"column":12},"end":{"line":335,"column":12}},{"start":{"line":335,"column":12},"end":{"line":335,"column":12}}]},"15":{"line":339,"type":"if","locations":[{"start":{"line":339,"column":12},"end":{"line":339,"column":12}},{"start":{"line":339,"column":12},"end":{"line":339,"column":12}}]},"16":{"line":371,"type":"binary-expr","locations":[{"start":{"line":371,"column":26},"end":{"line":371,"column":33}},{"start":{"line":371,"column":37},"end":{"line":371,"column":41}}]},"17":{"line":421,"type":"if","locations":[{"start":{"line":421,"column":8},"end":{"line":421,"column":8}},{"start":{"line":421,"column":8},"end":{"line":421,"column":8}}]},"18":{"line":429,"type":"if","locations":[{"start":{"line":429,"column":12},"end":{"line":429,"column":12}},{"start":{"line":429,"column":12},"end":{"line":429,"column":12}}]},"19":{"line":434,"type":"if","locations":[{"start":{"line":434,"column":8},"end":{"line":434,"column":8}},{"start":{"line":434,"column":8},"end":{"line":434,"column":8}}]},"20":{"line":437,"type":"if","locations":[{"start":{"line":437,"column":12},"end":{"line":437,"column":12}},{"start":{"line":437,"column":12},"end":{"line":437,"column":12}}]},"21":{"line":458,"type":"if","locations":[{"start":{"line":458,"column":8},"end":{"line":458,"column":8}},{"start":{"line":458,"column":8},"end":{"line":458,"column":8}}]},"22":{"line":480,"type":"if","locations":[{"start":{"line":480,"column":8},"end":{"line":480,"column":8}},{"start":{"line":480,"column":8},"end":{"line":480,"column":8}}]},"23":{"line":501,"type":"if","locations":[{"start":{"line":501,"column":8},"end":{"line":501,"column":8}},{"start":{"line":501,"column":8},"end":{"line":501,"column":8}}]},"24":{"line":516,"type":"binary-expr","locations":[{"start":{"line":516,"column":15},"end":{"line":516,"column":42}},{"start":{"line":516,"column":46},"end":{"line":516,"column":50}}]},"25":{"line":531,"type":"binary-expr","locations":[{"start":{"line":531,"column":15},"end":{"line":531,"column":30}},{"start":{"line":531,"column":34},"end":{"line":531,"column":38}}]},"26":{"line":586,"type":"if","locations":[{"start":{"line":586,"column":8},"end":{"line":586,"column":8}},{"start":{"line":586,"column":8},"end":{"line":586,"column":8}}]},"27":{"line":591,"type":"binary-expr","locations":[{"start":{"line":591,"column":8},"end":{"line":591,"column":15}},{"start":{"line":591,"column":20},"end":{"line":591,"column":32}}]},"28":{"line":601,"type":"if","locations":[{"start":{"line":601,"column":12},"end":{"line":601,"column":12}},{"start":{"line":601,"column":12},"end":{"line":601,"column":12}}]},"29":{"line":608,"type":"if","locations":[{"start":{"line":608,"column":16},"end":{"line":608,"column":16}},{"start":{"line":608,"column":16},"end":{"line":608,"column":16}}]},"30":{"line":620,"type":"if","locations":[{"start":{"line":620,"column":12},"end":{"line":620,"column":12}},{"start":{"line":620,"column":12},"end":{"line":620,"column":12}}]},"31":{"line":663,"type":"if","locations":[{"start":{"line":663,"column":8},"end":{"line":663,"column":8}},{"start":{"line":663,"column":8},"end":{"line":663,"column":8}}]},"32":{"line":665,"type":"binary-expr","locations":[{"start":{"line":665,"column":23},"end":{"line":665,"column":45}},{"start":{"line":665,"column":49},"end":{"line":665,"column":51}}]},"33":{"line":677,"type":"binary-expr","locations":[{"start":{"line":677,"column":15},"end":{"line":677,"column":23}},{"start":{"line":677,"column":27},"end":{"line":677,"column":29}}]},"34":{"line":700,"type":"if","locations":[{"start":{"line":700,"column":8},"end":{"line":700,"column":8}},{"start":{"line":700,"column":8},"end":{"line":700,"column":8}}]},"35":{"line":700,"type":"binary-expr","locations":[{"start":{"line":700,"column":12},"end":{"line":700,"column":18}},{"start":{"line":700,"column":22},"end":{"line":700,"column":42}}]},"36":{"line":704,"type":"cond-expr","locations":[{"start":{"line":704,"column":41},"end":{"line":704,"column":57}},{"start":{"line":704,"column":60},"end":{"line":704,"column":66}}]},"37":{"line":705,"type":"if","locations":[{"start":{"line":705,"column":16},"end":{"line":705,"column":16}},{"start":{"line":705,"column":16},"end":{"line":705,"column":16}}]},"38":{"line":743,"type":"binary-expr","locations":[{"start":{"line":743,"column":8},"end":{"line":743,"column":14}},{"start":{"line":743,"column":20},"end":{"line":743,"column":32}}]},"39":{"line":744,"type":"binary-expr","locations":[{"start":{"line":744,"column":8},"end":{"line":744,"column":15}},{"start":{"line":744,"column":20},"end":{"line":744,"column":32}}]},"40":{"line":748,"type":"if","locations":[{"start":{"line":748,"column":8},"end":{"line":748,"column":8}},{"start":{"line":748,"column":8},"end":{"line":748,"column":8}}]},"41":{"line":752,"type":"cond-expr","locations":[{"start":{"line":752,"column":43},"end":{"line":752,"column":48}},{"start":{"line":752,"column":51},"end":{"line":752,"column":72}}]},"42":{"line":758,"type":"if","locations":[{"start":{"line":758,"column":8},"end":{"line":758,"column":8}},{"start":{"line":758,"column":8},"end":{"line":758,"column":8}}]},"43":{"line":762,"type":"if","locations":[{"start":{"line":762,"column":12},"end":{"line":762,"column":12}},{"start":{"line":762,"column":12},"end":{"line":762,"column":12}}]},"44":{"line":801,"type":"if","locations":[{"start":{"line":801,"column":12},"end":{"line":801,"column":12}},{"start":{"line":801,"column":12},"end":{"line":801,"column":12}}]},"45":{"line":801,"type":"binary-expr","locations":[{"start":{"line":801,"column":30},"end":{"line":801,"column":37}},{"start":{"line":801,"column":41},"end":{"line":801,"column":45}}]},"46":{"line":827,"type":"if","locations":[{"start":{"line":827,"column":8},"end":{"line":827,"column":8}},{"start":{"line":827,"column":8},"end":{"line":827,"column":8}}]},"47":{"line":834,"type":"binary-expr","locations":[{"start":{"line":834,"column":8},"end":{"line":834,"column":15}},{"start":{"line":834,"column":20},"end":{"line":834,"column":32}}]},"48":{"line":843,"type":"if","locations":[{"start":{"line":843,"column":8},"end":{"line":843,"column":8}},{"start":{"line":843,"column":8},"end":{"line":843,"column":8}}]},"49":{"line":885,"type":"if","locations":[{"start":{"line":885,"column":8},"end":{"line":885,"column":8}},{"start":{"line":885,"column":8},"end":{"line":885,"column":8}}]},"50":{"line":937,"type":"binary-expr","locations":[{"start":{"line":937,"column":8},"end":{"line":937,"column":15}},{"start":{"line":937,"column":20},"end":{"line":937,"column":32}}]},"51":{"line":939,"type":"if","locations":[{"start":{"line":939,"column":8},"end":{"line":939,"column":8}},{"start":{"line":939,"column":8},"end":{"line":939,"column":8}}]},"52":{"line":945,"type":"if","locations":[{"start":{"line":945,"column":8},"end":{"line":945,"column":8}},{"start":{"line":945,"column":8},"end":{"line":945,"column":8}}]},"53":{"line":945,"type":"binary-expr","locations":[{"start":{"line":945,"column":12},"end":{"line":945,"column":52}},{"start":{"line":946,"column":20},"end":{"line":946,"column":36}},{"start":{"line":946,"column":40},"end":{"line":946,"column":55}}]},"54":{"line":958,"type":"cond-expr","locations":[{"start":{"line":958,"column":40},"end":{"line":958,"column":53}},{"start":{"line":958,"column":56},"end":{"line":958,"column":78}}]},"55":{"line":962,"type":"if","locations":[{"start":{"line":962,"column":8},"end":{"line":962,"column":8}},{"start":{"line":962,"column":8},"end":{"line":962,"column":8}}]},"56":{"line":1014,"type":"cond-expr","locations":[{"start":{"line":1014,"column":23},"end":{"line":1014,"column":25}},{"start":{"line":1014,"column":29},"end":{"line":1014,"column":42}}]},"57":{"line":1014,"type":"cond-expr","locations":[{"start":{"line":1014,"column":37},"end":{"line":1014,"column":38}},{"start":{"line":1014,"column":41},"end":{"line":1014,"column":42}}]},"58":{"line":1027,"type":"if","locations":[{"start":{"line":1027,"column":8},"end":{"line":1027,"column":8}},{"start":{"line":1027,"column":8},"end":{"line":1027,"column":8}}]},"59":{"line":1048,"type":"if","locations":[{"start":{"line":1048,"column":8},"end":{"line":1048,"column":8}},{"start":{"line":1048,"column":8},"end":{"line":1048,"column":8}}]},"60":{"line":1048,"type":"binary-expr","locations":[{"start":{"line":1048,"column":12},"end":{"line":1048,"column":28}},{"start":{"line":1048,"column":32},"end":{"line":1048,"column":36}}]},"61":{"line":1060,"type":"if","locations":[{"start":{"line":1060,"column":12},"end":{"line":1060,"column":12}},{"start":{"line":1060,"column":12},"end":{"line":1060,"column":12}}]},"62":{"line":1103,"type":"binary-expr","locations":[{"start":{"line":1103,"column":8},"end":{"line":1103,"column":15}},{"start":{"line":1103,"column":20},"end":{"line":1103,"column":32}}]},"63":{"line":1105,"type":"if","locations":[{"start":{"line":1105,"column":8},"end":{"line":1105,"column":8}},{"start":{"line":1105,"column":8},"end":{"line":1105,"column":8}}]},"64":{"line":1112,"type":"if","locations":[{"start":{"line":1112,"column":8},"end":{"line":1112,"column":8}},{"start":{"line":1112,"column":8},"end":{"line":1112,"column":8}}]},"65":{"line":1112,"type":"binary-expr","locations":[{"start":{"line":1112,"column":12},"end":{"line":1112,"column":24}},{"start":{"line":1112,"column":28},"end":{"line":1112,"column":34}}]},"66":{"line":1128,"type":"if","locations":[{"start":{"line":1128,"column":8},"end":{"line":1128,"column":8}},{"start":{"line":1128,"column":8},"end":{"line":1128,"column":8}}]},"67":{"line":1154,"type":"if","locations":[{"start":{"line":1154,"column":8},"end":{"line":1154,"column":8}},{"start":{"line":1154,"column":8},"end":{"line":1154,"column":8}}]},"68":{"line":1159,"type":"cond-expr","locations":[{"start":{"line":1159,"column":47},"end":{"line":1159,"column":54}},{"start":{"line":1159,"column":57},"end":{"line":1159,"column":63}}]},"69":{"line":1159,"type":"binary-expr","locations":[{"start":{"line":1159,"column":15},"end":{"line":1159,"column":22}},{"start":{"line":1159,"column":26},"end":{"line":1159,"column":44}}]},"70":{"line":1176,"type":"if","locations":[{"start":{"line":1176,"column":8},"end":{"line":1176,"column":8}},{"start":{"line":1176,"column":8},"end":{"line":1176,"column":8}}]},"71":{"line":1177,"type":"if","locations":[{"start":{"line":1177,"column":12},"end":{"line":1177,"column":12}},{"start":{"line":1177,"column":12},"end":{"line":1177,"column":12}}]},"72":{"line":1187,"type":"if","locations":[{"start":{"line":1187,"column":12},"end":{"line":1187,"column":12}},{"start":{"line":1187,"column":12},"end":{"line":1187,"column":12}}]},"73":{"line":1192,"type":"if","locations":[{"start":{"line":1192,"column":8},"end":{"line":1192,"column":8}},{"start":{"line":1192,"column":8},"end":{"line":1192,"column":8}}]},"74":{"line":1212,"type":"if","locations":[{"start":{"line":1212,"column":8},"end":{"line":1212,"column":8}},{"start":{"line":1212,"column":8},"end":{"line":1212,"column":8}}]},"75":{"line":1234,"type":"if","locations":[{"start":{"line":1234,"column":8},"end":{"line":1234,"column":8}},{"start":{"line":1234,"column":8},"end":{"line":1234,"column":8}}]},"76":{"line":1251,"type":"if","locations":[{"start":{"line":1251,"column":8},"end":{"line":1251,"column":8}},{"start":{"line":1251,"column":8},"end":{"line":1251,"column":8}}]},"77":{"line":1258,"type":"if","locations":[{"start":{"line":1258,"column":8},"end":{"line":1258,"column":8}},{"start":{"line":1258,"column":8},"end":{"line":1258,"column":8}}]}},"code":["(function () { YUI.add('model-list', function (Y, NAME) {","","/**","Provides an API for managing an ordered list of Model instances.","","@module app","@submodule model-list","@since 3.4.0","**/","","/**","Provides an API for managing an ordered list of Model instances.","","In addition to providing convenient `add`, `create`, `reset`, and `remove`","methods for managing the models in the list, ModelLists are also bubble targets","for events on the model instances they contain. This means, for example, that","you can add several models to a list, and then subscribe to the `*:change` event","on the list to be notified whenever any model in the list changes.","","ModelLists also maintain sort order efficiently as models are added and removed,","based on a custom `comparator` function you may define (if no comparator is","defined, models are sorted in insertion order).","","@class ModelList","@extends Base","@uses ArrayList","@constructor","@param {Object} config Config options."," @param {Model|Model[]|ModelList|Object|Object[]} config.items Model"," instance, array of model instances, or ModelList to add to this list on"," init. The `add` event will not be fired for models added on init.","@since 3.4.0","**/","","var AttrProto = Y.Attribute.prototype,"," Lang = Y.Lang,"," YArray = Y.Array,",""," /**"," Fired when a model is added to the list.",""," Listen to the `on` phase of this event to be notified before a model is"," added to the list. Calling `e.preventDefault()` during the `on` phase will"," prevent the model from being added.",""," Listen to the `after` phase of this event to be notified after a model has"," been added to the list.",""," @event add"," @param {Model} model The model being added."," @param {Number} index The index at which the model will be added."," @preventable _defAddFn"," **/"," EVT_ADD = 'add',",""," /**"," Fired when a model is created or updated via the `create()` method, but"," before the model is actually saved or added to the list. The `add` event"," will be fired after the model has been saved and added to the list.",""," @event create"," @param {Model} model The model being created/updated."," @since 3.5.0"," **/"," EVT_CREATE = 'create',",""," /**"," Fired when an error occurs, such as when an attempt is made to add a"," duplicate model to the list, or when a sync layer response can't be parsed.",""," @event error"," @param {Any} error Error message, object, or exception generated by the"," error. Calling `toString()` on this should result in a meaningful error"," message."," @param {String} src Source of the error. May be one of the following (or any"," custom error source defined by a ModelList subclass):",""," * `add`: Error while adding a model (probably because it's already in the"," list and can't be added again). The model in question will be provided"," as the `model` property on the event facade."," * `parse`: An error parsing a JSON response. The response in question will"," be provided as the `response` property on the event facade."," * `remove`: Error while removing a model (probably because it isn't in the"," list and can't be removed). The model in question will be provided as"," the `model` property on the event facade."," **/"," EVT_ERROR = 'error',",""," /**"," Fired after models are loaded from a sync layer.",""," @event load"," @param {Object} parsed The parsed version of the sync layer's response to"," the load request."," @param {Mixed} response The sync layer's raw, unparsed response to the load"," request."," @since 3.5.0"," **/"," EVT_LOAD = 'load',",""," /**"," Fired when a model is removed from the list.",""," Listen to the `on` phase of this event to be notified before a model is"," removed from the list. Calling `e.preventDefault()` during the `on` phase"," will prevent the model from being removed.",""," Listen to the `after` phase of this event to be notified after a model has"," been removed from the list.",""," @event remove"," @param {Model} model The model being removed."," @param {Number} index The index of the model being removed."," @preventable _defRemoveFn"," **/"," EVT_REMOVE = 'remove',",""," /**"," Fired when the list is completely reset via the `reset()` method or sorted"," via the `sort()` method.",""," Listen to the `on` phase of this event to be notified before the list is"," reset. Calling `e.preventDefault()` during the `on` phase will prevent"," the list from being reset.",""," Listen to the `after` phase of this event to be notified after the list has"," been reset.",""," @event reset"," @param {Model[]} models Array of the list's new models after the reset."," @param {String} src Source of the event. May be either `'reset'` or"," `'sort'`."," @preventable _defResetFn"," **/"," EVT_RESET = 'reset';","","function ModelList() {"," ModelList.superclass.constructor.apply(this, arguments);","}","","Y.ModelList = Y.extend(ModelList, Y.Base, {"," // -- Public Properties ----------------------------------------------------",""," /**"," The `Model` class or subclass of the models in this list.",""," The class specified here will be used to create model instances"," automatically based on attribute hashes passed to the `add()`, `create()`,"," and `reset()` methods.",""," You may specify the class as an actual class reference or as a string that"," resolves to a class reference at runtime (the latter can be useful if the"," specified class will be loaded lazily).",""," @property model"," @type Model|String"," @default Y.Model"," **/"," model: Y.Model,",""," // -- Protected Properties -------------------------------------------------",""," /**"," Total hack to allow us to identify ModelList instances without using"," `instanceof`, which won't work when the instance was created in another"," window or YUI sandbox.",""," @property _isYUIModelList"," @type Boolean"," @default true"," @protected"," @since 3.5.0"," **/"," _isYUIModelList: true,",""," // -- Lifecycle Methods ----------------------------------------------------"," initializer: function (config) {"," config || (config = {});",""," var model = this.model = config.model || this.model;",""," if (typeof model === 'string') {"," // Look for a namespaced Model class on `Y`."," this.model = Y.Object.getValue(Y, model.split('.'));",""," if (!this.model) {"," Y.error('ModelList: Model class not found: ' + model);"," }"," }",""," this.publish(EVT_ADD, {defaultFn: this._defAddFn});"," this.publish(EVT_RESET, {defaultFn: this._defResetFn});"," this.publish(EVT_REMOVE, {defaultFn: this._defRemoveFn});",""," this.after('*:idChange', this._afterIdChange);",""," this._clear();",""," if (config.items) {"," this.add(config.items, {silent: true});"," }"," },",""," destructor: function () {"," this._clear();"," },",""," // -- Public Methods -------------------------------------------------------",""," /**"," Adds the specified model or array of models to this list. You may also pass"," another ModelList instance, in which case all the models in that list will"," be added to this one as well.",""," @example",""," // Add a single model instance."," list.add(new Model({foo: 'bar'}));",""," // Add a single model, creating a new instance automatically."," list.add({foo: 'bar'});",""," // Add multiple models, creating new instances automatically."," list.add(["," {foo: 'bar'},"," {baz: 'quux'}"," ]);",""," // Add all the models in another ModelList instance."," list.add(otherList);",""," @method add"," @param {Model|Model[]|ModelList|Object|Object[]} models Model or array of"," models to add. May be existing model instances or hashes of model"," attributes, in which case new model instances will be created from the"," hashes. You may also pass a ModelList instance to add all the models it"," contains."," @param {Object} [options] Data to be mixed into the event facade of the"," `add` event(s) for the added models.",""," @param {Number} [options.index] Index at which to insert the added"," models. If not specified, the models will automatically be inserted"," in the appropriate place according to the current sort order as"," dictated by the `comparator()` method, if any."," @param {Boolean} [options.silent=false] If `true`, no `add` event(s)"," will be fired.",""," @return {Model|Model[]} Added model or array of added models."," **/"," add: function (models, options) {"," var isList = models._isYUIModelList;",""," if (isList || Lang.isArray(models)) {"," return YArray.map(isList ? models.toArray() : models, function (model, index) {"," var modelOptions = options || {};",""," // When an explicit insertion index is specified, ensure that"," // the index is increased by one for each subsequent item in the"," // array."," if ('index' in modelOptions) {"," modelOptions = Y.merge(modelOptions, {"," index: modelOptions.index + index"," });"," }",""," return this._add(model, modelOptions);"," }, this);"," } else {"," return this._add(models, options);"," }"," },",""," /**"," Define this method to provide a function that takes a model as a parameter"," and returns a value by which that model should be sorted relative to other"," models in this list.",""," By default, no comparator is defined, meaning that models will not be sorted"," (they'll be stored in the order they're added).",""," @example"," var list = new Y.ModelList({model: Y.Model});",""," list.comparator = function (model) {"," return model.get('id'); // Sort models by id."," };",""," @method comparator"," @param {Model} model Model being sorted."," @return {Number|String} Value by which the model should be sorted relative"," to other models in this list."," **/",""," // comparator is not defined by default",""," /**"," Creates or updates the specified model on the server, then adds it to this"," list if the server indicates success.",""," @method create"," @param {Model|Object} model Model to create. May be an existing model"," instance or a hash of model attributes, in which case a new model instance"," will be created from the hash."," @param {Object} [options] Options to be passed to the model's `sync()` and"," `set()` methods and mixed into the `create` and `add` event facades."," @param {Boolean} [options.silent=false] If `true`, no `add` event(s) will"," be fired."," @param {Function} [callback] Called when the sync operation finishes."," @param {Error} callback.err If an error occurred, this parameter will"," contain the error. If the sync operation succeeded, _err_ will be"," falsy."," @param {Any} callback.response The server's response."," @return {Model} Created model."," **/"," create: function (model, options, callback) {"," var self = this;",""," // Allow callback as second arg."," if (typeof options === 'function') {"," callback = options;"," options = {};"," }",""," options || (options = {});",""," if (!model._isYUIModel) {"," model = new this.model(model);"," }",""," self.fire(EVT_CREATE, Y.merge(options, {"," model: model"," }));",""," return model.save(options, function (err) {"," if (!err) {"," self.add(model, options);"," }",""," if (callback) {"," callback.apply(null, arguments);"," }"," });"," },",""," /**"," Executes the supplied function on each model in this list.",""," By default, the callback function's `this` object will refer to the model"," currently being iterated. Specify a `thisObj` to override the `this` object"," if desired.",""," Note: Iteration is performed on a copy of the internal array of models, so"," it's safe to delete a model from the list during iteration.",""," @method each"," @param {Function} callback Function to execute on each model."," @param {Model} callback.model Model instance."," @param {Number} callback.index Index of the current model."," @param {ModelList} callback.list The ModelList being iterated."," @param {Object} [thisObj] Object to use as the `this` object when executing"," the callback."," @chainable"," @since 3.6.0"," **/"," each: function (callback, thisObj) {"," var items = this._items.concat(),"," i, item, len;",""," for (i = 0, len = items.length; i < len; i++) {"," item = items[i];"," callback.call(thisObj || item, item, i, this);"," }",""," return this;"," },",""," /**"," Executes the supplied function on each model in this list. Returns an array"," containing the models for which the supplied function returned a truthy"," value.",""," The callback function's `this` object will refer to this ModelList. Use"," `Y.bind()` to bind the `this` object to another object if desired.",""," @example",""," // Get an array containing only the models whose \"enabled\" attribute is"," // truthy."," var filtered = list.filter(function (model) {"," return model.get('enabled');"," });",""," // Get a new ModelList containing only the models whose \"enabled\""," // attribute is truthy."," var filteredList = list.filter({asList: true}, function (model) {"," return model.get('enabled');"," });",""," @method filter"," @param {Object} [options] Filter options."," @param {Boolean} [options.asList=false] If truthy, results will be"," returned as a new ModelList instance rather than as an array.",""," @param {Function} callback Function to execute on each model."," @param {Model} callback.model Model instance."," @param {Number} callback.index Index of the current model."," @param {ModelList} callback.list The ModelList being filtered.",""," @return {Array|ModelList} Array of models for which the callback function"," returned a truthy value (empty if it never returned a truthy value). If"," the `options.asList` option is truthy, a new ModelList instance will be"," returned instead of an array."," @since 3.5.0"," */"," filter: function (options, callback) {"," var filtered = [],"," items = this._items,"," i, item, len, list;",""," // Allow options as first arg."," if (typeof options === 'function') {"," callback = options;"," options = {};"," }",""," for (i = 0, len = items.length; i < len; ++i) {"," item = items[i];",""," if (callback.call(this, item, i, this)) {"," filtered.push(item);"," }"," }",""," if (options.asList) {"," list = new this.constructor({model: this.model});",""," if (filtered.length) {"," list.add(filtered, {silent: true});"," }",""," return list;"," } else {"," return filtered;"," }"," },",""," /**"," If _name_ refers to an attribute on this ModelList instance, returns the"," value of that attribute. Otherwise, returns an array containing the values"," of the specified attribute from each model in this list.",""," @method get"," @param {String} name Attribute name or object property path."," @return {Any|Array} Attribute value or array of attribute values."," @see Model.get()"," **/"," get: function (name) {"," if (this.attrAdded(name)) {"," return AttrProto.get.apply(this, arguments);"," }",""," return this.invoke('get', name);"," },",""," /**"," If _name_ refers to an attribute on this ModelList instance, returns the"," HTML-escaped value of that attribute. Otherwise, returns an array containing"," the HTML-escaped values of the specified attribute from each model in this"," list.",""," The values are escaped using `Escape.html()`.",""," @method getAsHTML"," @param {String} name Attribute name or object property path."," @return {String|String[]} HTML-escaped value or array of HTML-escaped"," values."," @see Model.getAsHTML()"," **/"," getAsHTML: function (name) {"," if (this.attrAdded(name)) {"," return Y.Escape.html(AttrProto.get.apply(this, arguments));"," }",""," return this.invoke('getAsHTML', name);"," },",""," /**"," If _name_ refers to an attribute on this ModelList instance, returns the"," URL-encoded value of that attribute. Otherwise, returns an array containing"," the URL-encoded values of the specified attribute from each model in this"," list.",""," The values are encoded using the native `encodeURIComponent()` function.",""," @method getAsURL"," @param {String} name Attribute name or object property path."," @return {String|String[]} URL-encoded value or array of URL-encoded values."," @see Model.getAsURL()"," **/"," getAsURL: function (name) {"," if (this.attrAdded(name)) {"," return encodeURIComponent(AttrProto.get.apply(this, arguments));"," }",""," return this.invoke('getAsURL', name);"," },",""," /**"," Returns the model with the specified _clientId_, or `null` if not found.",""," @method getByClientId"," @param {String} clientId Client id."," @return {Model} Model, or `null` if not found."," **/"," getByClientId: function (clientId) {"," return this._clientIdMap[clientId] || null;"," },",""," /**"," Returns the model with the specified _id_, or `null` if not found.",""," Note that models aren't expected to have an id until they're saved, so if"," you're working with unsaved models, it may be safer to call"," `getByClientId()`.",""," @method getById"," @param {String|Number} id Model id."," @return {Model} Model, or `null` if not found."," **/"," getById: function (id) {"," return this._idMap[id] || null;"," },",""," /**"," Calls the named method on every model in the list. Any arguments provided"," after _name_ will be passed on to the invoked method.",""," @method invoke"," @param {String} name Name of the method to call on each model."," @param {Any} [args*] Zero or more arguments to pass to the invoked method."," @return {Array} Array of return values, indexed according to the index of"," the model on which the method was called."," **/"," invoke: function (name /*, args* */) {"," var args = [this._items, name].concat(YArray(arguments, 1, true));"," return YArray.invoke.apply(YArray, args);"," },",""," /**"," Returns the model at the specified _index_.",""," @method item"," @param {Number} index Index of the model to fetch."," @return {Model} The model at the specified index, or `undefined` if there"," isn't a model there."," **/",""," // item() is inherited from ArrayList.",""," /**"," Loads this list of models from the server.",""," This method delegates to the `sync()` method to perform the actual load"," operation, which is an asynchronous action. Specify a _callback_ function to"," be notified of success or failure.",""," If the load operation succeeds, a `reset` event will be fired.",""," @method load"," @param {Object} [options] Options to be passed to `sync()` and to"," `reset()` when adding the loaded models. It's up to the custom sync"," implementation to determine what options it supports or requires, if any."," @param {Function} [callback] Called when the sync operation finishes."," @param {Error} callback.err If an error occurred, this parameter will"," contain the error. If the sync operation succeeded, _err_ will be"," falsy."," @param {Any} callback.response The server's response. This value will"," be passed to the `parse()` method, which is expected to parse it and"," return an array of model attribute hashes."," @chainable"," **/"," load: function (options, callback) {"," var self = this;",""," // Allow callback as only arg."," if (typeof options === 'function') {"," callback = options;"," options = {};"," }",""," options || (options = {});",""," this.sync('read', options, function (err, response) {"," var facade = {"," options : options,"," response: response"," },",""," parsed;",""," if (err) {"," facade.error = err;"," facade.src = 'load';",""," self.fire(EVT_ERROR, facade);"," } else {"," // Lazy publish."," if (!self._loadEvent) {"," self._loadEvent = self.publish(EVT_LOAD, {"," preventable: false"," });"," }",""," parsed = facade.parsed = self._parse(response);",""," self.reset(parsed, options);"," self.fire(EVT_LOAD, facade);"," }",""," if (callback) {"," callback.apply(null, arguments);"," }"," });",""," return this;"," },",""," /**"," Executes the specified function on each model in this list and returns an"," array of the function's collected return values.",""," @method map"," @param {Function} fn Function to execute on each model."," @param {Model} fn.model Current model being iterated."," @param {Number} fn.index Index of the current model in the list."," @param {Model[]} fn.models Array of models being iterated."," @param {Object} [thisObj] `this` object to use when calling _fn_."," @return {Array} Array of return values from _fn_."," **/"," map: function (fn, thisObj) {"," return YArray.map(this._items, fn, thisObj);"," },",""," /**"," Called to parse the _response_ when the list is loaded from the server."," This method receives a server _response_ and is expected to return an array"," of model attribute hashes.",""," The default implementation assumes that _response_ is either an array of"," attribute hashes or a JSON string that can be parsed into an array of"," attribute hashes. If _response_ is a JSON string and either `Y.JSON` or the"," native `JSON` object are available, it will be parsed automatically. If a"," parse error occurs, an `error` event will be fired and the model will not be"," updated.",""," You may override this method to implement custom parsing logic if necessary.",""," @method parse"," @param {Any} response Server response."," @return {Object[]} Array of model attribute hashes."," **/"," parse: function (response) {"," if (typeof response === 'string') {"," try {"," return Y.JSON.parse(response) || [];"," } catch (ex) {"," this.fire(EVT_ERROR, {"," error : ex,"," response: response,"," src : 'parse'"," });",""," return null;"," }"," }",""," return response || [];"," },",""," /**"," Removes the specified model or array of models from this list. You may also"," pass another ModelList instance to remove all the models that are in both"," that instance and this instance, or pass numerical indices to remove the"," models at those indices.",""," @method remove"," @param {Model|Model[]|ModelList|Number|Number[]} models Models or indices of"," models to remove."," @param {Object} [options] Data to be mixed into the event facade of the"," `remove` event(s) for the removed models.",""," @param {Boolean} [options.silent=false] If `true`, no `remove` event(s)"," will be fired.",""," @return {Model|Model[]} Removed model or array of removed models."," **/"," remove: function (models, options) {"," var isList = models._isYUIModelList;",""," if (isList || Lang.isArray(models)) {"," // We can't remove multiple models by index because the indices will"," // change as we remove them, so we need to get the actual models"," // first."," models = YArray.map(isList ? models.toArray() : models, function (model) {"," if (Lang.isNumber(model)) {"," return this.item(model);"," }",""," return model;"," }, this);",""," return YArray.map(models, function (model) {"," return this._remove(model, options);"," }, this);"," } else {"," return this._remove(models, options);"," }"," },",""," /**"," Completely replaces all models in the list with those specified, and fires a"," single `reset` event.",""," Use `reset` when you want to add or remove a large number of items at once"," with less overhead, and without firing `add` or `remove` events for each"," one.",""," @method reset"," @param {Model[]|ModelList|Object[]} [models] Models to add. May be existing"," model instances or hashes of model attributes, in which case new model"," instances will be created from the hashes. If a ModelList is passed, all"," the models in that list will be added to this list. Calling `reset()`"," without passing in any models will clear the list."," @param {Object} [options] Data to be mixed into the event facade of the"," `reset` event.",""," @param {Boolean} [options.silent=false] If `true`, no `reset` event will"," be fired.",""," @chainable"," **/"," reset: function (models, options) {"," models || (models = []);"," options || (options = {});",""," var facade = Y.merge({src: 'reset'}, options);",""," if (models._isYUIModelList) {"," models = models.toArray();"," } else {"," models = YArray.map(models, function (model) {"," return model._isYUIModel ? model : new this.model(model);"," }, this);"," }",""," facade.models = models;",""," if (options.silent) {"," this._defResetFn(facade);"," } else {"," // Sort the models before firing the reset event."," if (this.comparator) {"," models.sort(Y.bind(this._sort, this));"," }",""," this.fire(EVT_RESET, facade);"," }",""," return this;"," },",""," /**"," Executes the supplied function on each model in this list, and stops"," iterating if the callback returns `true`.",""," By default, the callback function's `this` object will refer to the model"," currently being iterated. Specify a `thisObj` to override the `this` object"," if desired.",""," Note: Iteration is performed on a copy of the internal array of models, so"," it's safe to delete a model from the list during iteration.",""," @method some"," @param {Function} callback Function to execute on each model."," @param {Model} callback.model Model instance."," @param {Number} callback.index Index of the current model."," @param {ModelList} callback.list The ModelList being iterated."," @param {Object} [thisObj] Object to use as the `this` object when executing"," the callback."," @return {Boolean} `true` if the callback returned `true` for any item,"," `false` otherwise."," @since 3.6.0"," **/"," some: function (callback, thisObj) {"," var items = this._items.concat(),"," i, item, len;",""," for (i = 0, len = items.length; i < len; i++) {"," item = items[i];",""," if (callback.call(thisObj || item, item, i, this)) {"," return true;"," }"," }",""," return false;"," },",""," /**"," Forcibly re-sorts the list.",""," Usually it shouldn't be necessary to call this method since the list"," maintains its sort order when items are added and removed, but if you change"," the `comparator` function after items are already in the list, you'll need"," to re-sort.",""," @method sort"," @param {Object} [options] Data to be mixed into the event facade of the"," `reset` event."," @param {Boolean} [options.silent=false] If `true`, no `reset` event will"," be fired."," @param {Boolean} [options.descending=false] If `true`, the sort is"," performed in descending order."," @chainable"," **/"," sort: function (options) {"," if (!this.comparator) {"," return this;"," }",""," var models = this._items.concat(),"," facade;",""," options || (options = {});",""," models.sort(Y.rbind(this._sort, this, options));",""," facade = Y.merge(options, {"," models: models,"," src : 'sort'"," });",""," if (options.silent) {"," this._defResetFn(facade);"," } else {"," this.fire(EVT_RESET, facade);"," }",""," return this;"," },",""," /**"," Override this method to provide a custom persistence implementation for this"," list. The default method just calls the callback without actually doing"," anything.",""," This method is called internally by `load()` and its implementations relies"," on the callback being called. This effectively means that when a callback is"," provided, it must be called at some point for the class to operate correctly.",""," @method sync"," @param {String} action Sync action to perform. May be one of the following:",""," * `create`: Store a list of newly-created models for the first time."," * `delete`: Delete a list of existing models."," * `read` : Load a list of existing models."," * `update`: Update a list of existing models.",""," Currently, model lists only make use of the `read` action, but other"," actions may be used in future versions.",""," @param {Object} [options] Sync options. It's up to the custom sync"," implementation to determine what options it supports or requires, if any."," @param {Function} [callback] Called when the sync operation finishes."," @param {Error} callback.err If an error occurred, this parameter will"," contain the error. If the sync operation succeeded, _err_ will be"," falsy."," @param {Any} [callback.response] The server's response. This value will"," be passed to the `parse()` method, which is expected to parse it and"," return an array of model attribute hashes."," **/"," sync: function (/* action, options, callback */) {"," var callback = YArray(arguments, 0, true).pop();",""," if (typeof callback === 'function') {"," callback();"," }"," },",""," /**"," Returns an array containing the models in this list.",""," @method toArray"," @return {Array} Array containing the models in this list."," **/"," toArray: function () {"," return this._items.concat();"," },",""," /**"," Returns an array containing attribute hashes for each model in this list,"," suitable for being passed to `Y.JSON.stringify()`.",""," Under the hood, this method calls `toJSON()` on each model in the list and"," pushes the results into an array.",""," @method toJSON"," @return {Object[]} Array of model attribute hashes."," @see Model.toJSON()"," **/"," toJSON: function () {"," return this.map(function (model) {"," return model.toJSON();"," });"," },",""," // -- Protected Methods ----------------------------------------------------",""," /**"," Adds the specified _model_ if it isn't already in this list.",""," If the model's `clientId` or `id` matches that of a model that's already in"," the list, an `error` event will be fired and the model will not be added.",""," @method _add"," @param {Model|Object} model Model or object to add."," @param {Object} [options] Data to be mixed into the event facade of the"," `add` event for the added model."," @param {Boolean} [options.silent=false] If `true`, no `add` event will be"," fired."," @return {Model} The added model."," @protected"," **/"," _add: function (model, options) {"," var facade, id;",""," options || (options = {});",""," if (!model._isYUIModel) {"," model = new this.model(model);"," }",""," id = model.get('id');",""," if (this._clientIdMap[model.get('clientId')]"," || (Lang.isValue(id) && this._idMap[id])) {",""," this.fire(EVT_ERROR, {"," error: 'Model is already in the list.',"," model: model,"," src : 'add'"," });",""," return;"," }",""," facade = Y.merge(options, {"," index: 'index' in options ? options.index : this._findIndex(model),"," model: model"," });",""," if (options.silent) {"," this._defAddFn(facade);"," } else {"," this.fire(EVT_ADD, facade);"," }",""," return model;"," },",""," /**"," Adds this list as a bubble target for the specified model's events.",""," @method _attachList"," @param {Model} model Model to attach to this list."," @protected"," **/"," _attachList: function (model) {"," // Attach this list and make it a bubble target for the model."," model.lists.push(this);"," model.addTarget(this);"," },",""," /**"," Clears all internal state and the internal list of models, returning this"," list to an empty state. Automatically detaches all models in the list.",""," @method _clear"," @protected"," **/"," _clear: function () {"," YArray.each(this._items, this._detachList, this);",""," this._clientIdMap = {};"," this._idMap = {};"," this._items = [];"," },",""," /**"," Compares the value _a_ to the value _b_ for sorting purposes. Values are"," assumed to be the result of calling a model's `comparator()` method. You can"," override this method to implement custom sorting logic, such as a descending"," sort or multi-field sorting.",""," @method _compare"," @param {Mixed} a First value to compare."," @param {Mixed} b Second value to compare."," @return {Number} `-1` if _a_ should come before _b_, `0` if they're"," equivalent, `1` if _a_ should come after _b_."," @protected"," @since 3.5.0"," **/"," _compare: function (a, b) {"," return a < b ? -1 : (a > b ? 1 : 0);"," },",""," /**"," Removes this list as a bubble target for the specified model's events.",""," @method _detachList"," @param {Model} model Model to detach."," @protected"," **/"," _detachList: function (model) {"," var index = YArray.indexOf(model.lists, this);",""," if (index > -1) {"," model.lists.splice(index, 1);"," model.removeTarget(this);"," }"," },",""," /**"," Returns the index at which the given _model_ should be inserted to maintain"," the sort order of the list.",""," @method _findIndex"," @param {Model} model The model being inserted."," @return {Number} Index at which the model should be inserted."," @protected"," **/"," _findIndex: function (model) {"," var items = this._items,"," max = items.length,"," min = 0,"," item, middle, needle;",""," if (!this.comparator || !max) {"," return max;"," }",""," needle = this.comparator(model);",""," // Perform an iterative binary search to determine the correct position"," // based on the return value of the `comparator` function."," while (min < max) {"," middle = (min + max) >> 1; // Divide by two and discard remainder."," item = items[middle];",""," if (this._compare(this.comparator(item), needle) < 0) {"," min = middle + 1;"," } else {"," max = middle;"," }"," }",""," return min;"," },",""," /**"," Calls the public, overrideable `parse()` method and returns the result.",""," Override this method to provide a custom pre-parsing implementation. This"," provides a hook for custom persistence implementations to \"prep\" a response"," before calling the `parse()` method.",""," @method _parse"," @param {Any} response Server response."," @return {Object[]} Array of model attribute hashes."," @protected"," @see ModelList.parse()"," @since 3.7.0"," **/"," _parse: function (response) {"," return this.parse(response);"," },",""," /**"," Removes the specified _model_ if it's in this list.",""," @method _remove"," @param {Model|Number} model Model or index of the model to remove."," @param {Object} [options] Data to be mixed into the event facade of the"," `remove` event for the removed model."," @param {Boolean} [options.silent=false] If `true`, no `remove` event will"," be fired."," @return {Model} Removed model."," @protected"," **/"," _remove: function (model, options) {"," var index, facade;",""," options || (options = {});",""," if (Lang.isNumber(model)) {"," index = model;"," model = this.item(index);"," } else {"," index = this.indexOf(model);"," }",""," if (index === -1 || !model) {"," this.fire(EVT_ERROR, {"," error: 'Model is not in the list.',"," index: index,"," model: model,"," src : 'remove'"," });",""," return;"," }",""," facade = Y.merge(options, {"," index: index,"," model: model"," });",""," if (options.silent) {"," this._defRemoveFn(facade);"," } else {"," this.fire(EVT_REMOVE, facade);"," }",""," return model;"," },",""," /**"," Array sort function used by `sort()` to re-sort the models in the list.",""," @method _sort"," @param {Model} a First model to compare."," @param {Model} b Second model to compare."," @param {Object} [options] Options passed from `sort()` function."," @param {Boolean} [options.descending=false] If `true`, the sort is"," performed in descending order."," @return {Number} `-1` if _a_ is less than _b_, `0` if equal, `1` if greater"," (for ascending order, the reverse for descending order)."," @protected"," **/"," _sort: function (a, b, options) {"," var result = this._compare(this.comparator(a), this.comparator(b));",""," // Early return when items are equal in their sort comparison."," if (result === 0) {"," return result;"," }",""," // Flips sign when the sort is to be peformed in descending order."," return options && options.descending ? -result : result;"," },",""," // -- Event Handlers -------------------------------------------------------",""," /**"," Updates the model maps when a model's `id` attribute changes.",""," @method _afterIdChange"," @param {EventFacade} e"," @protected"," **/"," _afterIdChange: function (e) {"," var newVal = e.newVal,"," prevVal = e.prevVal,"," target = e.target;",""," if (Lang.isValue(prevVal)) {"," if (this._idMap[prevVal] === target) {"," delete this._idMap[prevVal];"," } else {"," // The model that changed isn't in this list. Probably just a"," // bubbled change event from a nested Model List."," return;"," }"," } else {"," // The model had no previous id. Verify that it exists in this list"," // before continuing."," if (this.indexOf(target) === -1) {"," return;"," }"," }",""," if (Lang.isValue(newVal)) {"," this._idMap[newVal] = target;"," }"," },",""," // -- Default Event Handlers -----------------------------------------------",""," /**"," Default event handler for `add` events.",""," @method _defAddFn"," @param {EventFacade} e"," @protected"," **/"," _defAddFn: function (e) {"," var model = e.model,"," id = model.get('id');",""," this._clientIdMap[model.get('clientId')] = model;",""," if (Lang.isValue(id)) {"," this._idMap[id] = model;"," }",""," this._attachList(model);"," this._items.splice(e.index, 0, model);"," },",""," /**"," Default event handler for `remove` events.",""," @method _defRemoveFn"," @param {EventFacade} e"," @protected"," **/"," _defRemoveFn: function (e) {"," var model = e.model,"," id = model.get('id');",""," this._detachList(model);"," delete this._clientIdMap[model.get('clientId')];",""," if (Lang.isValue(id)) {"," delete this._idMap[id];"," }",""," this._items.splice(e.index, 1);"," },",""," /**"," Default event handler for `reset` events.",""," @method _defResetFn"," @param {EventFacade} e"," @protected"," **/"," _defResetFn: function (e) {"," // When fired from the `sort` method, we don't need to clear the list or"," // add any models, since the existing models are sorted in place."," if (e.src === 'sort') {"," this._items = e.models.concat();"," return;"," }",""," this._clear();",""," if (e.models.length) {"," this.add(e.models, {silent: true});"," }"," }","}, {"," NAME: 'modelList'","});","","Y.augment(ModelList, Y.ArrayList);","","","}, '@VERSION@', {\"requires\": [\"array-extras\", \"array-invoke\", \"arraylist\", \"base-build\", \"escape\", \"json-parse\", \"model\"]});","","}());"]}; } var __cov_LMJdjgsQUPibsLFgT$xkGA = __coverage__['build/model-list/model-list.js']; __cov_LMJdjgsQUPibsLFgT$xkGA.s['1']++;YUI.add('model-list',function(Y,NAME){__cov_LMJdjgsQUPibsLFgT$xkGA.f['1']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['2']++;var AttrProto=Y.Attribute.prototype,Lang=Y.Lang,YArray=Y.Array,EVT_ADD='add',EVT_CREATE='create',EVT_ERROR='error',EVT_LOAD='load',EVT_REMOVE='remove',EVT_RESET='reset';__cov_LMJdjgsQUPibsLFgT$xkGA.s['3']++;function ModelList(){__cov_LMJdjgsQUPibsLFgT$xkGA.f['2']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['4']++;ModelList.superclass.constructor.apply(this,arguments);}__cov_LMJdjgsQUPibsLFgT$xkGA.s['5']++;Y.ModelList=Y.extend(ModelList,Y.Base,{model:Y.Model,_isYUIModelList:true,initializer:function(config){__cov_LMJdjgsQUPibsLFgT$xkGA.f['3']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['6']++;(__cov_LMJdjgsQUPibsLFgT$xkGA.b['1'][0]++,config)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['1'][1]++,config={});__cov_LMJdjgsQUPibsLFgT$xkGA.s['7']++;var model=this.model=(__cov_LMJdjgsQUPibsLFgT$xkGA.b['2'][0]++,config.model)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['2'][1]++,this.model);__cov_LMJdjgsQUPibsLFgT$xkGA.s['8']++;if(typeof model==='string'){__cov_LMJdjgsQUPibsLFgT$xkGA.b['3'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['9']++;this.model=Y.Object.getValue(Y,model.split('.'));__cov_LMJdjgsQUPibsLFgT$xkGA.s['10']++;if(!this.model){__cov_LMJdjgsQUPibsLFgT$xkGA.b['4'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['11']++;Y.error('ModelList: Model class not found: '+model);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['4'][1]++;}}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['3'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['12']++;this.publish(EVT_ADD,{defaultFn:this._defAddFn});__cov_LMJdjgsQUPibsLFgT$xkGA.s['13']++;this.publish(EVT_RESET,{defaultFn:this._defResetFn});__cov_LMJdjgsQUPibsLFgT$xkGA.s['14']++;this.publish(EVT_REMOVE,{defaultFn:this._defRemoveFn});__cov_LMJdjgsQUPibsLFgT$xkGA.s['15']++;this.after('*:idChange',this._afterIdChange);__cov_LMJdjgsQUPibsLFgT$xkGA.s['16']++;this._clear();__cov_LMJdjgsQUPibsLFgT$xkGA.s['17']++;if(config.items){__cov_LMJdjgsQUPibsLFgT$xkGA.b['5'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['18']++;this.add(config.items,{silent:true});}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['5'][1]++;}},destructor:function(){__cov_LMJdjgsQUPibsLFgT$xkGA.f['4']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['19']++;this._clear();},add:function(models,options){__cov_LMJdjgsQUPibsLFgT$xkGA.f['5']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['20']++;var isList=models._isYUIModelList;__cov_LMJdjgsQUPibsLFgT$xkGA.s['21']++;if((__cov_LMJdjgsQUPibsLFgT$xkGA.b['7'][0]++,isList)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['7'][1]++,Lang.isArray(models))){__cov_LMJdjgsQUPibsLFgT$xkGA.b['6'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['22']++;return YArray.map(isList?(__cov_LMJdjgsQUPibsLFgT$xkGA.b['8'][0]++,models.toArray()):(__cov_LMJdjgsQUPibsLFgT$xkGA.b['8'][1]++,models),function(model,index){__cov_LMJdjgsQUPibsLFgT$xkGA.f['6']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['23']++;var modelOptions=(__cov_LMJdjgsQUPibsLFgT$xkGA.b['9'][0]++,options)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['9'][1]++,{});__cov_LMJdjgsQUPibsLFgT$xkGA.s['24']++;if('index'in modelOptions){__cov_LMJdjgsQUPibsLFgT$xkGA.b['10'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['25']++;modelOptions=Y.merge(modelOptions,{index:modelOptions.index+index});}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['10'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['26']++;return this._add(model,modelOptions);},this);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['6'][1]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['27']++;return this._add(models,options);}},create:function(model,options,callback){__cov_LMJdjgsQUPibsLFgT$xkGA.f['7']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['28']++;var self=this;__cov_LMJdjgsQUPibsLFgT$xkGA.s['29']++;if(typeof options==='function'){__cov_LMJdjgsQUPibsLFgT$xkGA.b['11'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['30']++;callback=options;__cov_LMJdjgsQUPibsLFgT$xkGA.s['31']++;options={};}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['11'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['32']++;(__cov_LMJdjgsQUPibsLFgT$xkGA.b['12'][0]++,options)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['12'][1]++,options={});__cov_LMJdjgsQUPibsLFgT$xkGA.s['33']++;if(!model._isYUIModel){__cov_LMJdjgsQUPibsLFgT$xkGA.b['13'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['34']++;model=new this.model(model);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['13'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['35']++;self.fire(EVT_CREATE,Y.merge(options,{model:model}));__cov_LMJdjgsQUPibsLFgT$xkGA.s['36']++;return model.save(options,function(err){__cov_LMJdjgsQUPibsLFgT$xkGA.f['8']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['37']++;if(!err){__cov_LMJdjgsQUPibsLFgT$xkGA.b['14'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['38']++;self.add(model,options);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['14'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['39']++;if(callback){__cov_LMJdjgsQUPibsLFgT$xkGA.b['15'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['40']++;callback.apply(null,arguments);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['15'][1]++;}});},each:function(callback,thisObj){__cov_LMJdjgsQUPibsLFgT$xkGA.f['9']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['41']++;var items=this._items.concat(),i,item,len;__cov_LMJdjgsQUPibsLFgT$xkGA.s['42']++;for(i=0,len=items.length;i<len;i++){__cov_LMJdjgsQUPibsLFgT$xkGA.s['43']++;item=items[i];__cov_LMJdjgsQUPibsLFgT$xkGA.s['44']++;callback.call((__cov_LMJdjgsQUPibsLFgT$xkGA.b['16'][0]++,thisObj)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['16'][1]++,item),item,i,this);}__cov_LMJdjgsQUPibsLFgT$xkGA.s['45']++;return this;},filter:function(options,callback){__cov_LMJdjgsQUPibsLFgT$xkGA.f['10']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['46']++;var filtered=[],items=this._items,i,item,len,list;__cov_LMJdjgsQUPibsLFgT$xkGA.s['47']++;if(typeof options==='function'){__cov_LMJdjgsQUPibsLFgT$xkGA.b['17'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['48']++;callback=options;__cov_LMJdjgsQUPibsLFgT$xkGA.s['49']++;options={};}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['17'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['50']++;for(i=0,len=items.length;i<len;++i){__cov_LMJdjgsQUPibsLFgT$xkGA.s['51']++;item=items[i];__cov_LMJdjgsQUPibsLFgT$xkGA.s['52']++;if(callback.call(this,item,i,this)){__cov_LMJdjgsQUPibsLFgT$xkGA.b['18'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['53']++;filtered.push(item);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['18'][1]++;}}__cov_LMJdjgsQUPibsLFgT$xkGA.s['54']++;if(options.asList){__cov_LMJdjgsQUPibsLFgT$xkGA.b['19'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['55']++;list=new this.constructor({model:this.model});__cov_LMJdjgsQUPibsLFgT$xkGA.s['56']++;if(filtered.length){__cov_LMJdjgsQUPibsLFgT$xkGA.b['20'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['57']++;list.add(filtered,{silent:true});}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['20'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['58']++;return list;}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['19'][1]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['59']++;return filtered;}},get:function(name){__cov_LMJdjgsQUPibsLFgT$xkGA.f['11']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['60']++;if(this.attrAdded(name)){__cov_LMJdjgsQUPibsLFgT$xkGA.b['21'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['61']++;return AttrProto.get.apply(this,arguments);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['21'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['62']++;return this.invoke('get',name);},getAsHTML:function(name){__cov_LMJdjgsQUPibsLFgT$xkGA.f['12']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['63']++;if(this.attrAdded(name)){__cov_LMJdjgsQUPibsLFgT$xkGA.b['22'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['64']++;return Y.Escape.html(AttrProto.get.apply(this,arguments));}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['22'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['65']++;return this.invoke('getAsHTML',name);},getAsURL:function(name){__cov_LMJdjgsQUPibsLFgT$xkGA.f['13']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['66']++;if(this.attrAdded(name)){__cov_LMJdjgsQUPibsLFgT$xkGA.b['23'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['67']++;return encodeURIComponent(AttrProto.get.apply(this,arguments));}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['23'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['68']++;return this.invoke('getAsURL',name);},getByClientId:function(clientId){__cov_LMJdjgsQUPibsLFgT$xkGA.f['14']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['69']++;return(__cov_LMJdjgsQUPibsLFgT$xkGA.b['24'][0]++,this._clientIdMap[clientId])||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['24'][1]++,null);},getById:function(id){__cov_LMJdjgsQUPibsLFgT$xkGA.f['15']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['70']++;return(__cov_LMJdjgsQUPibsLFgT$xkGA.b['25'][0]++,this._idMap[id])||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['25'][1]++,null);},invoke:function(name){__cov_LMJdjgsQUPibsLFgT$xkGA.f['16']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['71']++;var args=[this._items,name].concat(YArray(arguments,1,true));__cov_LMJdjgsQUPibsLFgT$xkGA.s['72']++;return YArray.invoke.apply(YArray,args);},load:function(options,callback){__cov_LMJdjgsQUPibsLFgT$xkGA.f['17']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['73']++;var self=this;__cov_LMJdjgsQUPibsLFgT$xkGA.s['74']++;if(typeof options==='function'){__cov_LMJdjgsQUPibsLFgT$xkGA.b['26'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['75']++;callback=options;__cov_LMJdjgsQUPibsLFgT$xkGA.s['76']++;options={};}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['26'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['77']++;(__cov_LMJdjgsQUPibsLFgT$xkGA.b['27'][0]++,options)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['27'][1]++,options={});__cov_LMJdjgsQUPibsLFgT$xkGA.s['78']++;this.sync('read',options,function(err,response){__cov_LMJdjgsQUPibsLFgT$xkGA.f['18']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['79']++;var facade={options:options,response:response},parsed;__cov_LMJdjgsQUPibsLFgT$xkGA.s['80']++;if(err){__cov_LMJdjgsQUPibsLFgT$xkGA.b['28'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['81']++;facade.error=err;__cov_LMJdjgsQUPibsLFgT$xkGA.s['82']++;facade.src='load';__cov_LMJdjgsQUPibsLFgT$xkGA.s['83']++;self.fire(EVT_ERROR,facade);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['28'][1]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['84']++;if(!self._loadEvent){__cov_LMJdjgsQUPibsLFgT$xkGA.b['29'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['85']++;self._loadEvent=self.publish(EVT_LOAD,{preventable:false});}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['29'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['86']++;parsed=facade.parsed=self._parse(response);__cov_LMJdjgsQUPibsLFgT$xkGA.s['87']++;self.reset(parsed,options);__cov_LMJdjgsQUPibsLFgT$xkGA.s['88']++;self.fire(EVT_LOAD,facade);}__cov_LMJdjgsQUPibsLFgT$xkGA.s['89']++;if(callback){__cov_LMJdjgsQUPibsLFgT$xkGA.b['30'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['90']++;callback.apply(null,arguments);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['30'][1]++;}});__cov_LMJdjgsQUPibsLFgT$xkGA.s['91']++;return this;},map:function(fn,thisObj){__cov_LMJdjgsQUPibsLFgT$xkGA.f['19']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['92']++;return YArray.map(this._items,fn,thisObj);},parse:function(response){__cov_LMJdjgsQUPibsLFgT$xkGA.f['20']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['93']++;if(typeof response==='string'){__cov_LMJdjgsQUPibsLFgT$xkGA.b['31'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['94']++;try{__cov_LMJdjgsQUPibsLFgT$xkGA.s['95']++;return(__cov_LMJdjgsQUPibsLFgT$xkGA.b['32'][0]++,Y.JSON.parse(response))||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['32'][1]++,[]);}catch(ex){__cov_LMJdjgsQUPibsLFgT$xkGA.s['96']++;this.fire(EVT_ERROR,{error:ex,response:response,src:'parse'});__cov_LMJdjgsQUPibsLFgT$xkGA.s['97']++;return null;}}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['31'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['98']++;return(__cov_LMJdjgsQUPibsLFgT$xkGA.b['33'][0]++,response)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['33'][1]++,[]);},remove:function(models,options){__cov_LMJdjgsQUPibsLFgT$xkGA.f['21']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['99']++;var isList=models._isYUIModelList;__cov_LMJdjgsQUPibsLFgT$xkGA.s['100']++;if((__cov_LMJdjgsQUPibsLFgT$xkGA.b['35'][0]++,isList)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['35'][1]++,Lang.isArray(models))){__cov_LMJdjgsQUPibsLFgT$xkGA.b['34'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['101']++;models=YArray.map(isList?(__cov_LMJdjgsQUPibsLFgT$xkGA.b['36'][0]++,models.toArray()):(__cov_LMJdjgsQUPibsLFgT$xkGA.b['36'][1]++,models),function(model){__cov_LMJdjgsQUPibsLFgT$xkGA.f['22']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['102']++;if(Lang.isNumber(model)){__cov_LMJdjgsQUPibsLFgT$xkGA.b['37'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['103']++;return this.item(model);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['37'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['104']++;return model;},this);__cov_LMJdjgsQUPibsLFgT$xkGA.s['105']++;return YArray.map(models,function(model){__cov_LMJdjgsQUPibsLFgT$xkGA.f['23']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['106']++;return this._remove(model,options);},this);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['34'][1]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['107']++;return this._remove(models,options);}},reset:function(models,options){__cov_LMJdjgsQUPibsLFgT$xkGA.f['24']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['108']++;(__cov_LMJdjgsQUPibsLFgT$xkGA.b['38'][0]++,models)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['38'][1]++,models=[]);__cov_LMJdjgsQUPibsLFgT$xkGA.s['109']++;(__cov_LMJdjgsQUPibsLFgT$xkGA.b['39'][0]++,options)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['39'][1]++,options={});__cov_LMJdjgsQUPibsLFgT$xkGA.s['110']++;var facade=Y.merge({src:'reset'},options);__cov_LMJdjgsQUPibsLFgT$xkGA.s['111']++;if(models._isYUIModelList){__cov_LMJdjgsQUPibsLFgT$xkGA.b['40'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['112']++;models=models.toArray();}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['40'][1]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['113']++;models=YArray.map(models,function(model){__cov_LMJdjgsQUPibsLFgT$xkGA.f['25']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['114']++;return model._isYUIModel?(__cov_LMJdjgsQUPibsLFgT$xkGA.b['41'][0]++,model):(__cov_LMJdjgsQUPibsLFgT$xkGA.b['41'][1]++,new this.model(model));},this);}__cov_LMJdjgsQUPibsLFgT$xkGA.s['115']++;facade.models=models;__cov_LMJdjgsQUPibsLFgT$xkGA.s['116']++;if(options.silent){__cov_LMJdjgsQUPibsLFgT$xkGA.b['42'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['117']++;this._defResetFn(facade);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['42'][1]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['118']++;if(this.comparator){__cov_LMJdjgsQUPibsLFgT$xkGA.b['43'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['119']++;models.sort(Y.bind(this._sort,this));}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['43'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['120']++;this.fire(EVT_RESET,facade);}__cov_LMJdjgsQUPibsLFgT$xkGA.s['121']++;return this;},some:function(callback,thisObj){__cov_LMJdjgsQUPibsLFgT$xkGA.f['26']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['122']++;var items=this._items.concat(),i,item,len;__cov_LMJdjgsQUPibsLFgT$xkGA.s['123']++;for(i=0,len=items.length;i<len;i++){__cov_LMJdjgsQUPibsLFgT$xkGA.s['124']++;item=items[i];__cov_LMJdjgsQUPibsLFgT$xkGA.s['125']++;if(callback.call((__cov_LMJdjgsQUPibsLFgT$xkGA.b['45'][0]++,thisObj)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['45'][1]++,item),item,i,this)){__cov_LMJdjgsQUPibsLFgT$xkGA.b['44'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['126']++;return true;}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['44'][1]++;}}__cov_LMJdjgsQUPibsLFgT$xkGA.s['127']++;return false;},sort:function(options){__cov_LMJdjgsQUPibsLFgT$xkGA.f['27']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['128']++;if(!this.comparator){__cov_LMJdjgsQUPibsLFgT$xkGA.b['46'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['129']++;return this;}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['46'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['130']++;var models=this._items.concat(),facade;__cov_LMJdjgsQUPibsLFgT$xkGA.s['131']++;(__cov_LMJdjgsQUPibsLFgT$xkGA.b['47'][0]++,options)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['47'][1]++,options={});__cov_LMJdjgsQUPibsLFgT$xkGA.s['132']++;models.sort(Y.rbind(this._sort,this,options));__cov_LMJdjgsQUPibsLFgT$xkGA.s['133']++;facade=Y.merge(options,{models:models,src:'sort'});__cov_LMJdjgsQUPibsLFgT$xkGA.s['134']++;if(options.silent){__cov_LMJdjgsQUPibsLFgT$xkGA.b['48'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['135']++;this._defResetFn(facade);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['48'][1]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['136']++;this.fire(EVT_RESET,facade);}__cov_LMJdjgsQUPibsLFgT$xkGA.s['137']++;return this;},sync:function(){__cov_LMJdjgsQUPibsLFgT$xkGA.f['28']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['138']++;var callback=YArray(arguments,0,true).pop();__cov_LMJdjgsQUPibsLFgT$xkGA.s['139']++;if(typeof callback==='function'){__cov_LMJdjgsQUPibsLFgT$xkGA.b['49'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['140']++;callback();}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['49'][1]++;}},toArray:function(){__cov_LMJdjgsQUPibsLFgT$xkGA.f['29']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['141']++;return this._items.concat();},toJSON:function(){__cov_LMJdjgsQUPibsLFgT$xkGA.f['30']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['142']++;return this.map(function(model){__cov_LMJdjgsQUPibsLFgT$xkGA.f['31']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['143']++;return model.toJSON();});},_add:function(model,options){__cov_LMJdjgsQUPibsLFgT$xkGA.f['32']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['144']++;var facade,id;__cov_LMJdjgsQUPibsLFgT$xkGA.s['145']++;(__cov_LMJdjgsQUPibsLFgT$xkGA.b['50'][0]++,options)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['50'][1]++,options={});__cov_LMJdjgsQUPibsLFgT$xkGA.s['146']++;if(!model._isYUIModel){__cov_LMJdjgsQUPibsLFgT$xkGA.b['51'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['147']++;model=new this.model(model);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['51'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['148']++;id=model.get('id');__cov_LMJdjgsQUPibsLFgT$xkGA.s['149']++;if((__cov_LMJdjgsQUPibsLFgT$xkGA.b['53'][0]++,this._clientIdMap[model.get('clientId')])||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['53'][1]++,Lang.isValue(id))&&(__cov_LMJdjgsQUPibsLFgT$xkGA.b['53'][2]++,this._idMap[id])){__cov_LMJdjgsQUPibsLFgT$xkGA.b['52'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['150']++;this.fire(EVT_ERROR,{error:'Model is already in the list.',model:model,src:'add'});__cov_LMJdjgsQUPibsLFgT$xkGA.s['151']++;return;}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['52'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['152']++;facade=Y.merge(options,{index:'index'in options?(__cov_LMJdjgsQUPibsLFgT$xkGA.b['54'][0]++,options.index):(__cov_LMJdjgsQUPibsLFgT$xkGA.b['54'][1]++,this._findIndex(model)),model:model});__cov_LMJdjgsQUPibsLFgT$xkGA.s['153']++;if(options.silent){__cov_LMJdjgsQUPibsLFgT$xkGA.b['55'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['154']++;this._defAddFn(facade);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['55'][1]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['155']++;this.fire(EVT_ADD,facade);}__cov_LMJdjgsQUPibsLFgT$xkGA.s['156']++;return model;},_attachList:function(model){__cov_LMJdjgsQUPibsLFgT$xkGA.f['33']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['157']++;model.lists.push(this);__cov_LMJdjgsQUPibsLFgT$xkGA.s['158']++;model.addTarget(this);},_clear:function(){__cov_LMJdjgsQUPibsLFgT$xkGA.f['34']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['159']++;YArray.each(this._items,this._detachList,this);__cov_LMJdjgsQUPibsLFgT$xkGA.s['160']++;this._clientIdMap={};__cov_LMJdjgsQUPibsLFgT$xkGA.s['161']++;this._idMap={};__cov_LMJdjgsQUPibsLFgT$xkGA.s['162']++;this._items=[];},_compare:function(a,b){__cov_LMJdjgsQUPibsLFgT$xkGA.f['35']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['163']++;return a<b?(__cov_LMJdjgsQUPibsLFgT$xkGA.b['56'][0]++,-1):(__cov_LMJdjgsQUPibsLFgT$xkGA.b['56'][1]++,a>b?(__cov_LMJdjgsQUPibsLFgT$xkGA.b['57'][0]++,1):(__cov_LMJdjgsQUPibsLFgT$xkGA.b['57'][1]++,0));},_detachList:function(model){__cov_LMJdjgsQUPibsLFgT$xkGA.f['36']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['164']++;var index=YArray.indexOf(model.lists,this);__cov_LMJdjgsQUPibsLFgT$xkGA.s['165']++;if(index>-1){__cov_LMJdjgsQUPibsLFgT$xkGA.b['58'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['166']++;model.lists.splice(index,1);__cov_LMJdjgsQUPibsLFgT$xkGA.s['167']++;model.removeTarget(this);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['58'][1]++;}},_findIndex:function(model){__cov_LMJdjgsQUPibsLFgT$xkGA.f['37']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['168']++;var items=this._items,max=items.length,min=0,item,middle,needle;__cov_LMJdjgsQUPibsLFgT$xkGA.s['169']++;if((__cov_LMJdjgsQUPibsLFgT$xkGA.b['60'][0]++,!this.comparator)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['60'][1]++,!max)){__cov_LMJdjgsQUPibsLFgT$xkGA.b['59'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['170']++;return max;}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['59'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['171']++;needle=this.comparator(model);__cov_LMJdjgsQUPibsLFgT$xkGA.s['172']++;while(min<max){__cov_LMJdjgsQUPibsLFgT$xkGA.s['173']++;middle=min+max>>1;__cov_LMJdjgsQUPibsLFgT$xkGA.s['174']++;item=items[middle];__cov_LMJdjgsQUPibsLFgT$xkGA.s['175']++;if(this._compare(this.comparator(item),needle)<0){__cov_LMJdjgsQUPibsLFgT$xkGA.b['61'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['176']++;min=middle+1;}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['61'][1]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['177']++;max=middle;}}__cov_LMJdjgsQUPibsLFgT$xkGA.s['178']++;return min;},_parse:function(response){__cov_LMJdjgsQUPibsLFgT$xkGA.f['38']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['179']++;return this.parse(response);},_remove:function(model,options){__cov_LMJdjgsQUPibsLFgT$xkGA.f['39']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['180']++;var index,facade;__cov_LMJdjgsQUPibsLFgT$xkGA.s['181']++;(__cov_LMJdjgsQUPibsLFgT$xkGA.b['62'][0]++,options)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['62'][1]++,options={});__cov_LMJdjgsQUPibsLFgT$xkGA.s['182']++;if(Lang.isNumber(model)){__cov_LMJdjgsQUPibsLFgT$xkGA.b['63'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['183']++;index=model;__cov_LMJdjgsQUPibsLFgT$xkGA.s['184']++;model=this.item(index);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['63'][1]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['185']++;index=this.indexOf(model);}__cov_LMJdjgsQUPibsLFgT$xkGA.s['186']++;if((__cov_LMJdjgsQUPibsLFgT$xkGA.b['65'][0]++,index===-1)||(__cov_LMJdjgsQUPibsLFgT$xkGA.b['65'][1]++,!model)){__cov_LMJdjgsQUPibsLFgT$xkGA.b['64'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['187']++;this.fire(EVT_ERROR,{error:'Model is not in the list.',index:index,model:model,src:'remove'});__cov_LMJdjgsQUPibsLFgT$xkGA.s['188']++;return;}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['64'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['189']++;facade=Y.merge(options,{index:index,model:model});__cov_LMJdjgsQUPibsLFgT$xkGA.s['190']++;if(options.silent){__cov_LMJdjgsQUPibsLFgT$xkGA.b['66'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['191']++;this._defRemoveFn(facade);}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['66'][1]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['192']++;this.fire(EVT_REMOVE,facade);}__cov_LMJdjgsQUPibsLFgT$xkGA.s['193']++;return model;},_sort:function(a,b,options){__cov_LMJdjgsQUPibsLFgT$xkGA.f['40']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['194']++;var result=this._compare(this.comparator(a),this.comparator(b));__cov_LMJdjgsQUPibsLFgT$xkGA.s['195']++;if(result===0){__cov_LMJdjgsQUPibsLFgT$xkGA.b['67'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['196']++;return result;}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['67'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['197']++;return(__cov_LMJdjgsQUPibsLFgT$xkGA.b['69'][0]++,options)&&(__cov_LMJdjgsQUPibsLFgT$xkGA.b['69'][1]++,options.descending)?(__cov_LMJdjgsQUPibsLFgT$xkGA.b['68'][0]++,-result):(__cov_LMJdjgsQUPibsLFgT$xkGA.b['68'][1]++,result);},_afterIdChange:function(e){__cov_LMJdjgsQUPibsLFgT$xkGA.f['41']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['198']++;var newVal=e.newVal,prevVal=e.prevVal,target=e.target;__cov_LMJdjgsQUPibsLFgT$xkGA.s['199']++;if(Lang.isValue(prevVal)){__cov_LMJdjgsQUPibsLFgT$xkGA.b['70'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['200']++;if(this._idMap[prevVal]===target){__cov_LMJdjgsQUPibsLFgT$xkGA.b['71'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['201']++;delete this._idMap[prevVal];}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['71'][1]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['202']++;return;}}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['70'][1]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['203']++;if(this.indexOf(target)===-1){__cov_LMJdjgsQUPibsLFgT$xkGA.b['72'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['204']++;return;}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['72'][1]++;}}__cov_LMJdjgsQUPibsLFgT$xkGA.s['205']++;if(Lang.isValue(newVal)){__cov_LMJdjgsQUPibsLFgT$xkGA.b['73'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['206']++;this._idMap[newVal]=target;}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['73'][1]++;}},_defAddFn:function(e){__cov_LMJdjgsQUPibsLFgT$xkGA.f['42']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['207']++;var model=e.model,id=model.get('id');__cov_LMJdjgsQUPibsLFgT$xkGA.s['208']++;this._clientIdMap[model.get('clientId')]=model;__cov_LMJdjgsQUPibsLFgT$xkGA.s['209']++;if(Lang.isValue(id)){__cov_LMJdjgsQUPibsLFgT$xkGA.b['74'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['210']++;this._idMap[id]=model;}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['74'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['211']++;this._attachList(model);__cov_LMJdjgsQUPibsLFgT$xkGA.s['212']++;this._items.splice(e.index,0,model);},_defRemoveFn:function(e){__cov_LMJdjgsQUPibsLFgT$xkGA.f['43']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['213']++;var model=e.model,id=model.get('id');__cov_LMJdjgsQUPibsLFgT$xkGA.s['214']++;this._detachList(model);__cov_LMJdjgsQUPibsLFgT$xkGA.s['215']++;delete this._clientIdMap[model.get('clientId')];__cov_LMJdjgsQUPibsLFgT$xkGA.s['216']++;if(Lang.isValue(id)){__cov_LMJdjgsQUPibsLFgT$xkGA.b['75'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['217']++;delete this._idMap[id];}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['75'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['218']++;this._items.splice(e.index,1);},_defResetFn:function(e){__cov_LMJdjgsQUPibsLFgT$xkGA.f['44']++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['219']++;if(e.src==='sort'){__cov_LMJdjgsQUPibsLFgT$xkGA.b['76'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['220']++;this._items=e.models.concat();__cov_LMJdjgsQUPibsLFgT$xkGA.s['221']++;return;}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['76'][1]++;}__cov_LMJdjgsQUPibsLFgT$xkGA.s['222']++;this._clear();__cov_LMJdjgsQUPibsLFgT$xkGA.s['223']++;if(e.models.length){__cov_LMJdjgsQUPibsLFgT$xkGA.b['77'][0]++;__cov_LMJdjgsQUPibsLFgT$xkGA.s['224']++;this.add(e.models,{silent:true});}else{__cov_LMJdjgsQUPibsLFgT$xkGA.b['77'][1]++;}}},{NAME:'modelList'});__cov_LMJdjgsQUPibsLFgT$xkGA.s['225']++;Y.augment(ModelList,Y.ArrayList);},'@VERSION@',{'requires':['array-extras','array-invoke','arraylist','base-build','escape','json-parse','model']});
sarmadsangi/cdnjs
ajax/libs/yui/3.13.0/model-list/model-list-coverage.js
JavaScript
mit
107,117
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico"> <meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0"> <title>Responsive example - Configuration option</title> <link rel="stylesheet" type="text/css" href="../../../../media/css/jquery.dataTables.css"> <link rel="stylesheet" type="text/css" href="../../css/dataTables.responsive.css"> <link rel="stylesheet" type="text/css" href="../../../../examples/resources/syntax/shCore.css"> <link rel="stylesheet" type="text/css" href="../../../../examples/resources/demo.css"> <style type="text/css" class="init"> div.container { max-width: 1200px } </style> <script type="text/javascript" language="javascript" src="../../../../media/js/jquery.js"></script> <script type="text/javascript" language="javascript" src="../../../../media/js/jquery.dataTables.js"></script> <script type="text/javascript" language="javascript" src="../../js/dataTables.responsive.js"></script> <script type="text/javascript" language="javascript" src="../../../../examples/resources/syntax/shCore.js"></script> <script type="text/javascript" language="javascript" src="../../../../examples/resources/demo.js"></script> <script type="text/javascript" language="javascript" class="init"> $(document).ready(function() { $('#example').DataTable( { responsive: true } ); } ); </script> </head> <body class="dt-example"> <div class="container"> <section> <h1>Responsive example <span>Configuration option</span></h1> <div class="info"> <p>The Responsive extension for DataTables can be applied to a DataTable in one of two ways; with a specific class name on the table, or using the DataTables initialisation options. This method shows the latter, with the <a href="//datatables.net/extensions/responsive/reference/option/responsive"><code class="option" title="Responsive initialisation option">responsive<span>R</span></code></a> option being set to the boolean value <code>true</code>.</p> <p>The <a href="//datatables.net/extensions/responsive/reference/option/responsive"><code class="option" title= "Responsive initialisation option">responsive<span>R</span></code></a> option can be given as a boolean value, or as an object with configuration options. If as a boolean, as in this case, the default options are used.</p> </div> <table id="example" class="display nowrap" cellspacing="0" width="100%"> <thead> <tr> <th>First name</th> <th>Last name</th> <th>Position</th> <th>Office</th> <th>Age</th> <th>Start date</th> <th>Salary</th> <th>Extn.</th> <th>E-mail</th> </tr> </thead> <tbody> <tr> <td>Tiger</td> <td>Nixon</td> <td>System Architect</td> <td>Edinburgh</td> <td>61</td> <td>2011/04/25</td> <td>$320,800</td> <td>5421</td> <td>t.nixon@datatables.net</td> </tr> <tr> <td>Garrett</td> <td>Winters</td> <td>Accountant</td> <td>Tokyo</td> <td>63</td> <td>2011/07/25</td> <td>$170,750</td> <td>8422</td> <td>g.winters@datatables.net</td> </tr> <tr> <td>Ashton</td> <td>Cox</td> <td>Junior Technical Author</td> <td>San Francisco</td> <td>66</td> <td>2009/01/12</td> <td>$86,000</td> <td>1562</td> <td>a.cox@datatables.net</td> </tr> <tr> <td>Cedric</td> <td>Kelly</td> <td>Senior Javascript Developer</td> <td>Edinburgh</td> <td>22</td> <td>2012/03/29</td> <td>$433,060</td> <td>6224</td> <td>c.kelly@datatables.net</td> </tr> <tr> <td>Airi</td> <td>Satou</td> <td>Accountant</td> <td>Tokyo</td> <td>33</td> <td>2008/11/28</td> <td>$162,700</td> <td>5407</td> <td>a.satou@datatables.net</td> </tr> <tr> <td>Brielle</td> <td>Williamson</td> <td>Integration Specialist</td> <td>New York</td> <td>61</td> <td>2012/12/02</td> <td>$372,000</td> <td>4804</td> <td>b.williamson@datatables.net</td> </tr> <tr> <td>Herrod</td> <td>Chandler</td> <td>Sales Assistant</td> <td>San Francisco</td> <td>59</td> <td>2012/08/06</td> <td>$137,500</td> <td>9608</td> <td>h.chandler@datatables.net</td> </tr> <tr> <td>Rhona</td> <td>Davidson</td> <td>Integration Specialist</td> <td>Tokyo</td> <td>55</td> <td>2010/10/14</td> <td>$327,900</td> <td>6200</td> <td>r.davidson@datatables.net</td> </tr> <tr> <td>Colleen</td> <td>Hurst</td> <td>Javascript Developer</td> <td>San Francisco</td> <td>39</td> <td>2009/09/15</td> <td>$205,500</td> <td>2360</td> <td>c.hurst@datatables.net</td> </tr> <tr> <td>Sonya</td> <td>Frost</td> <td>Software Engineer</td> <td>Edinburgh</td> <td>23</td> <td>2008/12/13</td> <td>$103,600</td> <td>1667</td> <td>s.frost@datatables.net</td> </tr> <tr> <td>Jena</td> <td>Gaines</td> <td>Office Manager</td> <td>London</td> <td>30</td> <td>2008/12/19</td> <td>$90,560</td> <td>3814</td> <td>j.gaines@datatables.net</td> </tr> <tr> <td>Quinn</td> <td>Flynn</td> <td>Support Lead</td> <td>Edinburgh</td> <td>22</td> <td>2013/03/03</td> <td>$342,000</td> <td>9497</td> <td>q.flynn@datatables.net</td> </tr> <tr> <td>Charde</td> <td>Marshall</td> <td>Regional Director</td> <td>San Francisco</td> <td>36</td> <td>2008/10/16</td> <td>$470,600</td> <td>6741</td> <td>c.marshall@datatables.net</td> </tr> <tr> <td>Haley</td> <td>Kennedy</td> <td>Senior Marketing Designer</td> <td>London</td> <td>43</td> <td>2012/12/18</td> <td>$313,500</td> <td>3597</td> <td>h.kennedy@datatables.net</td> </tr> <tr> <td>Tatyana</td> <td>Fitzpatrick</td> <td>Regional Director</td> <td>London</td> <td>19</td> <td>2010/03/17</td> <td>$385,750</td> <td>1965</td> <td>t.fitzpatrick@datatables.net</td> </tr> <tr> <td>Michael</td> <td>Silva</td> <td>Marketing Designer</td> <td>London</td> <td>66</td> <td>2012/11/27</td> <td>$198,500</td> <td>1581</td> <td>m.silva@datatables.net</td> </tr> <tr> <td>Paul</td> <td>Byrd</td> <td>Chief Financial Officer (CFO)</td> <td>New York</td> <td>64</td> <td>2010/06/09</td> <td>$725,000</td> <td>3059</td> <td>p.byrd@datatables.net</td> </tr> <tr> <td>Gloria</td> <td>Little</td> <td>Systems Administrator</td> <td>New York</td> <td>59</td> <td>2009/04/10</td> <td>$237,500</td> <td>1721</td> <td>g.little@datatables.net</td> </tr> <tr> <td>Bradley</td> <td>Greer</td> <td>Software Engineer</td> <td>London</td> <td>41</td> <td>2012/10/13</td> <td>$132,000</td> <td>2558</td> <td>b.greer@datatables.net</td> </tr> <tr> <td>Dai</td> <td>Rios</td> <td>Personnel Lead</td> <td>Edinburgh</td> <td>35</td> <td>2012/09/26</td> <td>$217,500</td> <td>2290</td> <td>d.rios@datatables.net</td> </tr> <tr> <td>Jenette</td> <td>Caldwell</td> <td>Development Lead</td> <td>New York</td> <td>30</td> <td>2011/09/03</td> <td>$345,000</td> <td>1937</td> <td>j.caldwell@datatables.net</td> </tr> <tr> <td>Yuri</td> <td>Berry</td> <td>Chief Marketing Officer (CMO)</td> <td>New York</td> <td>40</td> <td>2009/06/25</td> <td>$675,000</td> <td>6154</td> <td>y.berry@datatables.net</td> </tr> <tr> <td>Caesar</td> <td>Vance</td> <td>Pre-Sales Support</td> <td>New York</td> <td>21</td> <td>2011/12/12</td> <td>$106,450</td> <td>8330</td> <td>c.vance@datatables.net</td> </tr> <tr> <td>Doris</td> <td>Wilder</td> <td>Sales Assistant</td> <td>Sidney</td> <td>23</td> <td>2010/09/20</td> <td>$85,600</td> <td>3023</td> <td>d.wilder@datatables.net</td> </tr> <tr> <td>Angelica</td> <td>Ramos</td> <td>Chief Executive Officer (CEO)</td> <td>London</td> <td>47</td> <td>2009/10/09</td> <td>$1,200,000</td> <td>5797</td> <td>a.ramos@datatables.net</td> </tr> <tr> <td>Gavin</td> <td>Joyce</td> <td>Developer</td> <td>Edinburgh</td> <td>42</td> <td>2010/12/22</td> <td>$92,575</td> <td>8822</td> <td>g.joyce@datatables.net</td> </tr> <tr> <td>Jennifer</td> <td>Chang</td> <td>Regional Director</td> <td>Singapore</td> <td>28</td> <td>2010/11/14</td> <td>$357,650</td> <td>9239</td> <td>j.chang@datatables.net</td> </tr> <tr> <td>Brenden</td> <td>Wagner</td> <td>Software Engineer</td> <td>San Francisco</td> <td>28</td> <td>2011/06/07</td> <td>$206,850</td> <td>1314</td> <td>b.wagner@datatables.net</td> </tr> <tr> <td>Fiona</td> <td>Green</td> <td>Chief Operating Officer (COO)</td> <td>San Francisco</td> <td>48</td> <td>2010/03/11</td> <td>$850,000</td> <td>2947</td> <td>f.green@datatables.net</td> </tr> <tr> <td>Shou</td> <td>Itou</td> <td>Regional Marketing</td> <td>Tokyo</td> <td>20</td> <td>2011/08/14</td> <td>$163,000</td> <td>8899</td> <td>s.itou@datatables.net</td> </tr> <tr> <td>Michelle</td> <td>House</td> <td>Integration Specialist</td> <td>Sidney</td> <td>37</td> <td>2011/06/02</td> <td>$95,400</td> <td>2769</td> <td>m.house@datatables.net</td> </tr> <tr> <td>Suki</td> <td>Burks</td> <td>Developer</td> <td>London</td> <td>53</td> <td>2009/10/22</td> <td>$114,500</td> <td>6832</td> <td>s.burks@datatables.net</td> </tr> <tr> <td>Prescott</td> <td>Bartlett</td> <td>Technical Author</td> <td>London</td> <td>27</td> <td>2011/05/07</td> <td>$145,000</td> <td>3606</td> <td>p.bartlett@datatables.net</td> </tr> <tr> <td>Gavin</td> <td>Cortez</td> <td>Team Leader</td> <td>San Francisco</td> <td>22</td> <td>2008/10/26</td> <td>$235,500</td> <td>2860</td> <td>g.cortez@datatables.net</td> </tr> <tr> <td>Martena</td> <td>Mccray</td> <td>Post-Sales support</td> <td>Edinburgh</td> <td>46</td> <td>2011/03/09</td> <td>$324,050</td> <td>8240</td> <td>m.mccray@datatables.net</td> </tr> <tr> <td>Unity</td> <td>Butler</td> <td>Marketing Designer</td> <td>San Francisco</td> <td>47</td> <td>2009/12/09</td> <td>$85,675</td> <td>5384</td> <td>u.butler@datatables.net</td> </tr> <tr> <td>Howard</td> <td>Hatfield</td> <td>Office Manager</td> <td>San Francisco</td> <td>51</td> <td>2008/12/16</td> <td>$164,500</td> <td>7031</td> <td>h.hatfield@datatables.net</td> </tr> <tr> <td>Hope</td> <td>Fuentes</td> <td>Secretary</td> <td>San Francisco</td> <td>41</td> <td>2010/02/12</td> <td>$109,850</td> <td>6318</td> <td>h.fuentes@datatables.net</td> </tr> <tr> <td>Vivian</td> <td>Harrell</td> <td>Financial Controller</td> <td>San Francisco</td> <td>62</td> <td>2009/02/14</td> <td>$452,500</td> <td>9422</td> <td>v.harrell@datatables.net</td> </tr> <tr> <td>Timothy</td> <td>Mooney</td> <td>Office Manager</td> <td>London</td> <td>37</td> <td>2008/12/11</td> <td>$136,200</td> <td>7580</td> <td>t.mooney@datatables.net</td> </tr> <tr> <td>Jackson</td> <td>Bradshaw</td> <td>Director</td> <td>New York</td> <td>65</td> <td>2008/09/26</td> <td>$645,750</td> <td>1042</td> <td>j.bradshaw@datatables.net</td> </tr> <tr> <td>Olivia</td> <td>Liang</td> <td>Support Engineer</td> <td>Singapore</td> <td>64</td> <td>2011/02/03</td> <td>$234,500</td> <td>2120</td> <td>o.liang@datatables.net</td> </tr> <tr> <td>Bruno</td> <td>Nash</td> <td>Software Engineer</td> <td>London</td> <td>38</td> <td>2011/05/03</td> <td>$163,500</td> <td>6222</td> <td>b.nash@datatables.net</td> </tr> <tr> <td>Sakura</td> <td>Yamamoto</td> <td>Support Engineer</td> <td>Tokyo</td> <td>37</td> <td>2009/08/19</td> <td>$139,575</td> <td>9383</td> <td>s.yamamoto@datatables.net</td> </tr> <tr> <td>Thor</td> <td>Walton</td> <td>Developer</td> <td>New York</td> <td>61</td> <td>2013/08/11</td> <td>$98,540</td> <td>8327</td> <td>t.walton@datatables.net</td> </tr> <tr> <td>Finn</td> <td>Camacho</td> <td>Support Engineer</td> <td>San Francisco</td> <td>47</td> <td>2009/07/07</td> <td>$87,500</td> <td>2927</td> <td>f.camacho@datatables.net</td> </tr> <tr> <td>Serge</td> <td>Baldwin</td> <td>Data Coordinator</td> <td>Singapore</td> <td>64</td> <td>2012/04/09</td> <td>$138,575</td> <td>8352</td> <td>s.baldwin@datatables.net</td> </tr> <tr> <td>Zenaida</td> <td>Frank</td> <td>Software Engineer</td> <td>New York</td> <td>63</td> <td>2010/01/04</td> <td>$125,250</td> <td>7439</td> <td>z.frank@datatables.net</td> </tr> <tr> <td>Zorita</td> <td>Serrano</td> <td>Software Engineer</td> <td>San Francisco</td> <td>56</td> <td>2012/06/01</td> <td>$115,000</td> <td>4389</td> <td>z.serrano@datatables.net</td> </tr> <tr> <td>Jennifer</td> <td>Acosta</td> <td>Junior Javascript Developer</td> <td>Edinburgh</td> <td>43</td> <td>2013/02/01</td> <td>$75,650</td> <td>3431</td> <td>j.acosta@datatables.net</td> </tr> <tr> <td>Cara</td> <td>Stevens</td> <td>Sales Assistant</td> <td>New York</td> <td>46</td> <td>2011/12/06</td> <td>$145,600</td> <td>3990</td> <td>c.stevens@datatables.net</td> </tr> <tr> <td>Hermione</td> <td>Butler</td> <td>Regional Director</td> <td>London</td> <td>47</td> <td>2011/03/21</td> <td>$356,250</td> <td>1016</td> <td>h.butler@datatables.net</td> </tr> <tr> <td>Lael</td> <td>Greer</td> <td>Systems Administrator</td> <td>London</td> <td>21</td> <td>2009/02/27</td> <td>$103,500</td> <td>6733</td> <td>l.greer@datatables.net</td> </tr> <tr> <td>Jonas</td> <td>Alexander</td> <td>Developer</td> <td>San Francisco</td> <td>30</td> <td>2010/07/14</td> <td>$86,500</td> <td>8196</td> <td>j.alexander@datatables.net</td> </tr> <tr> <td>Shad</td> <td>Decker</td> <td>Regional Director</td> <td>Edinburgh</td> <td>51</td> <td>2008/11/13</td> <td>$183,000</td> <td>6373</td> <td>s.decker@datatables.net</td> </tr> <tr> <td>Michael</td> <td>Bruce</td> <td>Javascript Developer</td> <td>Singapore</td> <td>29</td> <td>2011/06/27</td> <td>$183,000</td> <td>5384</td> <td>m.bruce@datatables.net</td> </tr> <tr> <td>Donna</td> <td>Snider</td> <td>Customer Support</td> <td>New York</td> <td>27</td> <td>2011/01/25</td> <td>$112,000</td> <td>4226</td> <td>d.snider@datatables.net</td> </tr> </tbody> </table> <ul class="tabs"> <li class="active">Javascript</li> <li>HTML</li> <li>CSS</li> <li>Ajax</li> <li>Server-side script</li> </ul> <div class="tabs"> <div class="js"> <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() { $('#example').DataTable( { responsive: true } ); } );</code> <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p> <ul> <li><a href="../../../../media/js/jquery.js">../../../../media/js/jquery.js</a></li> <li><a href="../../../../media/js/jquery.dataTables.js">../../../../media/js/jquery.dataTables.js</a></li> <li><a href="../../js/dataTables.responsive.js">../../js/dataTables.responsive.js</a></li> </ul> </div> <div class="table"> <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p> </div> <div class="css"> <div> <p>This example uses a little bit of additional CSS beyond what is loaded from the library files (below), in order to correctly display the table. The additional CSS used is shown below:</p><code class="multiline language-css">div.container { max-width: 1200px }</code> </div> <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p> <ul> <li><a href="../../../../media/css/jquery.dataTables.css">../../../../media/css/jquery.dataTables.css</a></li> <li><a href="../../css/dataTables.responsive.css">../../css/dataTables.responsive.css</a></li> </ul> </div> <div class="ajax"> <p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data will update automatically as any additional data is loaded.</p> </div> <div class="php"> <p>The script used to perform the server-side processing for this table is shown below. Please note that this is just an example script using PHP. Server-side processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables documentation</a>.</p> </div> </div> </section> </div> <section> <div class="footer"> <div class="gradient"></div> <div class="liner"> <h2>Other examples</h2> <div class="toc"> <div class="toc-group"> <h3><a href="./index.html">Basic initialisation</a></h3> <ul class="toc active"> <li><a href="./className.html">Class name</a></li> <li class="active"><a href="./option.html">Configuration option</a></li> <li><a href="./new.html">`new` constructor</a></li> <li><a href="./ajax.html">Ajax data</a></li> <li><a href="./default.html">Default initialisation</a></li> </ul> </div> <div class="toc-group"> <h3><a href="../styling/index.html">Styling</a></h3> <ul class="toc"> <li><a href="../styling/bootstrap.html">Bootstrap styling</a></li> <li><a href="../styling/foundation.html">Foundation styling</a></li> <li><a href="../styling/scrolling.html">Vertical scrolling</a></li> <li><a href="../styling/compact.html">Compact styling</a></li> </ul> </div> <div class="toc-group"> <h3><a href="../display-control/index.html">Display control</a></h3> <ul class="toc"> <li><a href="../display-control/auto.html">Automatic column hiding</a></li> <li><a href="../display-control/classes.html">Class control</a></li> <li><a href="../display-control/init-classes.html">Assigned class control</a></li> <li><a href="../display-control/fixedHeader.html">With FixedHeader</a></li> <li><a href="../display-control/complexHeader.html">Complex headers (rowspan / colspan)</a></li> </ul> </div> <div class="toc-group"> <h3><a href="../child-rows/index.html">Child rows</a></h3> <ul class="toc"> <li><a href="../child-rows/disable-child-rows.html">Disable child rows</a></li> <li><a href="../child-rows/column-control.html">Column controlled child rows</a></li> <li><a href="../child-rows/right-column.html">Column control - right</a></li> <li><a href="../child-rows/whole-row-control.html">Whole row child row control</a></li> <li><a href="../child-rows/custom-renderer.html">Custom child row renderer</a></li> </ul> </div> </div> <div class="epilogue"> <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br> Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and <a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of DataTables.</p> <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2015<br> DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p> </div> </div> </div> </section> </body> </html>
juaalta/cubieboard-monitor
plugins/datatables/extensions/Responsive/examples/initialisation/option.html
HTML
mit
22,281
<?php /** * CodeIgniter * * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * * Copyright (c) 2014 - 2015, British Columbia Institute of Technology * * 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. * * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 2.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); /** * CodeIgniter File Caching Class * * @package CodeIgniter * @subpackage Libraries * @category Core * @author EllisLab Dev Team * @link */ class CI_Cache_file extends CI_Driver { /** * Directory in which to save cache files * * @var string */ protected $_cache_path; /** * Initialize file-based cache * * @return void */ public function __construct() { $CI =& get_instance(); $CI->load->helper('file'); $path = $CI->config->item('cache_path'); $this->_cache_path = ($path === '') ? APPPATH.'cache/' : $path; } // ------------------------------------------------------------------------ /** * Fetch from cache * * @param string $id Cache ID * @return mixed Data on success, FALSE on failure */ public function get($id) { $data = $this->_get($id); return is_array($data) ? $data['data'] : FALSE; } // ------------------------------------------------------------------------ /** * Save into cache * * @param string $id Cache ID * @param mixed $data Data to store * @param int $ttl Time to live in seconds * @param bool $raw Whether to store the raw value (unused) * @return bool TRUE on success, FALSE on failure */ public function save($id, $data, $ttl = 60, $raw = FALSE) { $contents = array( 'time' => time(), 'ttl' => $ttl, 'data' => $data ); if (write_file($this->_cache_path.$id, serialize($contents))) { chmod($this->_cache_path.$id, 0640); return TRUE; } return FALSE; } // ------------------------------------------------------------------------ /** * Delete from Cache * * @param mixed unique identifier of item in cache * @return bool true on success/false on failure */ public function delete($id) { return file_exists($this->_cache_path.$id) ? unlink($this->_cache_path.$id) : FALSE; } // ------------------------------------------------------------------------ /** * Increment a raw value * * @param string $id Cache ID * @param int $offset Step/value to add * @return New value on success, FALSE on failure */ public function increment($id, $offset = 1) { $data = $this->_get($id); if ($data === FALSE) { $data = array('data' => 0, 'ttl' => 60); } elseif ( ! is_int($data['data'])) { return FALSE; } $new_value = $data['data'] + $offset; return $this->save($id, $new_value, $data['ttl']) ? $new_value : FALSE; } // ------------------------------------------------------------------------ /** * Decrement a raw value * * @param string $id Cache ID * @param int $offset Step/value to reduce by * @return New value on success, FALSE on failure */ public function decrement($id, $offset = 1) { $data = $this->_get($id); if ($data === FALSE) { $data = array('data' => 0, 'ttl' => 60); } elseif ( ! is_int($data['data'])) { return FALSE; } $new_value = $data['data'] - $offset; return $this->save($id, $new_value, $data['ttl']) ? $new_value : FALSE; } // ------------------------------------------------------------------------ /** * Clean the Cache * * @return bool false on failure/true on success */ public function clean() { return delete_files($this->_cache_path, FALSE, TRUE); } // ------------------------------------------------------------------------ /** * Cache Info * * Not supported by file-based caching * * @param string user/filehits * @return mixed FALSE */ public function cache_info($type = NULL) { return get_dir_file_info($this->_cache_path); } // ------------------------------------------------------------------------ /** * Get Cache Metadata * * @param mixed key to get cache metadata on * @return mixed FALSE on failure, array on success. */ public function get_metadata($id) { if ( ! file_exists($this->_cache_path.$id)) { return FALSE; } $data = unserialize(file_get_contents($this->_cache_path.$id)); if (is_array($data)) { $mtime = filemtime($this->_cache_path.$id); if ( ! isset($data['ttl'])) { return FALSE; } return array( 'expire' => $mtime + $data['ttl'], 'mtime' => $mtime ); } return FALSE; } // ------------------------------------------------------------------------ /** * Is supported * * In the file driver, check to see that the cache directory is indeed writable * * @return bool */ public function is_supported() { return is_really_writable($this->_cache_path); } // ------------------------------------------------------------------------ /** * Get all data * * Internal method to get all the relevant data about a cache item * * @param string $id Cache ID * @return mixed Data array on success or FALSE on failure */ protected function _get($id) { if ( ! file_exists($this->_cache_path.$id)) { return FALSE; } $data = unserialize(file_get_contents($this->_cache_path.$id)); if ($data['ttl'] > 0 && time() > $data['time'] + $data['ttl']) { unlink($this->_cache_path.$id); return FALSE; } return $data; } }
pujie/rent_car_willisyudhatama
system/libraries/Cache/drivers/Cache_file.php
PHP
mit
6,811
CodeMirror.defineMode("groovy", function(config) { function words(str) { var obj = {}, words = str.split(" "); for (var i = 0; i < words.length; ++i) obj[words[i]] = true; return obj; } var keywords = words( "abstract as assert boolean break byte case catch char class const continue def default " + "do double else enum extends final finally float for goto if implements import in " + "instanceof int interface long native new package private protected public return " + "short static strictfp super switch synchronized threadsafe throw throws transient " + "try void volatile while"); var blockKeywords = words("catch class do else finally for if switch try while enum interface def"); var atoms = words("null true false this"); var curPunc; function tokenBase(stream, state) { var ch = stream.next(); if (ch == '"' || ch == "'") { return startString(ch, stream, state); } if (/[\[\]{}\(\),;\:\.]/.test(ch)) { curPunc = ch; return null; } if (/\d/.test(ch)) { stream.eatWhile(/[\w\.]/); if (stream.eat(/eE/)) { stream.eat(/\+\-/); stream.eatWhile(/\d/); } return "number"; } if (ch == "/") { if (stream.eat("*")) { state.tokenize.push(tokenComment); return tokenComment(stream, state); } if (stream.eat("/")) { stream.skipToEnd(); return "comment"; } if (expectExpression(state.lastToken)) { return startString(ch, stream, state); } } if (ch == "-" && stream.eat(">")) { curPunc = "->"; return null; } if (/[+\-*&%=<>!?|\/~]/.test(ch)) { stream.eatWhile(/[+\-*&%=<>|~]/); return "operator"; } stream.eatWhile(/[\w\$_]/); if (ch == "@") { stream.eatWhile(/[\w\$_\.]/); return "meta"; } if (state.lastToken == ".") return "property"; if (stream.eat(":")) { curPunc = "proplabel"; return "property"; } var cur = stream.current(); if (atoms.propertyIsEnumerable(cur)) { return "atom"; } if (keywords.propertyIsEnumerable(cur)) { if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; return "keyword"; } return "variable"; } tokenBase.isBase = true; function startString(quote, stream, state) { var tripleQuoted = false; if (quote != "/" && stream.eat(quote)) { if (stream.eat(quote)) tripleQuoted = true; else return "string"; } function t(stream, state) { var escaped = false, next, end = !tripleQuoted; while ((next = stream.next()) != null) { if (next == quote && !escaped) { if (!tripleQuoted) { break; } if (stream.match(quote + quote)) { end = true; break; } } if (quote == '"' && next == "$" && !escaped && stream.eat("{")) { state.tokenize.push(tokenBaseUntilBrace()); return "string"; } escaped = !escaped && next == "\\"; } if (end) state.tokenize.pop(); return "string"; } state.tokenize.push(t); return t(stream, state); } function tokenBaseUntilBrace() { var depth = 1; function t(stream, state) { if (stream.peek() == "}") { depth--; if (depth == 0) { state.tokenize.pop(); return state.tokenize[state.tokenize.length-1](stream, state); } } else if (stream.peek() == "{") { depth++; } return tokenBase(stream, state); } t.isBase = true; return t; } function tokenComment(stream, state) { var maybeEnd = false, ch; while (ch = stream.next()) { if (ch == "/" && maybeEnd) { state.tokenize.pop(); break; } maybeEnd = (ch == "*"); } return "comment"; } function expectExpression(last) { return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) || last == "newstatement" || last == "keyword" || last == "proplabel"; } function Context(indented, column, type, align, prev) { this.indented = indented; this.column = column; this.type = type; this.align = align; this.prev = prev; } function pushContext(state, col, type) { return state.context = new Context(state.indented, col, type, null, state.context); } function popContext(state) { var t = state.context.type; if (t == ")" || t == "]" || t == "}") state.indented = state.context.indented; return state.context = state.context.prev; } // Interface return { startState: function(basecolumn) { return { tokenize: [tokenBase], context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false), indented: 0, startOfLine: true, lastToken: null }; }, token: function(stream, state) { var ctx = state.context; if (stream.sol()) { if (ctx.align == null) ctx.align = false; state.indented = stream.indentation(); state.startOfLine = true; // Automatic semicolon insertion if (ctx.type == "statement" && !expectExpression(state.lastToken)) { popContext(state); ctx = state.context; } } if (stream.eatSpace()) return null; curPunc = null; var style = state.tokenize[state.tokenize.length-1](stream, state); if (style == "comment") return style; if (ctx.align == null) ctx.align = true; if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state); // Handle indentation for {x -> \n ... } else if (curPunc == "->" && ctx.type == "statement" && ctx.prev.type == "}") { popContext(state); state.context.align = false; } else if (curPunc == "{") pushContext(state, stream.column(), "}"); else if (curPunc == "[") pushContext(state, stream.column(), "]"); else if (curPunc == "(") pushContext(state, stream.column(), ")"); else if (curPunc == "}") { while (ctx.type == "statement") ctx = popContext(state); if (ctx.type == "}") ctx = popContext(state); while (ctx.type == "statement") ctx = popContext(state); } else if (curPunc == ctx.type) popContext(state); else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement")) pushContext(state, stream.column(), "statement"); state.startOfLine = false; state.lastToken = curPunc || style; return style; }, indent: function(state, textAfter) { if (!state.tokenize[state.tokenize.length-1].isBase) return 0; var firstChar = textAfter && textAfter.charAt(0), ctx = state.context; if (ctx.type == "statement" && !expectExpression(state.lastToken)) ctx = ctx.prev; var closing = firstChar == ctx.type; if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit); else if (ctx.align) return ctx.column + (closing ? 0 : 1); else return ctx.indented + (closing ? 0 : config.indentUnit); }, electricChars: "{}", fold: "brace" }; }); CodeMirror.defineMIME("text/x-groovy", "groovy");
platanus/cdnjs
ajax/libs/codemirror/3.17.0/mode/groovy/groovy.js
JavaScript
mit
7,164
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "posz.", "b\u00fcz." ], "DAY": [ "sudel", "mudel", "tudel", "vedel", "d\u00f6del", "fridel", "z\u00e4del" ], "ERANAMES": [ "b. t. kr.", "p. t. kr." ], "ERAS": [ "b. t. kr.", "p. t. kr." ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "janul", "febul", "m\u00e4zil", "prilul", "mayul", "yunul", "yulul", "gustul", "setul", "tobul", "novul", "dekul" ], "SHORTDAY": [ "su.", "mu.", "tu.", "ve.", "d\u00f6.", "fr.", "z\u00e4." ], "SHORTMONTH": [ "jan", "feb", "m\u00e4z", "prl", "may", "yun", "yul", "gst", "set", "ton", "nov", "dek" ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "y MMMMa 'd'. d'id'", "longDate": "y MMMM d", "medium": "y MMM. d HH:mm:ss", "mediumDate": "y MMM. d", "mediumTime": "HH:mm:ss", "short": "y-MM-dd HH:mm", "shortDate": "y-MM-dd", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "$", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4\u00a0-", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "vo", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
victorjonsson/cdnjs
ajax/libs/angular.js/1.4.0-rc.1/i18n/angular-locale_vo.js
JavaScript
mit
2,495
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "posz.", "b\u00fcz." ], "DAY": [ "sudel", "mudel", "tudel", "vedel", "d\u00f6del", "fridel", "z\u00e4del" ], "ERANAMES": [ "b. t. kr.", "p. t. kr." ], "ERAS": [ "b. t. kr.", "p. t. kr." ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "janul", "febul", "m\u00e4zil", "prilul", "mayul", "yunul", "yulul", "gustul", "setul", "tobul", "novul", "dekul" ], "SHORTDAY": [ "su.", "mu.", "tu.", "ve.", "d\u00f6.", "fr.", "z\u00e4." ], "SHORTMONTH": [ "jan", "feb", "m\u00e4z", "prl", "may", "yun", "yul", "gst", "set", "ton", "nov", "dek" ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "y MMMMa 'd'. d'id'", "longDate": "y MMMM d", "medium": "y MMM. d HH:mm:ss", "mediumDate": "y MMM. d", "mediumTime": "HH:mm:ss", "short": "y-MM-dd HH:mm", "shortDate": "y-MM-dd", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "$", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4\u00a0-", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "vo", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
sajochiu/cdnjs
ajax/libs/angular.js/1.5.0-beta.1/i18n/angular-locale_vo.js
JavaScript
mit
2,495
/*! tauCharts - v0.1.12 - 2014-11-21 * https://github.com/TargetProcess/tauCharts * Copyright (c) 2014 Taucraft Limited; Licensed Creative Commons */ !function(a){if("function"==typeof define&&define.amd)define(["tauCharts"],function(b){return a(b)});else if("object"==typeof module&&module.exports){var b=require("tauCharts");module.exports=a(b)}else a(this.tauCharts)}(function(a){var b={YlGn:{3:["#f7fcb9","#addd8e","#31a354"],4:["#ffffcc","#c2e699","#78c679","#238443"],5:["#ffffcc","#c2e699","#78c679","#31a354","#006837"],6:["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],7:["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],8:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],9:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]},YlGnBu:{3:["#edf8b1","#7fcdbb","#2c7fb8"],4:["#ffffcc","#a1dab4","#41b6c4","#225ea8"],5:["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],6:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],7:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],8:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],9:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},GnBu:{3:["#e0f3db","#a8ddb5","#43a2ca"],4:["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],5:["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],6:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],7:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],8:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],9:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]},BuGn:{3:["#e5f5f9","#99d8c9","#2ca25f"],4:["#edf8fb","#b2e2e2","#66c2a4","#238b45"],5:["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],6:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],7:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],8:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],9:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]},PuBuGn:{3:["#ece2f0","#a6bddb","#1c9099"],4:["#f6eff7","#bdc9e1","#67a9cf","#02818a"],5:["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],6:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],7:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],8:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],9:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]},PuBu:{3:["#ece7f2","#a6bddb","#2b8cbe"],4:["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],5:["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],6:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],7:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],8:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],9:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]},BuPu:{3:["#e0ecf4","#9ebcda","#8856a7"],4:["#edf8fb","#b3cde3","#8c96c6","#88419d"],5:["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],6:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],7:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],8:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],9:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]},RdPu:{3:["#fde0dd","#fa9fb5","#c51b8a"],4:["#feebe2","#fbb4b9","#f768a1","#ae017e"],5:["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],6:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],7:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],8:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],9:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]},PuRd:{3:["#e7e1ef","#c994c7","#dd1c77"],4:["#f1eef6","#d7b5d8","#df65b0","#ce1256"],5:["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],6:["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],7:["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],8:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],9:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]},OrRd:{3:["#fee8c8","#fdbb84","#e34a33"],4:["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],5:["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],6:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],7:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],8:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],9:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]},YlOrRd:{3:["#ffeda0","#feb24c","#f03b20"],4:["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],5:["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],6:["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],7:["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],8:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],9:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]},YlOrBr:{3:["#fff7bc","#fec44f","#d95f0e"],4:["#ffffd4","#fed98e","#fe9929","#cc4c02"],5:["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],6:["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],7:["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],8:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],9:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]},Purples:{3:["#efedf5","#bcbddc","#756bb1"],4:["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],5:["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],6:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],7:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],8:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],9:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]},Blues:{3:["#deebf7","#9ecae1","#3182bd"],4:["#eff3ff","#bdd7e7","#6baed6","#2171b5"],5:["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],6:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],7:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],8:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],9:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]},Greens:{3:["#e5f5e0","#a1d99b","#31a354"],4:["#edf8e9","#bae4b3","#74c476","#238b45"],5:["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],6:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],7:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],8:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],9:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]},Oranges:{3:["#fee6ce","#fdae6b","#e6550d"],4:["#feedde","#fdbe85","#fd8d3c","#d94701"],5:["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],6:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],7:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],8:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],9:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]},Reds:{3:["#fee0d2","#fc9272","#de2d26"],4:["#fee5d9","#fcae91","#fb6a4a","#cb181d"],5:["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],6:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],7:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],8:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],9:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]},Greys:{3:["#f0f0f0","#bdbdbd","#636363"],4:["#f7f7f7","#cccccc","#969696","#525252"],5:["#f7f7f7","#cccccc","#969696","#636363","#252525"],6:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],7:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],8:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],9:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]},PuOr:{3:["#f1a340","#f7f7f7","#998ec3"],4:["#e66101","#fdb863","#b2abd2","#5e3c99"],5:["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],6:["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],7:["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],8:["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],9:["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],10:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],11:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]},BrBG:{3:["#d8b365","#f5f5f5","#5ab4ac"],4:["#a6611a","#dfc27d","#80cdc1","#018571"],5:["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],6:["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],7:["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],8:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],9:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],10:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],11:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]},PRGn:{3:["#af8dc3","#f7f7f7","#7fbf7b"],4:["#7b3294","#c2a5cf","#a6dba0","#008837"],5:["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],6:["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],7:["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],8:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],9:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],10:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],11:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]},PiYG:{3:["#e9a3c9","#f7f7f7","#a1d76a"],4:["#d01c8b","#f1b6da","#b8e186","#4dac26"],5:["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],6:["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],7:["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],8:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],9:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],10:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],11:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]},RdBu:{3:["#ef8a62","#f7f7f7","#67a9cf"],4:["#ca0020","#f4a582","#92c5de","#0571b0"],5:["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],6:["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],7:["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]},RdGy:{3:["#ef8a62","#ffffff","#999999"],4:["#ca0020","#f4a582","#bababa","#404040"],5:["#ca0020","#f4a582","#ffffff","#bababa","#404040"],6:["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],7:["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]},RdYlBu:{3:["#fc8d59","#ffffbf","#91bfdb"],4:["#d7191c","#fdae61","#abd9e9","#2c7bb6"],5:["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],6:["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],7:["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],8:["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],9:["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]},Spectral:{3:["#fc8d59","#ffffbf","#99d594"],4:["#d7191c","#fdae61","#abdda4","#2b83ba"],5:["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],6:["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],7:["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],8:["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],9:["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],10:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],11:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]},RdYlGn:{3:["#fc8d59","#ffffbf","#91cf60"],4:["#d7191c","#fdae61","#a6d96a","#1a9641"],5:["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],6:["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],7:["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],8:["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],9:["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]},Accent:{3:["#7fc97f","#beaed4","#fdc086"],4:["#7fc97f","#beaed4","#fdc086","#ffff99"],5:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],6:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],7:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],8:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]},Dark2:{3:["#1b9e77","#d95f02","#7570b3"],4:["#1b9e77","#d95f02","#7570b3","#e7298a"],5:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],6:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],7:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],8:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]},Paired:{3:["#a6cee3","#1f78b4","#b2df8a"],4:["#a6cee3","#1f78b4","#b2df8a","#33a02c"],5:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],6:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],7:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],8:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],9:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],10:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],11:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],12:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]},Pastel1:{3:["#fbb4ae","#b3cde3","#ccebc5"],4:["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],5:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],6:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],7:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],8:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],9:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},Pastel2:{3:["#b3e2cd","#fdcdac","#cbd5e8"],4:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],5:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],6:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],7:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],8:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]},Set1:{3:["#e41a1c","#377eb8","#4daf4a"],4:["#e41a1c","#377eb8","#4daf4a","#984ea3"],5:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],6:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],7:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],8:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],9:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]},Set2:{3:["#66c2a5","#fc8d62","#8da0cb"],4:["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],5:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],6:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],7:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],8:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"]},Set3:{3:["#8dd3c7","#ffffb3","#bebada"],4:["#8dd3c7","#ffffb3","#bebada","#fb8072"],5:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],6:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],7:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],8:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],9:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],10:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],11:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],12:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]}},c=function(a,c){return b[a][c].map(function(b,d){return a+" q"+d+"-"+c})};return a.api.colorBrewers.add("tauBrewer",c),c});
vousk/jsdelivr
files/taucharts/0.1.12/color-brewer.min.js
JavaScript
mit
18,770
<!DOCTYPE html> <!-- Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license --> <html> <head> <meta charset="utf-8"> <title>CKEditor Sample</title> <script src="../ckeditor.js"></script> <script src="js/sample.js"></script> <link rel="stylesheet" href="css/samples.css"> <link rel="stylesheet" href="toolbarconfigurator/lib/codemirror/neo.css"> </head> <body id="main"> <nav class="navigation-a"> <div class="grid-container"> <ul class="navigation-a-left grid-width-70"> <li><a href="http://ckeditor.com">Project Homepage</a></li> <li><a href="http://dev.ckeditor.com/">I found a bug</a></li> <li><a href="http://github.com/ckeditor/ckeditor-dev" class="icon-pos-right icon-navigation-a-github">Fork CKEditor on GitHub</a></li> </ul> <ul class="navigation-a-right grid-width-30"> <li><a href="http://ckeditor.com/blog-list">CKEditor Blog</a></li> </ul> </div> </nav> <header class="header-a"> <div class="grid-container"> <h1 class="header-a-logo grid-width-30"> <a href="index.html"><img src="img/logo.png" alt="CKEditor Sample"></a> </h1> <nav class="navigation-b grid-width-70"> <ul> <li><a href="index.html" class="button-a button-a-background">Start</a></li> <li><a href="toolbarconfigurator/index.html" class="button-a">Toolbar configurator <span class="balloon-a balloon-a-nw">Edit your toolbar now!</span></a></li> </ul> </nav> </div> </header> <main> <div class="adjoined-top"> <div class="grid-container"> <div class="content grid-width-100"> <h1>Congratulations!</h1> <p> If you can see CKEditor below, it means that the installation succeeded. You can now try out your new editor version, see its features, and when you are ready to move on, check some of the <a href="#sample-customize">most useful resources</a> recommended below. </p> </div> </div> </div> <div class="adjoined-bottom"> <div class="grid-container"> <div class="grid-width-100"> <div id="editor"> <h1>Hello world!</h1> <p>I'm an instance of <a href="http://ckeditor.com">CKEditor</a>.</p> </div> </div> </div> </div> <div class="grid-container"> <div class="content grid-width-100"> <section id="sample-customize"> <h2>Customize Your Editor</h2> <p>Modular build and <a href="http://docs.ckeditor.com/#!/guide/dev_configuration">numerous configuration options</a> give you nearly endless possibilities to customize CKEditor. Replace the content of your <code><a href="../config.js">config.js</a></code> file with the following code and refresh this page (<strong>remember to clear the browser cache</strong>)!</p> <pre class="cm-s-neo CodeMirror"><code><span style="padding-right: 0.1px;"><span class="cm-variable">CKEDITOR</span>.<span class="cm-property">editorConfig</span> <span class="cm-operator">=</span> <span class="cm-keyword">function</span>( <span class="cm-def">config</span> ) {</span> <span style="padding-right: 0.1px;"><span class="cm-tab"> </span><span class="cm-variable-2">config</span>.<span class="cm-property">language</span> <span class="cm-operator">=</span> <span class="cm-string">'es'</span>;</span> <span style="padding-right: 0.1px;"><span class="cm-tab"> </span><span class="cm-variable-2">config</span>.<span class="cm-property">uiColor</span> <span class="cm-operator">=</span> <span class="cm-string">'#F7B42C'</span>;</span> <span style="padding-right: 0.1px;"><span class="cm-tab"> </span><span class="cm-variable-2">config</span>.<span class="cm-property">height</span> <span class="cm-operator">=</span> <span class="cm-number">300</span>;</span> <span style="padding-right: 0.1px;"><span class="cm-tab"> </span><span class="cm-variable-2">config</span>.<span class="cm-property">toolbarCanCollapse</span> <span class="cm-operator">=</span> <span class="cm-atom">true</span>;</span> <span style="padding-right: 0.1px;">};</span></code></pre> </section> <section> <h2>Toolbar Configuration</h2> <p>If you want to reorder toolbar buttons or remove some of them, check <a href="toolbarconfigurator/index.html">this handy tool</a>!</p> </section> <section> <h2>More Samples!</h2> <p>Visit the <a href="http://sdk.ckeditor.com">CKEditor SDK</a> for a huge collection of samples showcasing editor features, with source code readily available to copy and use in your own implementation.</p> </section> <section> <h2>Developer's Guide</h2> <p>The most important resource for all developers working with CKEditor, integrating it with their websites and applications, and customizing to their needs. You can start from here:</p> <ul> <li><a href="http://docs.ckeditor.com/#!/guide/dev_installation">Getting Started</a> &ndash; Explains most crucial editor concepts and practices as well as the installation process and integration with your website.</li> <li><a href="http://docs.ckeditor.com/#!/guide/dev_advanced_installation">Advanced Installation Concepts</a> &ndash; Describes how to upgrade, install additional components (plugins, skins), or create a custom build.</li> </ul> <p>When you have the basics sorted out, feel free to browse some more advanced sections like:</p> <ul> <li><a href="http://docs.ckeditor.com/#!/guide/dev_features">Functionality Overview</a> &ndash; Descriptions and samples of various editor features.</li> <li><a href="http://docs.ckeditor.com/#!/guide/plugin_sdk_intro">Plugin SDK</a>, <a href="http://docs.ckeditor.com/#!/guide/widget_sdk_intro">Widget SDK</a>, and <a href="http://docs.ckeditor.com/#!/guide/skin_sdk_intro">Skin SDK</a> &ndash; Useful when you want to create your own editor components.</li> </ul> </section> <section> <h2>CKEditor JavaScript API</h2> <p>CKEditor boasts a rich <a href="http://docs.ckeditor.com/#!/api">JavaScript API</a> that you can use to adjust the editor to your needs and integrate it with your website or application.</p> </section> </div> </div> </main> <footer class="footer-a grid-container"> <div class="grid-container"> <p class="grid-width-100"> CKEditor &ndash; The text editor for the Internet &ndash; <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p class="grid-width-100" id="copy"> Copyright &copy; 2003-2017, <a class="samples" href="http://cksource.com/">CKSource</a> &ndash; Frederico Knabben. All rights reserved. </p> </div> </footer> <script> initSample(); </script> </body> </html>
MiStudioX106/rbai_prod
public/admin/src/assets/js/ckeditorLite/samples/index.html
HTML
mit
6,564
/** * @license AngularJS v1.4.0-rc.2 * (c) 2010-2015 Google, Inc. http://angularjs.org * License: MIT */ (function(window, angular, undefined) {'use strict'; /** * @ngdoc module * @name ngAria * @description * * The `ngAria` module provides support for common * [<abbr title="Accessible Rich Internet Applications">ARIA</abbr>](http://www.w3.org/TR/wai-aria/) * attributes that convey state or semantic information about the application for users * of assistive technologies, such as screen readers. * * <div doc-module-components="ngAria"></div> * * ## Usage * * For ngAria to do its magic, simply include the module as a dependency. The directives supported * by ngAria are: * `ngModel`, `ngDisabled`, `ngShow`, `ngHide`, `ngClick`, `ngDblClick`, and `ngMessages`. * * Below is a more detailed breakdown of the attributes handled by ngAria: * * | Directive | Supported Attributes | * |---------------------------------------------|----------------------------------------------------------------------------------------| * | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled | * | {@link ng.directive:ngShow ngShow} | aria-hidden | * | {@link ng.directive:ngHide ngHide} | aria-hidden | * | {@link ng.directive:ngDblclick ngDblclick} | tabindex | * | {@link module:ngMessages ngMessages} | aria-live | * | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles | * | {@link ng.directive:ngClick ngClick} | tabindex, keypress event, button role | * * Find out more information about each directive by reading the * {@link guide/accessibility ngAria Developer Guide}. * * ##Example * Using ngDisabled with ngAria: * ```html * <md-checkbox ng-disabled="disabled"> * ``` * Becomes: * ```html * <md-checkbox ng-disabled="disabled" aria-disabled="true"> * ``` * * ##Disabling Attributes * It's possible to disable individual attributes added by ngAria with the * {@link ngAria.$ariaProvider#config config} method. For more details, see the * {@link guide/accessibility Developer Guide}. */ /* global -ngAriaModule */ var ngAriaModule = angular.module('ngAria', ['ng']). provider('$aria', $AriaProvider); /** * @ngdoc provider * @name $ariaProvider * * @description * * Used for configuring the ARIA attributes injected and managed by ngAria. * * ```js * angular.module('myApp', ['ngAria'], function config($ariaProvider) { * $ariaProvider.config({ * ariaValue: true, * tabindex: false * }); * }); *``` * * ## Dependencies * Requires the {@link ngAria} module to be installed. * */ function $AriaProvider() { var config = { ariaHidden: true, ariaChecked: true, ariaDisabled: true, ariaRequired: true, ariaInvalid: true, ariaMultiline: true, ariaValue: true, tabindex: true, bindKeypress: true }; /** * @ngdoc method * @name $ariaProvider#config * * @param {object} config object to enable/disable specific ARIA attributes * * - **ariaHidden** – `{boolean}` – Enables/disables aria-hidden tags * - **ariaChecked** – `{boolean}` – Enables/disables aria-checked tags * - **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags * - **ariaRequired** – `{boolean}` – Enables/disables aria-required tags * - **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags * - **ariaMultiline** – `{boolean}` – Enables/disables aria-multiline tags * - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and aria-valuenow tags * - **tabindex** – `{boolean}` – Enables/disables tabindex tags * - **bindKeypress** – `{boolean}` – Enables/disables keypress event binding on `&lt;div&gt;` and * `&lt;li&gt;` elements with ng-click * * @description * Enables/disables various ARIA attributes */ this.config = function(newConfig) { config = angular.extend(config, newConfig); }; function watchExpr(attrName, ariaAttr, negate) { return function(scope, elem, attr) { var ariaCamelName = attr.$normalize(ariaAttr); if (config[ariaCamelName] && !attr[ariaCamelName]) { scope.$watch(attr[attrName], function(boolVal) { if (negate) { boolVal = !boolVal; } elem.attr(ariaAttr, boolVal); }); } }; } /** * @ngdoc service * @name $aria * * @description * @priority 200 * * The $aria service contains helper methods for applying common * [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives. * * ngAria injects common accessibility attributes that tell assistive technologies when HTML * elements are enabled, selected, hidden, and more. To see how this is performed with ngAria, * let's review a code snippet from ngAria itself: * *```js * ngAriaModule.directive('ngDisabled', ['$aria', function($aria) { * return $aria.$$watchExpr('ngDisabled', 'aria-disabled'); * }]) *``` * Shown above, the ngAria module creates a directive with the same signature as the * traditional `ng-disabled` directive. But this ngAria version is dedicated to * solely managing accessibility attributes. The internal `$aria` service is used to watch the * boolean attribute `ngDisabled`. If it has not been explicitly set by the developer, * `aria-disabled` is injected as an attribute with its value synchronized to the value in * `ngDisabled`. * * Because ngAria hooks into the `ng-disabled` directive, developers do not have to do * anything to enable this feature. The `aria-disabled` attribute is automatically managed * simply as a silent side-effect of using `ng-disabled` with the ngAria module. * * The full list of directives that interface with ngAria: * * **ngModel** * * **ngShow** * * **ngHide** * * **ngClick** * * **ngDblclick** * * **ngMessages** * * **ngDisabled** * * Read the {@link guide/accessibility ngAria Developer Guide} for a thorough explanation of each * directive. * * * ## Dependencies * Requires the {@link ngAria} module to be installed. */ this.$get = function() { return { config: function(key) { return config[key]; }, $$watchExpr: watchExpr }; }; } ngAriaModule.directive('ngShow', ['$aria', function($aria) { return $aria.$$watchExpr('ngShow', 'aria-hidden', true); }]) .directive('ngHide', ['$aria', function($aria) { return $aria.$$watchExpr('ngHide', 'aria-hidden', false); }]) .directive('ngModel', ['$aria', function($aria) { function shouldAttachAttr(attr, normalizedAttr, elem) { return $aria.config(normalizedAttr) && !elem.attr(attr); } function shouldAttachRole(role, elem) { return !elem.attr('role') && (elem.attr('type') === role) && (elem[0].nodeName !== 'INPUT'); } function getShape(attr, elem) { var type = attr.type, role = attr.role; return ((type || role) === 'checkbox' || role === 'menuitemcheckbox') ? 'checkbox' : ((type || role) === 'radio' || role === 'menuitemradio') ? 'radio' : (type === 'range' || role === 'progressbar' || role === 'slider') ? 'range' : (type || role) === 'textbox' || elem[0].nodeName === 'TEXTAREA' ? 'multiline' : ''; } return { restrict: 'A', require: '?ngModel', priority: 200, //Make sure watches are fired after any other directives that affect the ngModel value compile: function(elem, attr) { var shape = getShape(attr, elem); return { pre: function(scope, elem, attr, ngModel) { if (shape === 'checkbox' && attr.type !== 'checkbox') { //Use the input[checkbox] $isEmpty implementation for elements with checkbox roles ngModel.$isEmpty = function(value) { return value === false; }; } }, post: function(scope, elem, attr, ngModel) { var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem); function ngAriaWatchModelValue() { return ngModel.$modelValue; } function getRadioReaction() { if (needsTabIndex) { needsTabIndex = false; return function ngAriaRadioReaction(newVal) { var boolVal = (attr.value == ngModel.$viewValue); elem.attr('aria-checked', boolVal); elem.attr('tabindex', 0 - !boolVal); }; } else { return function ngAriaRadioReaction(newVal) { elem.attr('aria-checked', (attr.value == ngModel.$viewValue)); }; } } function ngAriaCheckboxReaction() { elem.attr('aria-checked', !ngModel.$isEmpty(ngModel.$viewValue)); } switch (shape) { case 'radio': case 'checkbox': if (shouldAttachRole(shape, elem)) { elem.attr('role', shape); } if (shouldAttachAttr('aria-checked', 'ariaChecked', elem)) { scope.$watch(ngAriaWatchModelValue, shape === 'radio' ? getRadioReaction() : ngAriaCheckboxReaction); } break; case 'range': if (shouldAttachRole(shape, elem)) { elem.attr('role', 'slider'); } if ($aria.config('ariaValue')) { if (attr.min && !elem.attr('aria-valuemin')) { elem.attr('aria-valuemin', attr.min); } if (attr.max && !elem.attr('aria-valuemax')) { elem.attr('aria-valuemax', attr.max); } if (!elem.attr('aria-valuenow')) { scope.$watch(ngAriaWatchModelValue, function ngAriaValueNowReaction(newVal) { elem.attr('aria-valuenow', newVal); }); } } break; case 'multiline': if (shouldAttachAttr('aria-multiline', 'ariaMultiline', elem)) { elem.attr('aria-multiline', true); } break; } if (needsTabIndex) { elem.attr('tabindex', 0); } if (ngModel.$validators.required && shouldAttachAttr('aria-required', 'ariaRequired', elem)) { scope.$watch(function ngAriaRequiredWatch() { return ngModel.$error.required; }, function ngAriaRequiredReaction(newVal) { elem.attr('aria-required', !!newVal); }); } if (shouldAttachAttr('aria-invalid', 'ariaInvalid', elem)) { scope.$watch(function ngAriaInvalidWatch() { return ngModel.$invalid; }, function ngAriaInvalidReaction(newVal) { elem.attr('aria-invalid', !!newVal); }); } } }; } }; }]) .directive('ngDisabled', ['$aria', function($aria) { return $aria.$$watchExpr('ngDisabled', 'aria-disabled'); }]) .directive('ngMessages', function() { return { restrict: 'A', require: '?ngMessages', link: function(scope, elem, attr, ngMessages) { if (!elem.attr('aria-live')) { elem.attr('aria-live', 'assertive'); } } }; }) .directive('ngClick',['$aria', '$parse', function($aria, $parse) { return { restrict: 'A', compile: function(elem, attr) { var fn = $parse(attr.ngClick, /* interceptorFn */ null, /* expensiveChecks */ true); return function(scope, elem, attr) { var nodeBlackList = ['BUTTON', 'A', 'INPUT', 'TEXTAREA']; function isNodeOneOf(elem, nodeTypeArray) { if (nodeTypeArray.indexOf(elem[0].nodeName) !== -1) { return true; } } if (!elem.attr('role') && !isNodeOneOf(elem, nodeBlackList)) { elem.attr('role', 'button'); } if ($aria.config('tabindex') && !elem.attr('tabindex')) { elem.attr('tabindex', 0); } if ($aria.config('bindKeypress') && !attr.ngKeypress && !isNodeOneOf(elem, nodeBlackList)) { elem.on('keypress', function(event) { var keyCode = event.which || event.keyCode; if (keyCode === 32 || keyCode === 13) { scope.$apply(callback); } function callback() { fn(scope, { $event: event }); } }); } }; } }; }]) .directive('ngDblclick', ['$aria', function($aria) { return function(scope, elem, attr) { if ($aria.config('tabindex') && !elem.attr('tabindex')) { elem.attr('tabindex', 0); } }; }]); })(window, window.angular);
quba/cdnjs
ajax/libs/angular.js/1.4.0-rc.2/angular-aria.js
JavaScript
mit
13,476
/*! UIkit 2.14.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ /* ======================================================================== Component: Notify ========================================================================== */ /* * Message container for positioning */ .uk-notify { position: fixed; top: 10px; left: 10px; z-index: 1040; -moz-box-sizing: border-box; box-sizing: border-box; width: 350px; } /* Position modifiers ========================================================================== */ .uk-notify-top-right, .uk-notify-bottom-right { left: auto; right: 10px; } .uk-notify-top-center, .uk-notify-bottom-center { left: 50%; margin-left: -175px; } .uk-notify-bottom-left, .uk-notify-bottom-right, .uk-notify-bottom-center { top: auto; bottom: 10px; } /* Responsiveness ========================================================================== */ /* Phones portrait and smaller */ @media (max-width: 479px) { /* * Fit in small screen */ .uk-notify { left: 10px; right: 10px; width: auto; margin: 0; } } /* Sub-object: `uk-notify-message` ========================================================================== */ .uk-notify-message { position: relative; margin-bottom: 10px; padding: 15px; background: #444444; color: #ffffff; font-size: 16px; line-height: 22px; cursor: pointer; border: 1px solid #444444; border-radius: 4px; } /* Close in notify ========================================================================== */ .uk-notify-message > .uk-close { visibility: hidden; float: right; } .uk-notify-message:hover > .uk-close { visibility: visible; } /* Modifier: `uk-alert-info` ========================================================================== */ .uk-notify-message-primary { background: #ebf7fd; color: #2d7091; border-color: rgba(45, 112, 145, 0.3); } /* Modifier: `uk-alert-success` ========================================================================== */ .uk-notify-message-success { background: #f2fae3; color: #659f13; border-color: rgba(101, 159, 19, 0.3); } /* Modifier: `uk-notify-message-warning` ========================================================================== */ .uk-notify-message-warning { background: #fffceb; color: #e28327; border-color: rgba(226, 131, 39, 0.3); } /* Modifier: `uk-notify-message-danger` ========================================================================== */ .uk-notify-message-danger { background: #fff1f0; color: #d85030; border-color: rgba(216, 80, 48, 0.3); }
Teino1978-Corp/Teino1978-Corp-cdnjs
ajax/libs/uikit/2.14.0/css/components/notify.gradient.css
CSS
mit
2,601
/* Copyright (c) 2011, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html version: 2.9.0 */ var Y = YAHOO, Y_DOM = YAHOO.util.Dom, EMPTY_ARRAY = [], Y_UA = Y.env.ua, Y_Lang = Y.lang, Y_DOC = document, Y_DOCUMENT_ELEMENT = Y_DOC.documentElement, Y_DOM_inDoc = Y_DOM.inDocument, Y_mix = Y_Lang.augmentObject, Y_guid = Y_DOM.generateId, Y_getDoc = function(element) { var doc = Y_DOC; if (element) { doc = (element.nodeType === 9) ? element : // element === document element.ownerDocument || // element === DOM node element.document || // element === window Y_DOC; // default } return doc; }, Y_Array = function(o, startIdx) { var l, a, start = startIdx || 0; // IE errors when trying to slice HTMLElement collections try { return Array.prototype.slice.call(o, start); } catch (e) { a = []; l = o.length; for (; start < l; start++) { a.push(o[start]); } return a; } }, Y_DOM_allById = function(id, root) { root = root || Y_DOC; var nodes = [], ret = [], i, node; if (root.querySelectorAll) { ret = root.querySelectorAll('[id="' + id + '"]'); } else if (root.all) { nodes = root.all(id); if (nodes) { // root.all may return HTMLElement or HTMLCollection. // some elements are also HTMLCollection (FORM, SELECT). if (nodes.nodeName) { if (nodes.id === id) { // avoid false positive on name ret.push(nodes); nodes = EMPTY_ARRAY; // done, no need to filter } else { // prep for filtering nodes = [nodes]; } } if (nodes.length) { // filter out matches on node.name // and element.id as reference to element with id === 'id' for (i = 0; node = nodes[i++];) { if (node.id === id || (node.attributes && node.attributes.id && node.attributes.id.value === id)) { ret.push(node); } } } } } else { ret = [Y_getDoc(root).getElementById(id)]; } return ret; }; /** * The selector-native module provides support for native querySelector * @module dom * @submodule selector-native * @for Selector */ /** * Provides support for using CSS selectors to query the DOM * @class Selector * @static * @for Selector */ var COMPARE_DOCUMENT_POSITION = 'compareDocumentPosition', OWNER_DOCUMENT = 'ownerDocument', Selector = { _foundCache: [], useNative: true, _compare: ('sourceIndex' in Y_DOCUMENT_ELEMENT) ? function(nodeA, nodeB) { var a = nodeA.sourceIndex, b = nodeB.sourceIndex; if (a === b) { return 0; } else if (a > b) { return 1; } return -1; } : (Y_DOCUMENT_ELEMENT[COMPARE_DOCUMENT_POSITION] ? function(nodeA, nodeB) { if (nodeA[COMPARE_DOCUMENT_POSITION](nodeB) & 4) { return -1; } else { return 1; } } : function(nodeA, nodeB) { var rangeA, rangeB, compare; if (nodeA && nodeB) { rangeA = nodeA[OWNER_DOCUMENT].createRange(); rangeA.setStart(nodeA, 0); rangeB = nodeB[OWNER_DOCUMENT].createRange(); rangeB.setStart(nodeB, 0); compare = rangeA.compareBoundaryPoints(1, rangeB); // 1 === Range.START_TO_END } return compare; }), _sort: function(nodes) { if (nodes) { nodes = Y_Array(nodes, 0, true); if (nodes.sort) { nodes.sort(Selector._compare); } } return nodes; }, _deDupe: function(nodes) { var ret = [], i, node; for (i = 0; (node = nodes[i++]);) { if (!node._found) { ret[ret.length] = node; node._found = true; } } for (i = 0; (node = ret[i++]);) { node._found = null; node.removeAttribute('_found'); } return ret; }, /** * Retrieves a set of nodes based on a given CSS selector. * @method query * * @param {string} selector The CSS Selector to test the node against. * @param {HTMLElement} root optional An HTMLElement to start the query from. Defaults to Y.config.doc * @param {Boolean} firstOnly optional Whether or not to return only the first match. * @return {Array} An array of nodes that match the given selector. * @static */ query: function(selector, root, firstOnly, skipNative) { if (root && typeof root == 'string') { root = Y_DOM.get(root); if (!root) { return (firstOnly) ? null : []; } } else { root = root || Y_DOC; } var ret = [], useNative = (Selector.useNative && Y_DOC.querySelector && !skipNative), queries = [[selector, root]], query, result, i, fn = (useNative) ? Selector._nativeQuery : Selector._bruteQuery; if (selector && fn) { // split group into seperate queries if (!skipNative && // already done if skipping (!useNative || root.tagName)) { // split native when element scoping is needed queries = Selector._splitQueries(selector, root); } for (i = 0; (query = queries[i++]);) { result = fn(query[0], query[1], firstOnly); if (!firstOnly) { // coerce DOM Collection to Array result = Y_Array(result, 0, true); } if (result) { ret = ret.concat(result); } } if (queries.length > 1) { // remove dupes and sort by doc order ret = Selector._sort(Selector._deDupe(ret)); } } return (firstOnly) ? (ret[0] || null) : ret; }, // allows element scoped queries to begin with combinator // e.g. query('> p', document.body) === query('body > p') _splitQueries: function(selector, node) { var groups = selector.split(','), queries = [], prefix = '', i, len; if (node) { // enforce for element scoping if (node.tagName) { node.id = node.id || Y_guid(); prefix = '[id="' + node.id + '"] '; } for (i = 0, len = groups.length; i < len; ++i) { selector = prefix + groups[i]; queries.push([selector, node]); } } return queries; }, _nativeQuery: function(selector, root, one) { if (Y_UA.webkit && selector.indexOf(':checked') > -1 && (Selector.pseudos && Selector.pseudos.checked)) { // webkit (chrome, safari) fails to find "selected" return Selector.query(selector, root, one, true); // redo with skipNative true to try brute query } try { return root['querySelector' + (one ? '' : 'All')](selector); } catch(e) { // fallback to brute if available return Selector.query(selector, root, one, true); // redo with skipNative true } }, filter: function(nodes, selector) { var ret = [], i, node; if (nodes && selector) { for (i = 0; (node = nodes[i++]);) { if (Selector.test(node, selector)) { ret[ret.length] = node; } } } else { } return ret; }, test: function(node, selector, root) { var ret = false, groups = selector.split(','), useFrag = false, parent, item, items, frag, i, j, group; if (node && node.tagName) { // only test HTMLElements // we need a root if off-doc if (!root && !Y_DOM_inDoc(node)) { parent = node.parentNode; if (parent) { root = parent; } else { // only use frag when no parent to query frag = node[OWNER_DOCUMENT].createDocumentFragment(); frag.appendChild(node); root = frag; useFrag = true; } } root = root || node[OWNER_DOCUMENT]; if (!node.id) { node.id = Y_guid(); } for (i = 0; (group = groups[i++]);) { // TODO: off-dom test group += '[id="' + node.id + '"]'; items = Selector.query(group, root); for (j = 0; item = items[j++];) { if (item === node) { ret = true; break; } } if (ret) { break; } } if (useFrag) { // cleanup frag.removeChild(node); } } return ret; } }; YAHOO.util.Selector = Selector; /** * The selector module provides helper methods allowing CSS2 Selectors to be used with DOM elements. * @module dom * @submodule selector-css2 * @for Selector */ /** * Provides helper methods for collecting and filtering DOM elements. */ var PARENT_NODE = 'parentNode', TAG_NAME = 'tagName', ATTRIBUTES = 'attributes', COMBINATOR = 'combinator', PSEUDOS = 'pseudos', SelectorCSS2 = { _reRegExpTokens: /([\^\$\?\[\]\*\+\-\.\(\)\|\\])/, // TODO: move? SORT_RESULTS: true, _children: function(node, tag) { var ret = node.children, i, children = [], childNodes, child; if (node.children && tag && node.children.tags) { children = node.children.tags(tag); } else if ((!ret && node[TAG_NAME]) || (ret && tag)) { // only HTMLElements have children childNodes = ret || node.childNodes; ret = []; for (i = 0; (child = childNodes[i++]);) { if (child.tagName) { if (!tag || tag === child.tagName) { ret.push(child); } } } } return ret || []; }, _re: { //attr: /(\[.*\])/g, attr: /(\[[^\]]*\])/g, //esc: /\\[:\[][\w\d\]]*/gi, esc: /\\[:\[\]\(\)#\.\'\>+~"]/gi, //pseudos: /:([\-\w]+(?:\(?:['"]?(.+)['"]?\))*)/i pseudos: /(\([^\)]*\))/g }, /** * Mapping of shorthand tokens to corresponding attribute selector * @property shorthand * @type object */ shorthand: { //'\\#([^\\s\\\\(\\[:]*)': '[id=$1]', '\\#(-?[_a-z]+[-\\w\\uE000]*)': '[id=$1]', //'\\#([^\\s\\\.:\\[\\]]*)': '[id=$1]', //'\\.([^\\s\\\\(\\[:]*)': '[className=$1]' '\\.(-?[_a-z]+[-\\w\\uE000]*)': '[className~=$1]' }, /** * List of operators and corresponding boolean functions. * These functions are passed the attribute and the current node's value of the attribute. * @property operators * @type object */ operators: { '': function(node, attr) { return !!node.getAttribute(attr); }, // Just test for existence of attribute //'': '.+', //'=': '^{val}$', // equality '~=': '(?:^|\\s+){val}(?:\\s+|$)', // space-delimited '|=': '^{val}(?:-|$)' // optional hyphen-delimited }, pseudos: { 'first-child': function(node) { return Selector._children(node[PARENT_NODE])[0] === node; } }, _bruteQuery: function(selector, root, firstOnly) { var ret = [], nodes = [], tokens = Selector._tokenize(selector), token = tokens[tokens.length - 1], rootDoc = Y_getDoc(root), child, id, className, tagName; // if we have an initial ID, set to root when in document /* if (tokens[0] && rootDoc === root && (id = tokens[0].id) && rootDoc.getElementById(id)) { root = rootDoc.getElementById(id); } */ if (token) { // prefilter nodes id = token.id; className = token.className; tagName = token.tagName || '*'; if (root.getElementsByTagName) { // non-IE lacks DOM api on doc frags // try ID first, unless no root.all && root not in document // (root.all works off document, but not getElementById) // TODO: move to allById? if (id && (root.all || (root.nodeType === 9 || Y_DOM_inDoc(root)))) { nodes = Y_DOM_allById(id, root); // try className } else if (className) { nodes = root.getElementsByClassName(className); } else { // default to tagName nodes = root.getElementsByTagName(tagName); } } else { // brute getElementsByTagName('*') child = root.firstChild; while (child) { if (child.tagName) { // only collect HTMLElements nodes.push(child); } child = child.nextSilbing || child.firstChild; } } if (nodes.length) { ret = Selector._filterNodes(nodes, tokens, firstOnly); } } return ret; }, _filterNodes: function(nodes, tokens, firstOnly) { var i = 0, j, len = tokens.length, n = len - 1, result = [], node = nodes[0], tmpNode = node, getters = Selector.getters, operator, combinator, token, path, pass, //FUNCTION = 'function', value, tests, test; //do { for (i = 0; (tmpNode = node = nodes[i++]);) { n = len - 1; path = null; testLoop: while (tmpNode && tmpNode.tagName) { token = tokens[n]; tests = token.tests; j = tests.length; if (j && !pass) { while ((test = tests[--j])) { operator = test[1]; if (getters[test[0]]) { value = getters[test[0]](tmpNode, test[0]); } else { value = tmpNode[test[0]]; // use getAttribute for non-standard attributes if (value === undefined && tmpNode.getAttribute) { value = tmpNode.getAttribute(test[0]); } } if ((operator === '=' && value !== test[2]) || // fast path for equality (typeof operator !== 'string' && // protect against String.test monkey-patch (Moo) operator.test && !operator.test(value)) || // regex test (!operator.test && // protect against RegExp as function (webkit) typeof operator === 'function' && !operator(tmpNode, test[0], test[2]))) { // function test // skip non element nodes or non-matching tags if ((tmpNode = tmpNode[path])) { while (tmpNode && (!tmpNode.tagName || (token.tagName && token.tagName !== tmpNode.tagName)) ) { tmpNode = tmpNode[path]; } } continue testLoop; } } } n--; // move to next token // now that we've passed the test, move up the tree by combinator if (!pass && (combinator = token.combinator)) { path = combinator.axis; tmpNode = tmpNode[path]; // skip non element nodes while (tmpNode && !tmpNode.tagName) { tmpNode = tmpNode[path]; } if (combinator.direct) { // one pass only path = null; } } else { // success if we made it this far result.push(node); if (firstOnly) { return result; } break; } } }// while (tmpNode = node = nodes[++i]); node = tmpNode = null; return result; }, combinators: { ' ': { axis: 'parentNode' }, '>': { axis: 'parentNode', direct: true }, '+': { axis: 'previousSibling', direct: true } }, _parsers: [ { name: ATTRIBUTES, //re: /^\[(-?[a-z]+[\w\-]*)+([~\|\^\$\*!=]=?)?['"]?([^\]]*?)['"]?\]/i, re: /^\uE003(-?[a-z]+[\w\-]*)+([~\|\^\$\*!=]=?)?['"]?([^\uE004'"]*)['"]?\uE004/i, fn: function(match, token) { var operator = match[2] || '', operators = Selector.operators, escVal = (match[3]) ? match[3].replace(/\\/g, '') : '', test; // add prefiltering for ID and CLASS if ((match[1] === 'id' && operator === '=') || (match[1] === 'className' && Y_DOCUMENT_ELEMENT.getElementsByClassName && (operator === '~=' || operator === '='))) { token.prefilter = match[1]; match[3] = escVal; // escape all but ID for prefilter, which may run through QSA (via Dom.allById) token[match[1]] = (match[1] === 'id') ? match[3] : escVal; } // add tests if (operator in operators) { test = operators[operator]; if (typeof test === 'string') { match[3] = escVal.replace(Selector._reRegExpTokens, '\\$1'); test = new RegExp(test.replace('{val}', match[3])); } match[2] = test; } if (!token.last || token.prefilter !== match[1]) { return match.slice(1); } } }, { name: TAG_NAME, re: /^((?:-?[_a-z]+[\w-]*)|\*)/i, fn: function(match, token) { var tag = match[1].toUpperCase(); token.tagName = tag; if (tag !== '*' && (!token.last || token.prefilter)) { return [TAG_NAME, '=', tag]; } if (!token.prefilter) { token.prefilter = 'tagName'; } } }, { name: COMBINATOR, re: /^\s*([>+~]|\s)\s*/, fn: function(match, token) { } }, { name: PSEUDOS, re: /^:([\-\w]+)(?:\uE005['"]?([^\uE005]*)['"]?\uE006)*/i, fn: function(match, token) { var test = Selector[PSEUDOS][match[1]]; if (test) { // reorder match array and unescape special chars for tests if (match[2]) { match[2] = match[2].replace(/\\/g, ''); } return [match[2], test]; } else { // selector token not supported (possibly missing CSS3 module) return false; } } } ], _getToken: function(token) { return { tagName: null, id: null, className: null, attributes: {}, combinator: null, tests: [] }; }, /** Break selector into token units per simple selector. Combinator is attached to the previous token. */ _tokenize: function(selector) { selector = selector || ''; selector = Selector._replaceShorthand(Y_Lang.trim(selector)); var token = Selector._getToken(), // one token per simple selector (left selector holds combinator) query = selector, // original query for debug report tokens = [], // array of tokens found = false, // whether or not any matches were found this pass match, // the regex match test, i, parser; /* Search for selector patterns, store, and strip them from the selector string until no patterns match (invalid selector) or we run out of chars. Multiple attributes and pseudos are allowed, in any order. for example: 'form:first-child[type=button]:not(button)[lang|=en]' */ outer: do { found = false; // reset after full pass for (i = 0; (parser = Selector._parsers[i++]);) { if ( (match = parser.re.exec(selector)) ) { // note assignment if (parser.name !== COMBINATOR ) { token.selector = selector; } selector = selector.replace(match[0], ''); // strip current match from selector if (!selector.length) { token.last = true; } if (Selector._attrFilters[match[1]]) { // convert class to className, etc. match[1] = Selector._attrFilters[match[1]]; } test = parser.fn(match, token); if (test === false) { // selector not supported found = false; break outer; } else if (test) { token.tests.push(test); } if (!selector.length || parser.name === COMBINATOR) { tokens.push(token); token = Selector._getToken(token); if (parser.name === COMBINATOR) { token.combinator = Selector.combinators[match[1]]; } } found = true; } } } while (found && selector.length); if (!found || selector.length) { // not fully parsed tokens = []; } return tokens; }, _replaceShorthand: function(selector) { var shorthand = Selector.shorthand, esc = selector.match(Selector._re.esc), // pull escaped colon, brackets, etc. attrs, pseudos, re, i, len; if (esc) { selector = selector.replace(Selector._re.esc, '\uE000'); } attrs = selector.match(Selector._re.attr); pseudos = selector.match(Selector._re.pseudos); if (attrs) { selector = selector.replace(Selector._re.attr, '\uE001'); } if (pseudos) { selector = selector.replace(Selector._re.pseudos, '\uE002'); } for (re in shorthand) { if (shorthand.hasOwnProperty(re)) { selector = selector.replace(new RegExp(re, 'gi'), shorthand[re]); } } if (attrs) { for (i = 0, len = attrs.length; i < len; ++i) { selector = selector.replace(/\uE001/, attrs[i]); } } if (pseudos) { for (i = 0, len = pseudos.length; i < len; ++i) { selector = selector.replace(/\uE002/, pseudos[i]); } } selector = selector.replace(/\[/g, '\uE003'); selector = selector.replace(/\]/g, '\uE004'); selector = selector.replace(/\(/g, '\uE005'); selector = selector.replace(/\)/g, '\uE006'); if (esc) { for (i = 0, len = esc.length; i < len; ++i) { selector = selector.replace('\uE000', esc[i]); } } return selector; }, _attrFilters: { 'class': 'className', 'for': 'htmlFor' }, getters: { href: function(node, attr) { return Y_DOM.getAttribute(node, attr); } } }; Y_mix(Selector, SelectorCSS2, true); Selector.getters.src = Selector.getters.rel = Selector.getters.href; // IE wants class with native queries if (Selector.useNative && Y_DOC.querySelector) { Selector.shorthand['\\.([^\\s\\\\(\\[:]*)'] = '[class~=$1]'; } /** * The selector css3 module provides support for css3 selectors. * @module dom * @submodule selector-css3 * @for Selector */ /* an+b = get every _a_th node starting at the _b_th 0n+b = no repeat ("0" and "n" may both be omitted (together) , e.g. "0n+1" or "1", not "0+1"), return only the _b_th element 1n+b = get every element starting from b ("1" may may be omitted, e.g. "1n+0" or "n+0" or "n") an+0 = get every _a_th element, "0" may be omitted */ Selector._reNth = /^(?:([\-]?\d*)(n){1}|(odd|even)$)*([\-+]?\d*)$/; Selector._getNth = function(node, expr, tag, reverse) { Selector._reNth.test(expr); var a = parseInt(RegExp.$1, 10), // include every _a_ elements (zero means no repeat, just first _a_) n = RegExp.$2, // "n" oddeven = RegExp.$3, // "odd" or "even" b = parseInt(RegExp.$4, 10) || 0, // start scan from element _b_ result = [], siblings = Selector._children(node.parentNode, tag), op; if (oddeven) { a = 2; // always every other op = '+'; n = 'n'; b = (oddeven === 'odd') ? 1 : 0; } else if ( isNaN(a) ) { a = (n) ? 1 : 0; // start from the first or no repeat } if (a === 0) { // just the first if (reverse) { b = siblings.length - b + 1; } if (siblings[b - 1] === node) { return true; } else { return false; } } else if (a < 0) { reverse = !!reverse; a = Math.abs(a); } if (!reverse) { for (var i = b - 1, len = siblings.length; i < len; i += a) { if ( i >= 0 && siblings[i] === node ) { return true; } } } else { for (var i = siblings.length - b, len = siblings.length; i >= 0; i -= a) { if ( i < len && siblings[i] === node ) { return true; } } } return false; }; Y_mix(Selector.pseudos, { 'root': function(node) { return node === node.ownerDocument.documentElement; }, 'nth-child': function(node, expr) { return Selector._getNth(node, expr); }, 'nth-last-child': function(node, expr) { return Selector._getNth(node, expr, null, true); }, 'nth-of-type': function(node, expr) { return Selector._getNth(node, expr, node.tagName); }, 'nth-last-of-type': function(node, expr) { return Selector._getNth(node, expr, node.tagName, true); }, 'last-child': function(node) { var children = Selector._children(node.parentNode); return children[children.length - 1] === node; }, 'first-of-type': function(node) { return Selector._children(node.parentNode, node.tagName)[0] === node; }, 'last-of-type': function(node) { var children = Selector._children(node.parentNode, node.tagName); return children[children.length - 1] === node; }, 'only-child': function(node) { var children = Selector._children(node.parentNode); return children.length === 1 && children[0] === node; }, 'only-of-type': function(node) { var children = Selector._children(node.parentNode, node.tagName); return children.length === 1 && children[0] === node; }, 'empty': function(node) { return node.childNodes.length === 0; }, 'not': function(node, expr) { return !Selector.test(node, expr); }, 'contains': function(node, expr) { var text = node.innerText || node.textContent || ''; return text.indexOf(expr) > -1; }, 'checked': function(node) { return (node.checked === true || node.selected === true); }, enabled: function(node) { return (node.disabled !== undefined && !node.disabled); }, disabled: function(node) { return (node.disabled); } }); Y_mix(Selector.operators, { '^=': '^{val}', // Match starts with value '!=': function(node, attr, val) { return node[attr] !== val; }, // Match starts with value '$=': '{val}$', // Match ends with value '*=': '{val}' // Match contains value as substring }); Selector.combinators['~'] = { axis: 'previousSibling' }; YAHOO.register("selector", YAHOO.util.Selector, {version: "2.9.0", build: "2800"});
johan-gorter/cdnjs
ajax/libs/yui/2.9.0/selector/selector.js
JavaScript
mit
32,054
YUI.add("base-build",function(e,t){var n=e.Base,r=e.Lang,i="initializer",s="destructor",o,u=function(e,t,n){n[e]&&(t[e]=(t[e]||[]).concat(n[e]))};n._build=function(t,r,o,u,a,f){var l=n._build,c=l._ctor(r,f),h=l._cfg(r,f,o),p=l._mixCust,d=c._yuibuild.dynamic,v,m,g,y,b,w;for(v=0,m=o.length;v<m;v++)g=o[v],y=g.prototype,b=y[i],w=y[s],delete y[i],delete y[s],e.mix(c,g,!0,null,1),p(c,g,h),b&&(y[i]=b),w&&(y[s]=w),c._yuibuild.exts.push(g);return u&&e.mix(c.prototype,u,!0),a&&(e.mix(c,l._clean(a,h),!0),p(c,a,h)),c.prototype.hasImpl=l._impl,d&&(c.NAME=t,c.prototype.constructor=c),c},o=n._build,e.mix(o,{_mixCust:function(t,n,i){var s,o,u,a,f,l;i&&(s=i.aggregates,o=i.custom,u=i.statics),u&&e.mix(t,n,!0,u);if(s)for(l=0,f=s.length;l<f;l++)a=s[l],!t.hasOwnProperty(a)&&n.hasOwnProperty(a)&&(t[a]=r.isArray(n[a])?[]:{}),e.aggregate(t,n,!0,[a]);if(o)for(l in o)o.hasOwnProperty(l)&&o[l](l,t,n)},_tmpl:function(t){function n(){n.superclass.constructor.apply(this,arguments)}return e.extend(n,t),n},_impl:function(e){var t=this._getClasses(),n,r,i,s,o,u;for(n=0,r=t.length;n<r;n++){i=t[n];if(i._yuibuild){s=i._yuibuild.exts,o=s.length;for(u=0;u<o;u++)if(s[u]===e)return!0}}return!1},_ctor:function(e,t){var n=t&&!1===t.dynamic?!1:!0,r=n?o._tmpl(e):e,i=r._yuibuild;return i||(i=r._yuibuild={}),i.id=i.id||null,i.exts=i.exts||[],i.dynamic=n,r},_cfg:function(t,n,r){var i=[],s={},o=[],u,a=n&&n.aggregates,f=n&&n.custom,l=n&&n.statics,c=t,h,p;while(c&&c.prototype)u=c._buildCfg,u&&(u.aggregates&&(i=i.concat(u.aggregates)),u.custom&&e.mix(s,u.custom,!0),u.statics&&(o=o.concat(u.statics))),c=c.superclass?c.superclass.constructor:null;if(r)for(h=0,p=r.length;h<p;h++)c=r[h],u=c._buildCfg,u&&(u.aggregates&&(i=i.concat(u.aggregates)),u.custom&&e.mix(s,u.custom,!0),u.statics&&(o=o.concat(u.statics)));return a&&(i=i.concat(a)),f&&e.mix(s,n.cfgBuild,!0),l&&(o=o.concat(l)),{aggregates:i,custom:s,statics:o}},_clean:function(t,n){var r,i,s,o=e.merge(t),u=n.aggregates,a=n.custom;for(r in a)o.hasOwnProperty(r)&&delete o[r];for(i=0,s=u.length;i<s;i++)r=u[i],o.hasOwnProperty(r)&&delete o[r];return o}}),n.build=function(e,t,n,r){return o(e,t,n,null,null,r)},n.create=function(e,t,n,r,i){return o(e,t,n,r,i)},n.mix=function(e,t){return o(null,e,t,null,null,{dynamic:!1})},n._buildCfg={custom:{ATTRS:function(t,n,r){n.ATTRS=n.ATTRS||{};if(r.ATTRS){var i=r.ATTRS,s=n.ATTRS,o;for(o in i)i.hasOwnProperty(o)&&(s[o]=s[o]||{},e.mix(s[o],i[o],!0))}},_NON_ATTRS_CFG:u},aggregates:["_PLUG","_UNPLUG"]}},"@VERSION@",{requires:["base-base"]});
rlugojr/cdnjs
ajax/libs/yui/3.7.2/base-build/base-build-min.js
JavaScript
mit
2,515
YUI.add('loader-yui3', function (Y, NAME) { /* This file is auto-generated by (yogi loader --yes --mix --start ../) */ /*jshint maxlen:900, eqeqeq: false */ /** * YUI 3 module metadata * @module loader * @submodule loader-yui3 */ YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {}; Y.mix(YUI.Env[Y.version].modules, { "align-plugin": { "requires": [ "node-screen", "node-pluginhost" ] }, "anim": { "use": [ "anim-base", "anim-color", "anim-curve", "anim-easing", "anim-node-plugin", "anim-scroll", "anim-xy" ] }, "anim-base": { "requires": [ "base-base", "node-style" ] }, "anim-color": { "requires": [ "anim-base" ] }, "anim-curve": { "requires": [ "anim-xy" ] }, "anim-easing": { "requires": [ "anim-base" ] }, "anim-node-plugin": { "requires": [ "node-pluginhost", "anim-base" ] }, "anim-scroll": { "requires": [ "anim-base" ] }, "anim-shape": { "requires": [ "anim-base", "anim-easing", "anim-color", "matrix" ] }, "anim-shape-transform": { "use": [ "anim-shape" ] }, "anim-xy": { "requires": [ "anim-base", "node-screen" ] }, "app": { "use": [ "app-base", "app-content", "app-transitions", "lazy-model-list", "model", "model-list", "model-sync-rest", "router", "view", "view-node-map" ] }, "app-base": { "requires": [ "classnamemanager", "pjax-base", "router", "view" ] }, "app-content": { "requires": [ "app-base", "pjax-content" ] }, "app-transitions": { "requires": [ "app-base" ] }, "app-transitions-css": { "type": "css" }, "app-transitions-native": { "condition": { "name": "app-transitions-native", "test": function (Y) { var doc = Y.config.doc, node = doc ? doc.documentElement : null; if (node && node.style) { return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); } return false; }, "trigger": "app-transitions" }, "requires": [ "app-transitions", "app-transitions-css", "parallel", "transition" ] }, "array-extras": { "requires": [ "yui-base" ] }, "array-invoke": { "requires": [ "yui-base" ] }, "arraylist": { "requires": [ "yui-base" ] }, "arraylist-add": { "requires": [ "arraylist" ] }, "arraylist-filter": { "requires": [ "arraylist" ] }, "arraysort": { "requires": [ "yui-base" ] }, "async-queue": { "requires": [ "event-custom" ] }, "attribute": { "use": [ "attribute-base", "attribute-complex" ] }, "attribute-base": { "requires": [ "attribute-core", "attribute-observable", "attribute-extras" ] }, "attribute-complex": { "requires": [ "attribute-base" ] }, "attribute-core": { "requires": [ "oop" ] }, "attribute-events": { "use": [ "attribute-observable" ] }, "attribute-extras": { "requires": [ "oop" ] }, "attribute-observable": { "requires": [ "event-custom" ] }, "autocomplete": { "use": [ "autocomplete-base", "autocomplete-sources", "autocomplete-list", "autocomplete-plugin" ] }, "autocomplete-base": { "optional": [ "autocomplete-sources" ], "requires": [ "array-extras", "base-build", "escape", "event-valuechange", "node-base" ] }, "autocomplete-filters": { "requires": [ "array-extras", "text-wordbreak" ] }, "autocomplete-filters-accentfold": { "requires": [ "array-extras", "text-accentfold", "text-wordbreak" ] }, "autocomplete-highlighters": { "requires": [ "array-extras", "highlight-base" ] }, "autocomplete-highlighters-accentfold": { "requires": [ "array-extras", "highlight-accentfold" ] }, "autocomplete-list": { "after": [ "autocomplete-sources" ], "lang": [ "en", "es" ], "requires": [ "autocomplete-base", "event-resize", "node-screen", "selector-css3", "shim-plugin", "widget", "widget-position", "widget-position-align" ], "skinnable": true }, "autocomplete-list-keys": { "condition": { "name": "autocomplete-list-keys", "test": function (Y) { // Only add keyboard support to autocomplete-list if this doesn't appear to // be an iOS or Android-based mobile device. // // There's currently no feasible way to actually detect whether a device has // a hardware keyboard, so this sniff will have to do. It can easily be // overridden by manually loading the autocomplete-list-keys module. // // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari // doesn't fire the keyboard events used by AutoCompleteList, so there's // no point loading the -keys module even when a bluetooth keyboard may be // available. return !(Y.UA.ios || Y.UA.android); }, "trigger": "autocomplete-list" }, "requires": [ "autocomplete-list", "base-build" ] }, "autocomplete-plugin": { "requires": [ "autocomplete-list", "node-pluginhost" ] }, "autocomplete-sources": { "optional": [ "io-base", "json-parse", "jsonp", "yql" ], "requires": [ "autocomplete-base" ] }, "axes": { "use": [ "axis-numeric", "axis-category", "axis-time", "axis-stacked" ] }, "axes-base": { "use": [ "axis-numeric-base", "axis-category-base", "axis-time-base", "axis-stacked-base" ] }, "axis": { "requires": [ "dom", "widget", "widget-position", "widget-stack", "graphics", "axis-base" ] }, "axis-base": { "requires": [ "classnamemanager", "datatype-number", "datatype-date", "base", "event-custom" ] }, "axis-category": { "requires": [ "axis", "axis-category-base" ] }, "axis-category-base": { "requires": [ "axis-base" ] }, "axis-numeric": { "requires": [ "axis", "axis-numeric-base" ] }, "axis-numeric-base": { "requires": [ "axis-base" ] }, "axis-stacked": { "requires": [ "axis-numeric", "axis-stacked-base" ] }, "axis-stacked-base": { "requires": [ "axis-numeric-base" ] }, "axis-time": { "requires": [ "axis", "axis-time-base" ] }, "axis-time-base": { "requires": [ "axis-base" ] }, "base": { "use": [ "base-base", "base-pluginhost", "base-build" ] }, "base-base": { "requires": [ "attribute-base", "base-core", "base-observable" ] }, "base-build": { "requires": [ "base-base" ] }, "base-core": { "requires": [ "attribute-core" ] }, "base-observable": { "requires": [ "attribute-observable" ] }, "base-pluginhost": { "requires": [ "base-base", "pluginhost" ] }, "button": { "requires": [ "button-core", "cssbutton", "widget" ] }, "button-core": { "requires": [ "attribute-core", "classnamemanager", "node-base" ] }, "button-group": { "requires": [ "button-plugin", "cssbutton", "widget" ] }, "button-plugin": { "requires": [ "button-core", "cssbutton", "node-pluginhost" ] }, "cache": { "use": [ "cache-base", "cache-offline", "cache-plugin" ] }, "cache-base": { "requires": [ "base" ] }, "cache-offline": { "requires": [ "cache-base", "json" ] }, "cache-plugin": { "requires": [ "plugin", "cache-base" ] }, "calendar": { "lang": [ "de", "en", "es", "es-AR", "fr", "it", "ja", "nb-NO", "nl", "pt-BR", "ru", "zh-HANT-TW" ], "requires": [ "calendar-base", "calendarnavigator" ], "skinnable": true }, "calendar-base": { "lang": [ "de", "en", "es", "es-AR", "fr", "it", "ja", "nb-NO", "nl", "pt-BR", "ru", "zh-HANT-TW" ], "requires": [ "widget", "datatype-date", "datatype-date-math", "cssgrids" ], "skinnable": true }, "calendarnavigator": { "requires": [ "plugin", "classnamemanager", "datatype-date", "node" ], "skinnable": true }, "charts": { "use": [ "charts-base" ] }, "charts-base": { "requires": [ "dom", "event-mouseenter", "event-touch", "graphics-group", "axes", "series-pie", "series-line", "series-marker", "series-area", "series-spline", "series-column", "series-bar", "series-areaspline", "series-combo", "series-combospline", "series-line-stacked", "series-marker-stacked", "series-area-stacked", "series-spline-stacked", "series-column-stacked", "series-bar-stacked", "series-areaspline-stacked", "series-combo-stacked", "series-combospline-stacked" ] }, "charts-legend": { "requires": [ "charts-base" ] }, "classnamemanager": { "requires": [ "yui-base" ] }, "clickable-rail": { "requires": [ "slider-base" ] }, "collection": { "use": [ "array-extras", "arraylist", "arraylist-add", "arraylist-filter", "array-invoke" ] }, "color": { "use": [ "color-base", "color-hsl", "color-harmony" ] }, "color-base": { "requires": [ "yui-base" ] }, "color-harmony": { "requires": [ "color-hsl" ] }, "color-hsl": { "requires": [ "color-base" ] }, "color-hsv": { "requires": [ "color-base" ] }, "console": { "lang": [ "en", "es", "ja" ], "requires": [ "yui-log", "widget" ], "skinnable": true }, "console-filters": { "requires": [ "plugin", "console" ], "skinnable": true }, "controller": { "use": [ "router" ] }, "cookie": { "requires": [ "yui-base" ] }, "createlink-base": { "requires": [ "editor-base" ] }, "cssbase": { "after": [ "cssreset", "cssfonts", "cssgrids", "cssreset-context", "cssfonts-context", "cssgrids-context" ], "type": "css" }, "cssbase-context": { "after": [ "cssreset", "cssfonts", "cssgrids", "cssreset-context", "cssfonts-context", "cssgrids-context" ], "type": "css" }, "cssbutton": { "type": "css" }, "cssfonts": { "type": "css" }, "cssfonts-context": { "type": "css" }, "cssgrids": { "optional": [ "cssreset", "cssfonts" ], "type": "css" }, "cssgrids-base": { "optional": [ "cssreset", "cssfonts" ], "type": "css" }, "cssgrids-responsive": { "optional": [ "cssreset", "cssfonts" ], "requires": [ "cssgrids", "cssgrids-responsive-base" ], "type": "css" }, "cssgrids-units": { "optional": [ "cssreset", "cssfonts" ], "requires": [ "cssgrids-base" ], "type": "css" }, "cssnormalize": { "type": "css" }, "cssnormalize-context": { "type": "css" }, "cssreset": { "type": "css" }, "cssreset-context": { "type": "css" }, "dataschema": { "use": [ "dataschema-base", "dataschema-json", "dataschema-xml", "dataschema-array", "dataschema-text" ] }, "dataschema-array": { "requires": [ "dataschema-base" ] }, "dataschema-base": { "requires": [ "base" ] }, "dataschema-json": { "requires": [ "dataschema-base", "json" ] }, "dataschema-text": { "requires": [ "dataschema-base" ] }, "dataschema-xml": { "requires": [ "dataschema-base" ] }, "datasource": { "use": [ "datasource-local", "datasource-io", "datasource-get", "datasource-function", "datasource-cache", "datasource-jsonschema", "datasource-xmlschema", "datasource-arrayschema", "datasource-textschema", "datasource-polling" ] }, "datasource-arrayschema": { "requires": [ "datasource-local", "plugin", "dataschema-array" ] }, "datasource-cache": { "requires": [ "datasource-local", "plugin", "cache-base" ] }, "datasource-function": { "requires": [ "datasource-local" ] }, "datasource-get": { "requires": [ "datasource-local", "get" ] }, "datasource-io": { "requires": [ "datasource-local", "io-base" ] }, "datasource-jsonschema": { "requires": [ "datasource-local", "plugin", "dataschema-json" ] }, "datasource-local": { "requires": [ "base" ] }, "datasource-polling": { "requires": [ "datasource-local" ] }, "datasource-textschema": { "requires": [ "datasource-local", "plugin", "dataschema-text" ] }, "datasource-xmlschema": { "requires": [ "datasource-local", "plugin", "datatype-xml", "dataschema-xml" ] }, "datatable": { "use": [ "datatable-core", "datatable-table", "datatable-head", "datatable-body", "datatable-base", "datatable-column-widths", "datatable-message", "datatable-mutable", "datatable-sort", "datatable-datasource" ] }, "datatable-base": { "requires": [ "datatable-core", "datatable-table", "datatable-head", "datatable-body", "base-build", "widget" ], "skinnable": true }, "datatable-body": { "requires": [ "datatable-core", "view", "classnamemanager" ] }, "datatable-column-widths": { "requires": [ "datatable-base" ] }, "datatable-core": { "requires": [ "escape", "model-list", "node-event-delegate" ] }, "datatable-datasource": { "requires": [ "datatable-base", "plugin", "datasource-local" ] }, "datatable-formatters": { "requires": [ "datatable-body", "datatype-number-format", "datatype-date-format", "escape" ] }, "datatable-head": { "requires": [ "datatable-core", "view", "classnamemanager" ] }, "datatable-message": { "lang": [ "en", "fr", "es" ], "requires": [ "datatable-base" ], "skinnable": true }, "datatable-mutable": { "requires": [ "datatable-base" ] }, "datatable-scroll": { "requires": [ "datatable-base", "datatable-column-widths", "dom-screen" ], "skinnable": true }, "datatable-sort": { "lang": [ "en", "fr", "es" ], "requires": [ "datatable-base" ], "skinnable": true }, "datatable-table": { "requires": [ "datatable-core", "datatable-head", "datatable-body", "view", "classnamemanager" ] }, "datatype": { "use": [ "datatype-date", "datatype-number", "datatype-xml" ] }, "datatype-date": { "use": [ "datatype-date-parse", "datatype-date-format", "datatype-date-math" ] }, "datatype-date-format": { "lang": [ "ar", "ar-JO", "ca", "ca-ES", "da", "da-DK", "de", "de-AT", "de-DE", "el", "el-GR", "en", "en-AU", "en-CA", "en-GB", "en-IE", "en-IN", "en-JO", "en-MY", "en-NZ", "en-PH", "en-SG", "en-US", "es", "es-AR", "es-BO", "es-CL", "es-CO", "es-EC", "es-ES", "es-MX", "es-PE", "es-PY", "es-US", "es-UY", "es-VE", "fi", "fi-FI", "fr", "fr-BE", "fr-CA", "fr-FR", "hi", "hi-IN", "id", "id-ID", "it", "it-IT", "ja", "ja-JP", "ko", "ko-KR", "ms", "ms-MY", "nb", "nb-NO", "nl", "nl-BE", "nl-NL", "pl", "pl-PL", "pt", "pt-BR", "ro", "ro-RO", "ru", "ru-RU", "sv", "sv-SE", "th", "th-TH", "tr", "tr-TR", "vi", "vi-VN", "zh-Hans", "zh-Hans-CN", "zh-Hant", "zh-Hant-HK", "zh-Hant-TW" ] }, "datatype-date-math": { "requires": [ "yui-base" ] }, "datatype-date-parse": {}, "datatype-number": { "use": [ "datatype-number-parse", "datatype-number-format" ] }, "datatype-number-format": {}, "datatype-number-parse": {}, "datatype-xml": { "use": [ "datatype-xml-parse", "datatype-xml-format" ] }, "datatype-xml-format": {}, "datatype-xml-parse": {}, "dd": { "use": [ "dd-ddm-base", "dd-ddm", "dd-ddm-drop", "dd-drag", "dd-proxy", "dd-constrain", "dd-drop", "dd-scroll", "dd-delegate" ] }, "dd-constrain": { "requires": [ "dd-drag" ] }, "dd-ddm": { "requires": [ "dd-ddm-base", "event-resize" ] }, "dd-ddm-base": { "requires": [ "node", "base", "yui-throttle", "classnamemanager" ] }, "dd-ddm-drop": { "requires": [ "dd-ddm" ] }, "dd-delegate": { "requires": [ "dd-drag", "dd-drop-plugin", "event-mouseenter" ] }, "dd-drag": { "requires": [ "dd-ddm-base" ] }, "dd-drop": { "requires": [ "dd-drag", "dd-ddm-drop" ] }, "dd-drop-plugin": { "requires": [ "dd-drop" ] }, "dd-gestures": { "condition": { "name": "dd-gestures", "trigger": "dd-drag", "ua": "touchEnabled" }, "requires": [ "dd-drag", "event-synthetic", "event-gestures" ] }, "dd-plugin": { "optional": [ "dd-constrain", "dd-proxy" ], "requires": [ "dd-drag" ] }, "dd-proxy": { "requires": [ "dd-drag" ] }, "dd-scroll": { "requires": [ "dd-drag" ] }, "dial": { "lang": [ "en", "es" ], "requires": [ "widget", "dd-drag", "event-mouseenter", "event-move", "event-key", "transition", "intl" ], "skinnable": true }, "dom": { "use": [ "dom-base", "dom-screen", "dom-style", "selector-native", "selector" ] }, "dom-base": { "requires": [ "dom-core" ] }, "dom-core": { "requires": [ "oop", "features" ] }, "dom-deprecated": { "requires": [ "dom-base" ] }, "dom-screen": { "requires": [ "dom-base", "dom-style" ] }, "dom-style": { "requires": [ "dom-base" ] }, "dom-style-ie": { "condition": { "name": "dom-style-ie", "test": function (Y) { var testFeature = Y.Features.test, addFeature = Y.Features.add, WINDOW = Y.config.win, DOCUMENT = Y.config.doc, DOCUMENT_ELEMENT = 'documentElement', ret = false; addFeature('style', 'computedStyle', { test: function() { return WINDOW && 'getComputedStyle' in WINDOW; } }); addFeature('style', 'opacity', { test: function() { return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style; } }); ret = (!testFeature('style', 'opacity') && !testFeature('style', 'computedStyle')); return ret; }, "trigger": "dom-style" }, "requires": [ "dom-style" ] }, "dump": { "requires": [ "yui-base" ] }, "editor": { "use": [ "frame", "editor-selection", "exec-command", "editor-base", "editor-para", "editor-br", "editor-bidi", "editor-tab", "createlink-base" ] }, "editor-base": { "requires": [ "base", "frame", "node", "exec-command", "editor-selection" ] }, "editor-bidi": { "requires": [ "editor-base" ] }, "editor-br": { "requires": [ "editor-base" ] }, "editor-lists": { "requires": [ "editor-base" ] }, "editor-para": { "requires": [ "editor-para-base" ] }, "editor-para-base": { "requires": [ "editor-base" ] }, "editor-para-ie": { "condition": { "name": "editor-para-ie", "trigger": "editor-para", "ua": "ie", "when": "instead" }, "requires": [ "editor-para-base" ] }, "editor-selection": { "requires": [ "node" ] }, "editor-tab": { "requires": [ "editor-base" ] }, "escape": { "requires": [ "yui-base" ] }, "event": { "after": [ "node-base" ], "use": [ "event-base", "event-delegate", "event-synthetic", "event-mousewheel", "event-mouseenter", "event-key", "event-focus", "event-resize", "event-hover", "event-outside", "event-touch", "event-move", "event-flick", "event-valuechange", "event-tap" ] }, "event-base": { "after": [ "node-base" ], "requires": [ "event-custom-base" ] }, "event-base-ie": { "after": [ "event-base" ], "condition": { "name": "event-base-ie", "test": function(Y) { var imp = Y.config.doc && Y.config.doc.implementation; return (imp && (!imp.hasFeature('Events', '2.0'))); }, "trigger": "node-base" }, "requires": [ "node-base" ] }, "event-contextmenu": { "requires": [ "event-synthetic", "dom-screen" ] }, "event-custom": { "use": [ "event-custom-base", "event-custom-complex" ] }, "event-custom-base": { "requires": [ "oop" ] }, "event-custom-complex": { "requires": [ "event-custom-base" ] }, "event-delegate": { "requires": [ "node-base" ] }, "event-flick": { "requires": [ "node-base", "event-touch", "event-synthetic" ] }, "event-focus": { "requires": [ "event-synthetic" ] }, "event-gestures": { "use": [ "event-flick", "event-move" ] }, "event-hover": { "requires": [ "event-mouseenter" ] }, "event-key": { "requires": [ "event-synthetic" ] }, "event-mouseenter": { "requires": [ "event-synthetic" ] }, "event-mousewheel": { "requires": [ "node-base" ] }, "event-move": { "requires": [ "node-base", "event-touch", "event-synthetic" ] }, "event-outside": { "requires": [ "event-synthetic" ] }, "event-resize": { "requires": [ "node-base", "event-synthetic" ] }, "event-simulate": { "requires": [ "event-base" ] }, "event-synthetic": { "requires": [ "node-base", "event-custom-complex" ] }, "event-tap": { "requires": [ "node-base", "event-base", "event-touch", "event-synthetic" ] }, "event-touch": { "requires": [ "node-base" ] }, "event-valuechange": { "requires": [ "event-focus", "event-synthetic" ] }, "exec-command": { "requires": [ "frame" ] }, "features": { "requires": [ "yui-base" ] }, "file": { "requires": [ "file-flash", "file-html5" ] }, "file-flash": { "requires": [ "base" ] }, "file-html5": { "requires": [ "base" ] }, "frame": { "requires": [ "base", "node", "selector-css3", "yui-throttle" ] }, "gesture-simulate": { "requires": [ "async-queue", "event-simulate", "node-screen" ] }, "get": { "requires": [ "yui-base" ] }, "graphics": { "requires": [ "node", "event-custom", "pluginhost", "matrix", "classnamemanager" ] }, "graphics-canvas": { "condition": { "name": "graphics-canvas", "test": function(Y) { var DOCUMENT = Y.config.doc, useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", canvas = DOCUMENT && DOCUMENT.createElement("canvas"), svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); }, "trigger": "graphics" }, "requires": [ "graphics" ] }, "graphics-canvas-default": { "condition": { "name": "graphics-canvas-default", "test": function(Y) { var DOCUMENT = Y.config.doc, useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", canvas = DOCUMENT && DOCUMENT.createElement("canvas"), svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); }, "trigger": "graphics" } }, "graphics-group": { "requires": [ "graphics" ] }, "graphics-svg": { "condition": { "name": "graphics-svg", "test": function(Y) { var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", canvas = DOCUMENT && DOCUMENT.createElement("canvas"), svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); return svg && (useSVG || !canvas); }, "trigger": "graphics" }, "requires": [ "graphics" ] }, "graphics-svg-default": { "condition": { "name": "graphics-svg-default", "test": function(Y) { var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", canvas = DOCUMENT && DOCUMENT.createElement("canvas"), svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); return svg && (useSVG || !canvas); }, "trigger": "graphics" } }, "graphics-vml": { "condition": { "name": "graphics-vml", "test": function(Y) { var DOCUMENT = Y.config.doc, canvas = DOCUMENT && DOCUMENT.createElement("canvas"); return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); }, "trigger": "graphics" }, "requires": [ "graphics" ] }, "graphics-vml-default": { "condition": { "name": "graphics-vml-default", "test": function(Y) { var DOCUMENT = Y.config.doc, canvas = DOCUMENT && DOCUMENT.createElement("canvas"); return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); }, "trigger": "graphics" } }, "handlebars": { "use": [ "handlebars-compiler" ] }, "handlebars-base": { "requires": [] }, "handlebars-compiler": { "requires": [ "handlebars-base" ] }, "highlight": { "use": [ "highlight-base", "highlight-accentfold" ] }, "highlight-accentfold": { "requires": [ "highlight-base", "text-accentfold" ] }, "highlight-base": { "requires": [ "array-extras", "classnamemanager", "escape", "text-wordbreak" ] }, "history": { "use": [ "history-base", "history-hash", "history-hash-ie", "history-html5" ] }, "history-base": { "requires": [ "event-custom-complex" ] }, "history-hash": { "after": [ "history-html5" ], "requires": [ "event-synthetic", "history-base", "yui-later" ] }, "history-hash-ie": { "condition": { "name": "history-hash-ie", "test": function (Y) { var docMode = Y.config.doc && Y.config.doc.documentMode; return Y.UA.ie && (!('onhashchange' in Y.config.win) || !docMode || docMode < 8); }, "trigger": "history-hash" }, "requires": [ "history-hash", "node-base" ] }, "history-html5": { "optional": [ "json" ], "requires": [ "event-base", "history-base", "node-base" ] }, "imageloader": { "requires": [ "base-base", "node-style", "node-screen" ] }, "intl": { "requires": [ "intl-base", "event-custom" ] }, "intl-base": { "requires": [ "yui-base" ] }, "io": { "use": [ "io-base", "io-xdr", "io-form", "io-upload-iframe", "io-queue" ] }, "io-base": { "requires": [ "event-custom-base", "querystring-stringify-simple" ] }, "io-form": { "requires": [ "io-base", "node-base" ] }, "io-nodejs": { "condition": { "name": "io-nodejs", "trigger": "io-base", "ua": "nodejs" }, "requires": [ "io-base" ] }, "io-queue": { "requires": [ "io-base", "queue-promote" ] }, "io-upload-iframe": { "requires": [ "io-base", "node-base" ] }, "io-xdr": { "requires": [ "io-base", "datatype-xml-parse" ] }, "json": { "use": [ "json-parse", "json-stringify" ] }, "json-parse": { "requires": [ "yui-base" ] }, "json-parse-shim": { "condition": { "name": "json-parse-shim", "test": function (Y) { var _JSON = Y.config.global.JSON, Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, nativeSupport = Y.config.useNativeJSONParse !== false && !!Native; function workingNative( k, v ) { return k === "ok" ? true : v; } // Double check basic functionality. This is mainly to catch early broken // implementations of the JSON API in Firefox 3.1 beta1 and beta2 if ( nativeSupport ) { try { nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok; } catch ( e ) { nativeSupport = false; } } return !nativeSupport; }, "trigger": "json-parse" }, "requires": [ "json-parse" ] }, "json-stringify": { "requires": [ "yui-base" ] }, "json-stringify-shim": { "condition": { "name": "json-stringify-shim", "test": function (Y) { var _JSON = Y.config.global.JSON, Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native; // Double check basic native functionality. This is primarily to catch broken // early JSON API implementations in Firefox 3.1 beta1 and beta2. if ( nativeSupport ) { try { nativeSupport = ( '0' === Native.stringify(0) ); } catch ( e ) { nativeSupport = false; } } return !nativeSupport; }, "trigger": "json-stringify" }, "requires": [ "json-stringify" ] }, "jsonp": { "requires": [ "get", "oop" ] }, "jsonp-url": { "requires": [ "jsonp" ] }, "lazy-model-list": { "requires": [ "model-list" ] }, "loader": { "use": [ "loader-base", "loader-rollup", "loader-yui3" ] }, "loader-base": { "requires": [ "get", "features" ] }, "loader-rollup": { "requires": [ "loader-base" ] }, "loader-yui3": { "requires": [ "loader-base" ] }, "matrix": { "requires": [ "yui-base" ] }, "model": { "requires": [ "base-build", "escape", "json-parse" ] }, "model-list": { "requires": [ "array-extras", "array-invoke", "arraylist", "base-build", "escape", "json-parse", "model" ] }, "model-sync-rest": { "requires": [ "model", "io-base", "json-stringify" ] }, "node": { "use": [ "node-base", "node-event-delegate", "node-pluginhost", "node-screen", "node-style" ] }, "node-base": { "requires": [ "event-base", "node-core", "dom-base" ] }, "node-core": { "requires": [ "dom-core", "selector" ] }, "node-deprecated": { "requires": [ "node-base" ] }, "node-event-delegate": { "requires": [ "node-base", "event-delegate" ] }, "node-event-html5": { "requires": [ "node-base" ] }, "node-event-simulate": { "requires": [ "node-base", "event-simulate", "gesture-simulate" ] }, "node-flick": { "requires": [ "classnamemanager", "transition", "event-flick", "plugin" ], "skinnable": true }, "node-focusmanager": { "requires": [ "attribute", "node", "plugin", "node-event-simulate", "event-key", "event-focus" ] }, "node-load": { "requires": [ "node-base", "io-base" ] }, "node-menunav": { "requires": [ "node", "classnamemanager", "plugin", "node-focusmanager" ], "skinnable": true }, "node-pluginhost": { "requires": [ "node-base", "pluginhost" ] }, "node-screen": { "requires": [ "dom-screen", "node-base" ] }, "node-scroll-info": { "requires": [ "base-build", "dom-screen", "event-resize", "node-pluginhost", "plugin" ] }, "node-style": { "requires": [ "dom-style", "node-base" ] }, "oop": { "requires": [ "yui-base" ] }, "overlay": { "requires": [ "widget", "widget-stdmod", "widget-position", "widget-position-align", "widget-stack", "widget-position-constrain" ], "skinnable": true }, "panel": { "requires": [ "widget", "widget-autohide", "widget-buttons", "widget-modality", "widget-position", "widget-position-align", "widget-position-constrain", "widget-stack", "widget-stdmod" ], "skinnable": true }, "parallel": { "requires": [ "yui-base" ] }, "pjax": { "requires": [ "pjax-base", "pjax-content" ] }, "pjax-base": { "requires": [ "classnamemanager", "node-event-delegate", "router" ] }, "pjax-content": { "requires": [ "io-base", "node-base", "router" ] }, "pjax-plugin": { "requires": [ "node-pluginhost", "pjax", "plugin" ] }, "plugin": { "requires": [ "base-base" ] }, "pluginhost": { "use": [ "pluginhost-base", "pluginhost-config" ] }, "pluginhost-base": { "requires": [ "yui-base" ] }, "pluginhost-config": { "requires": [ "pluginhost-base" ] }, "profiler": { "requires": [ "yui-base" ] }, "promise": { "requires": [ "timers" ] }, "querystring": { "use": [ "querystring-parse", "querystring-stringify" ] }, "querystring-parse": { "requires": [ "yui-base", "array-extras" ] }, "querystring-parse-simple": { "requires": [ "yui-base" ] }, "querystring-stringify": { "requires": [ "yui-base" ] }, "querystring-stringify-simple": { "requires": [ "yui-base" ] }, "queue-promote": { "requires": [ "yui-base" ] }, "range-slider": { "requires": [ "slider-base", "slider-value-range", "clickable-rail" ] }, "recordset": { "use": [ "recordset-base", "recordset-sort", "recordset-filter", "recordset-indexer" ] }, "recordset-base": { "requires": [ "base", "arraylist" ] }, "recordset-filter": { "requires": [ "recordset-base", "array-extras", "plugin" ] }, "recordset-indexer": { "requires": [ "recordset-base", "plugin" ] }, "recordset-sort": { "requires": [ "arraysort", "recordset-base", "plugin" ] }, "resize": { "use": [ "resize-base", "resize-proxy", "resize-constrain" ] }, "resize-base": { "requires": [ "base", "widget", "event", "oop", "dd-drag", "dd-delegate", "dd-drop" ], "skinnable": true }, "resize-constrain": { "requires": [ "plugin", "resize-base" ] }, "resize-plugin": { "optional": [ "resize-constrain" ], "requires": [ "resize-base", "plugin" ] }, "resize-proxy": { "requires": [ "plugin", "resize-base" ] }, "router": { "optional": [ "querystring-parse" ], "requires": [ "array-extras", "base-build", "history" ] }, "scrollview": { "requires": [ "scrollview-base", "scrollview-scrollbars" ] }, "scrollview-base": { "requires": [ "widget", "event-gestures", "event-mousewheel", "transition" ], "skinnable": true }, "scrollview-base-ie": { "condition": { "name": "scrollview-base-ie", "trigger": "scrollview-base", "ua": "ie" }, "requires": [ "scrollview-base" ] }, "scrollview-list": { "requires": [ "plugin", "classnamemanager" ], "skinnable": true }, "scrollview-paginator": { "requires": [ "plugin", "classnamemanager" ] }, "scrollview-scrollbars": { "requires": [ "classnamemanager", "transition", "plugin" ], "skinnable": true }, "selector": { "requires": [ "selector-native" ] }, "selector-css2": { "condition": { "name": "selector-css2", "test": function (Y) { var DOCUMENT = Y.config.doc, ret = DOCUMENT && !('querySelectorAll' in DOCUMENT); return ret; }, "trigger": "selector" }, "requires": [ "selector-native" ] }, "selector-css3": { "requires": [ "selector-native", "selector-css2" ] }, "selector-native": { "requires": [ "dom-base" ] }, "series-area": { "requires": [ "series-cartesian", "series-fill-util" ] }, "series-area-stacked": { "requires": [ "series-stacked", "series-area" ] }, "series-areaspline": { "requires": [ "series-area", "series-curve-util" ] }, "series-areaspline-stacked": { "requires": [ "series-stacked", "series-areaspline" ] }, "series-bar": { "requires": [ "series-marker", "series-histogram-base" ] }, "series-bar-stacked": { "requires": [ "series-stacked", "series-bar" ] }, "series-base": { "requires": [ "graphics", "axis-base" ] }, "series-candlestick": { "requires": [ "series-range" ] }, "series-cartesian": { "requires": [ "series-base" ] }, "series-column": { "requires": [ "series-marker", "series-histogram-base" ] }, "series-column-stacked": { "requires": [ "series-stacked", "series-column" ] }, "series-combo": { "requires": [ "series-cartesian", "series-line-util", "series-plot-util", "series-fill-util" ] }, "series-combo-stacked": { "requires": [ "series-stacked", "series-combo" ] }, "series-combospline": { "requires": [ "series-combo", "series-curve-util" ] }, "series-combospline-stacked": { "requires": [ "series-combo-stacked", "series-curve-util" ] }, "series-curve-util": {}, "series-fill-util": {}, "series-histogram-base": { "requires": [ "series-cartesian", "series-plot-util" ] }, "series-line": { "requires": [ "series-cartesian", "series-line-util" ] }, "series-line-stacked": { "requires": [ "series-stacked", "series-line" ] }, "series-line-util": {}, "series-marker": { "requires": [ "series-cartesian", "series-plot-util" ] }, "series-marker-stacked": { "requires": [ "series-stacked", "series-marker" ] }, "series-ohlc": { "requires": [ "series-range" ] }, "series-pie": { "requires": [ "series-base", "series-plot-util" ] }, "series-plot-util": {}, "series-range": { "requires": [ "series-cartesian" ] }, "series-spline": { "requires": [ "series-line", "series-curve-util" ] }, "series-spline-stacked": { "requires": [ "series-stacked", "series-spline" ] }, "series-stacked": { "requires": [ "axis-stacked" ] }, "shim-plugin": { "requires": [ "node-style", "node-pluginhost" ] }, "slider": { "use": [ "slider-base", "slider-value-range", "clickable-rail", "range-slider" ] }, "slider-base": { "requires": [ "widget", "dd-constrain", "event-key" ], "skinnable": true }, "slider-value-range": { "requires": [ "slider-base" ] }, "sortable": { "requires": [ "dd-delegate", "dd-drop-plugin", "dd-proxy" ] }, "sortable-scroll": { "requires": [ "dd-scroll", "sortable" ] }, "stylesheet": { "requires": [ "yui-base" ] }, "substitute": { "optional": [ "dump" ], "requires": [ "yui-base" ] }, "swf": { "requires": [ "event-custom", "node", "swfdetect", "escape" ] }, "swfdetect": { "requires": [ "yui-base" ] }, "tabview": { "requires": [ "widget", "widget-parent", "widget-child", "tabview-base", "node-pluginhost", "node-focusmanager" ], "skinnable": true }, "tabview-base": { "requires": [ "node-event-delegate", "classnamemanager", "skin-sam-tabview" ] }, "tabview-plugin": { "requires": [ "tabview-base" ] }, "template": { "use": [ "template-base", "template-micro" ] }, "template-base": { "requires": [ "yui-base" ] }, "template-micro": { "requires": [ "escape" ] }, "test": { "requires": [ "event-simulate", "event-custom", "json-stringify" ] }, "test-console": { "requires": [ "console-filters", "test", "array-extras" ], "skinnable": true }, "text": { "use": [ "text-accentfold", "text-wordbreak" ] }, "text-accentfold": { "requires": [ "array-extras", "text-data-accentfold" ] }, "text-data-accentfold": { "requires": [ "yui-base" ] }, "text-data-wordbreak": { "requires": [ "yui-base" ] }, "text-wordbreak": { "requires": [ "array-extras", "text-data-wordbreak" ] }, "timers": { "requires": [ "yui-base" ] }, "transition": { "requires": [ "node-style" ] }, "transition-timer": { "condition": { "name": "transition-timer", "test": function (Y) { var DOCUMENT = Y.config.doc, node = (DOCUMENT) ? DOCUMENT.documentElement: null, ret = true; if (node && node.style) { ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); } return ret; }, "trigger": "transition" }, "requires": [ "transition" ] }, "tree": { "requires": [ "base-build", "tree-node" ] }, "tree-labelable": { "requires": [ "tree" ] }, "tree-lazy": { "requires": [ "base-pluginhost", "plugin", "tree" ] }, "tree-node": {}, "tree-openable": { "requires": [ "tree" ] }, "tree-selectable": { "requires": [ "tree" ] }, "uploader": { "requires": [ "uploader-html5", "uploader-flash" ] }, "uploader-flash": { "requires": [ "swf", "widget", "base", "cssbutton", "node", "event-custom", "file-flash", "uploader-queue" ] }, "uploader-html5": { "requires": [ "widget", "node-event-simulate", "file-html5", "uploader-queue" ] }, "uploader-queue": { "requires": [ "base" ] }, "view": { "requires": [ "base-build", "node-event-delegate" ] }, "view-node-map": { "requires": [ "view" ] }, "widget": { "use": [ "widget-base", "widget-htmlparser", "widget-skin", "widget-uievents" ] }, "widget-anim": { "requires": [ "anim-base", "plugin", "widget" ] }, "widget-autohide": { "requires": [ "base-build", "event-key", "event-outside", "widget" ] }, "widget-base": { "requires": [ "attribute", "base-base", "base-pluginhost", "classnamemanager", "event-focus", "node-base", "node-style" ], "skinnable": true }, "widget-base-ie": { "condition": { "name": "widget-base-ie", "trigger": "widget-base", "ua": "ie" }, "requires": [ "widget-base" ] }, "widget-buttons": { "requires": [ "button-plugin", "cssbutton", "widget-stdmod" ] }, "widget-child": { "requires": [ "base-build", "widget" ] }, "widget-htmlparser": { "requires": [ "widget-base" ] }, "widget-locale": { "requires": [ "widget-base" ] }, "widget-modality": { "requires": [ "base-build", "event-outside", "widget" ], "skinnable": true }, "widget-parent": { "requires": [ "arraylist", "base-build", "widget" ] }, "widget-position": { "requires": [ "base-build", "node-screen", "widget" ] }, "widget-position-align": { "requires": [ "widget-position" ] }, "widget-position-constrain": { "requires": [ "widget-position" ] }, "widget-skin": { "requires": [ "widget-base" ] }, "widget-stack": { "requires": [ "base-build", "widget" ], "skinnable": true }, "widget-stdmod": { "requires": [ "base-build", "widget" ] }, "widget-uievents": { "requires": [ "node-event-delegate", "widget-base" ] }, "yql": { "requires": [ "oop" ] }, "yql-jsonp": { "condition": { "name": "yql-jsonp", "test": function (Y) { /* Only load the JSONP module when not in nodejs or winjs TODO Make the winjs module a CORS module */ return (!Y.UA.nodejs && !Y.UA.winjs); }, "trigger": "yql", "when": "after" }, "requires": [ "jsonp", "jsonp-url" ] }, "yql-nodejs": { "condition": { "name": "yql-nodejs", "trigger": "yql", "ua": "nodejs", "when": "after" } }, "yql-winjs": { "condition": { "name": "yql-winjs", "trigger": "yql", "ua": "winjs", "when": "after" } }, "yui": {}, "yui-base": {}, "yui-later": { "requires": [ "yui-base" ] }, "yui-log": { "requires": [ "yui-base" ] }, "yui-throttle": { "requires": [ "yui-base" ] } }); YUI.Env[Y.version].md5 = '660f328e92276f36e9abfafb02169183'; }, '@VERSION@', {"requires": ["loader-base"]});
FezVrasta/cdnjs
ajax/libs/yui/3.9.0/loader-yui3/loader-yui3.js
JavaScript
mit
61,226
<?php /* * 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 * OWNER 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. * * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ namespace Doctrine\ORM\Persisters; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\Common\Collections\Criteria; /** * Persister for entities that participate in a hierarchy mapped with the * SINGLE_TABLE strategy. * * @author Roman Borschel <roman@code-factory.org> * @author Benjamin Eberlei <kontakt@beberlei.de> * @author Alexander <iam.asm89@gmail.com> * @since 2.0 * @link http://martinfowler.com/eaaCatalog/singleTableInheritance.html */ class SingleTablePersister extends AbstractEntityInheritancePersister { /** * {@inheritdoc} */ protected function getDiscriminatorColumnTableName() { return $this->class->getTableName(); } /** * {@inheritdoc} */ protected function getSelectColumnsSQL() { if ($this->selectColumnListSql !== null) { return $this->selectColumnListSql; } $columnList[] = parent::getSelectColumnsSQL(); $rootClass = $this->em->getClassMetadata($this->class->rootEntityName); $tableAlias = $this->getSQLTableAlias($rootClass->name); // Append discriminator column $discrColumn = $this->class->discriminatorColumn['name']; $columnList[] = $tableAlias . '.' . $discrColumn; $resultColumnName = $this->platform->getSQLResultCasing($discrColumn); $this->rsm->setDiscriminatorColumn('r', $resultColumnName); $this->rsm->addMetaResult('r', $resultColumnName, $discrColumn); // Append subclass columns foreach ($this->class->subClasses as $subClassName) { $subClass = $this->em->getClassMetadata($subClassName); // Regular columns foreach ($subClass->fieldMappings as $fieldName => $mapping) { if (isset($mapping['inherited'])) { continue; } $columnList[] = $this->getSelectColumnSQL($fieldName, $subClass); } // Foreign key columns foreach ($subClass->associationMappings as $assoc) { if ( ! $assoc['isOwningSide'] || ! ($assoc['type'] & ClassMetadata::TO_ONE) || isset($assoc['inherited'])) { continue; } foreach ($assoc['targetToSourceKeyColumns'] as $srcColumn) { $className = isset($assoc['inherited']) ? $assoc['inherited'] : $this->class->name; $columnList[] = $this->getSelectJoinColumnSQL($tableAlias, $srcColumn, $className); } } } $this->selectColumnListSql = implode(', ', $columnList); return $this->selectColumnListSql; } /** * {@inheritdoc} */ protected function getInsertColumnList() { $columns = parent::getInsertColumnList(); // Add discriminator column to the INSERT SQL $columns[] = $this->class->discriminatorColumn['name']; return $columns; } /** * {@inheritdoc} */ protected function getSQLTableAlias($className, $assocName = '') { return parent::getSQLTableAlias($this->class->rootEntityName, $assocName); } /** * {@inheritdoc} */ protected function getSelectConditionSQL(array $criteria, $assoc = null) { $conditionSql = parent::getSelectConditionSQL($criteria, $assoc); if ($conditionSql) { $conditionSql .= ' AND '; } return $conditionSql . $this->getSelectConditionDiscriminatorValueSQL(); } /** * {@inheritdoc} */ protected function getSelectConditionCriteriaSQL(Criteria $criteria) { $conditionSql = parent::getSelectConditionCriteriaSQL($criteria); if ($conditionSql) { $conditionSql .= ' AND '; } return $conditionSql . $this->getSelectConditionDiscriminatorValueSQL(); } /** * @return string */ protected function getSelectConditionDiscriminatorValueSQL() { $values = array(); if ($this->class->discriminatorValue !== null) { // discriminators can be 0 $values[] = $this->conn->quote($this->class->discriminatorValue); } $discrValues = array_flip($this->class->discriminatorMap); foreach ($this->class->subClasses as $subclassName) { $values[] = $this->conn->quote($discrValues[$subclassName]); } $values = implode(', ', $values); $discColumn = $this->class->discriminatorColumn['name']; $tableAlias = $this->getSQLTableAlias($this->class->name); return $tableAlias . '.' . $discColumn . ' IN (' . $values . ')'; } /** * {@inheritdoc} */ protected function generateFilterConditionSQL(ClassMetadata $targetEntity, $targetTableAlias) { // Ensure that the filters are applied to the root entity of the inheritance tree $targetEntity = $this->em->getClassMetadata($targetEntity->rootEntityName); // we don't care about the $targetTableAlias, in a STI there is only one table. return parent::generateFilterConditionSQL($targetEntity, $targetTableAlias); } }
flo-beck/Symfony
vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/SingleTablePersister.php
PHP
mit
6,201
<?php require dirname(__FILE__).'/../mime_types.php'; Swift_DependencyContainer::getInstance() ->register('properties.charset') ->asValue('utf-8') ->register('mime.grammar') ->asSharedInstanceOf('Swift_Mime_Grammar') ->register('mime.message') ->asNewInstanceOf('Swift_Mime_SimpleMessage') ->withDependencies(array( 'mime.headerset', 'mime.qpcontentencoder', 'cache', 'mime.grammar', 'properties.charset', )) ->register('mime.part') ->asNewInstanceOf('Swift_Mime_MimePart') ->withDependencies(array( 'mime.headerset', 'mime.qpcontentencoder', 'cache', 'mime.grammar', 'properties.charset', )) ->register('mime.attachment') ->asNewInstanceOf('Swift_Mime_Attachment') ->withDependencies(array( 'mime.headerset', 'mime.base64contentencoder', 'cache', 'mime.grammar', )) ->addConstructorValue($swift_mime_types) ->register('mime.embeddedfile') ->asNewInstanceOf('Swift_Mime_EmbeddedFile') ->withDependencies(array( 'mime.headerset', 'mime.base64contentencoder', 'cache', 'mime.grammar', )) ->addConstructorValue($swift_mime_types) ->register('mime.headerfactory') ->asNewInstanceOf('Swift_Mime_SimpleHeaderFactory') ->withDependencies(array( 'mime.qpheaderencoder', 'mime.rfc2231encoder', 'mime.grammar', 'properties.charset', )) ->register('mime.headerset') ->asNewInstanceOf('Swift_Mime_SimpleHeaderSet') ->withDependencies(array('mime.headerfactory', 'properties.charset')) ->register('mime.qpheaderencoder') ->asNewInstanceOf('Swift_Mime_HeaderEncoder_QpHeaderEncoder') ->withDependencies(array('mime.charstream')) ->register('mime.base64headerencoder') ->asNewInstanceOf('Swift_Mime_HeaderEncoder_Base64HeaderEncoder') ->withDependencies(array('mime.charstream')) ->register('mime.charstream') ->asNewInstanceOf('Swift_CharacterStream_NgCharacterStream') ->withDependencies(array('mime.characterreaderfactory', 'properties.charset')) ->register('mime.bytecanonicalizer') ->asSharedInstanceOf('Swift_StreamFilters_ByteArrayReplacementFilter') ->addConstructorValue(array(array(0x0D, 0x0A), array(0x0D), array(0x0A))) ->addConstructorValue(array(array(0x0A), array(0x0A), array(0x0D, 0x0A))) ->register('mime.characterreaderfactory') ->asSharedInstanceOf('Swift_CharacterReaderFactory_SimpleCharacterReaderFactory') ->register('mime.safeqpcontentencoder') ->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder') ->withDependencies(array('mime.charstream', 'mime.bytecanonicalizer')) ->register('mime.rawcontentencoder') ->asNewInstanceOf('Swift_Mime_ContentEncoder_RawContentEncoder') ->register('mime.nativeqpcontentencoder') ->withDependencies(array('properties.charset')) ->asNewInstanceOf('Swift_Mime_ContentEncoder_NativeQpContentEncoder') ->register('mime.qpcontentencoderproxy') ->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoderProxy') ->withDependencies(array('mime.safeqpcontentencoder', 'mime.nativeqpcontentencoder', 'properties.charset')) ->register('mime.7bitcontentencoder') ->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder') ->addConstructorValue('7bit') ->addConstructorValue(true) ->register('mime.8bitcontentencoder') ->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder') ->addConstructorValue('8bit') ->addConstructorValue(true) ->register('mime.base64contentencoder') ->asSharedInstanceOf('Swift_Mime_ContentEncoder_Base64ContentEncoder') ->register('mime.rfc2231encoder') ->asNewInstanceOf('Swift_Encoder_Rfc2231Encoder') ->withDependencies(array('mime.charstream')) // As of PHP 5.4.7, the quoted_printable_encode() function behaves correctly. // see https://github.com/php/php-src/commit/18bb426587d62f93c54c40bf8535eb8416603629 ->register('mime.qpcontentencoder') ->asAliasOf(version_compare(phpversion(), '5.4.7', '>=') ? 'mime.qpcontentencoderproxy' : 'mime.safeqpcontentencoder') ; unset($swift_mime_types);
edirlang/ProyectoBases
vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php
PHP
mit
4,291
define( "dojo/nls/tr/colors", ({ // local representation of all CSS3 named colors, companion to dojo.colors. To be used where descriptive information // is required for each color, such as a palette widget, and not for specifying color programatically. //Note: due to the SVG 1.0 spec additions, some of these are alternate spellings for the same color (e.g. gray / grey). //TODO: should we be using unique rgb values as keys instead and avoid these duplicates, or rely on the caller to do the reverse mapping? aliceblue: "alice mavisi", antiquewhite: "antik beyaz", aqua: "deniz mavisi", aquamarine: "akuamarin", azure: "azur mavisi", beige: "bej", bisque: "bisküvi", black: "siyah", blanchedalmond: "soluk badem", blue: "mavi", blueviolet: "mavi-mor", brown: "kahverengi", burlywood: "sarımsı kahverengi", cadetblue: "denizci mavisi", chartreuse: "chartreuse", chocolate: "çikolata", coral: "mercan", cornflowerblue: "peygamber çiçeği mavisi", cornsilk: "mısır rengi", crimson: "crimson", cyan: "camgöbeği", darkblue: "koyu mavi", darkcyan: "koyu camgöbeği", darkgoldenrod: "koyu sarı", darkgray: "koyu gri", darkgreen: "koyu yeşil", darkgrey: "koyu gri", // same as darkgray darkkhaki: "koyu haki", darkmagenta: "koyu mor", darkolivegreen: "koyu zeytin yeşili", darkorange: "koyu turuncu", darkorchid: "koyu orkide", darkred: "koyu kırmızı", darksalmon: "koyu somon", darkseagreen: "koyu deniz yeşili", darkslateblue: "koyu arduvaz mavisi", darkslategray: "koyu arduvaz grisi", darkslategrey: "koyu arduvaz grisi", // same as darkslategray darkturquoise: "koyu turkuaz", darkviolet: "koyu eflatun", deeppink: "koyu pembe", deepskyblue: "koyu gök mavisi", dimgray: "soluk gri", dimgrey: "soluk gri", // same as dimgray dodgerblue: "toz mavisi", firebrick: "canlı kiremit", floralwhite: "çiçek beyazı", forestgreen: "koyu deniz yeşili", fuchsia: "fuşya", gainsboro: "gainsboro", ghostwhite: "silik beyaz", gold: "altın", goldenrod: "sarısabır", gray: "gri", green: "yeşil", greenyellow: "yeşil-sarı", grey: "gri", // same as gray honeydew: "çam sakızı", hotpink: "sıcak pembe", indianred: "kızılderili kırmızısı", indigo: "çivit mavisi", ivory: "fildişi", khaki: "haki", lavender: "lavanta", lavenderblush: "lavanta pembesi", lawngreen: "çimen yeşili", lemonchiffon: "limoni", lightblue: "açık mavi", lightcoral: "açık mercan", lightcyan: "açık camgöbeği", lightgoldenrodyellow: "açık sarısabır", lightgray: "açık gri", lightgreen: "açık yeşil", lightgrey: "açık gri", // same as lightgray lightpink: "açık pembe", lightsalmon: "açık somon", lightseagreen: "açık deniz yeşili", lightskyblue: "açık gök mavisi", lightslategray: "açık arduvaz grisi", lightslategrey: "açık arduvaz grisi", // same as lightslategray lightsteelblue: "açık metalik mavi", lightyellow: "açık sarı", lime: "limon yeşili", limegreen: "küf yeşili", linen: "keten", magenta: "macenta", maroon: "kestane", mediumaquamarine: "orta akuamarin", mediumblue: "orta mavi", mediumorchid: "orta orkide", mediumpurple: "orta mor", mediumseagreen: "orta deniz yeşili", mediumslateblue: "orta arduvaz mavisi", mediumspringgreen: "orta bahar yeşili", mediumturquoise: "orta turkuaz", mediumvioletred: "orta menekşe kırmızısı", midnightblue: "gece mavisi", mintcream: "naneli krem", mistyrose: "gülkurusu", moccasin: "mokosen", navajowhite: "navajo beyazı", navy: "lacivert", oldlace: "eski dantel", olive: "zeytin", olivedrab: "asker yeşili", orange: "turuncu", orangered: "turuncu kırmızı", orchid: "orkide", palegoldenrod: "soluk sarısabır", palegreen: "soluk yeşil", paleturquoise: "soluk turkuaz", palevioletred: "soluk menekşe kırmızısı", papayawhip: "papaya sapı", peachpuff: "açık şeftali", peru: "peru", pink: "pembe", plum: "erik", powderblue: "pudra mavisi", purple: "mor", red: "kırmızı", rosybrown: "pembemsi kahverengi", royalblue: "parlak koyu mavi", saddlebrown: "açık kahve", salmon: "somon", sandybrown: "kum rengi", seagreen: "deniz yeşili", seashell: "deniz kabuğu", sienna: "koyu kahve", silver: "gümüş", skyblue: "gök mavisi", slateblue: "arduvaz mavisi", slategray: "arduvaz grisi", slategrey: "arduvaz grisi", // same as slategray snow: "kar", springgreen: "bahar yeşili", steelblue: "metalik mavi", tan: "güneş yanığı", teal: "Teal mavi", thistle: "devedikeni", tomato: "domates", transparent: "saydam", turquoise: "turkuaz", violet: "eflatun", wheat: "buğday", white: "beyaz", whitesmoke: "beyaz duman", yellow: "sarı", yellowgreen: "sarı yeşil" }) );
seogi1004/cdnjs
ajax/libs/dojo/1.11.0-rc1/nls/tr/colors.js.uncompressed.js
JavaScript
mit
4,723
// CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod(require("../../lib/codemirror")); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; CodeMirror.defineMode("r", function(config) { function wordObj(str) { var words = str.split(" "), res = {}; for (var i = 0; i < words.length; ++i) res[words[i]] = true; return res; } var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_"); var builtins = wordObj("list quote bquote eval return call parse deparse"); var keywords = wordObj("if else repeat while function for in next break"); var blockkeywords = wordObj("if else repeat while function for"); var opChars = /[+\-*\/^<>=!&|~$:]/; var curPunc; function tokenBase(stream, state) { curPunc = null; var ch = stream.next(); if (ch == "#") { stream.skipToEnd(); return "comment"; } else if (ch == "0" && stream.eat("x")) { stream.eatWhile(/[\da-f]/i); return "number"; } else if (ch == "." && stream.eat(/\d/)) { stream.match(/\d*(?:e[+\-]?\d+)?/); return "number"; } else if (/\d/.test(ch)) { stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/); return "number"; } else if (ch == "'" || ch == '"') { state.tokenize = tokenString(ch); return "string"; } else if (ch == "." && stream.match(/.[.\d]+/)) { return "keyword"; } else if (/[\w\.]/.test(ch) && ch != "_") { stream.eatWhile(/[\w\.]/); var word = stream.current(); if (atoms.propertyIsEnumerable(word)) return "atom"; if (keywords.propertyIsEnumerable(word)) { // Block keywords start new blocks, except 'else if', which only starts // one new block for the 'if', no block for the 'else'. if (blockkeywords.propertyIsEnumerable(word) && !stream.match(/\s*if(\s+|$)/, false)) curPunc = "block"; return "keyword"; } if (builtins.propertyIsEnumerable(word)) return "builtin"; return "variable"; } else if (ch == "%") { if (stream.skipTo("%")) stream.next(); return "variable-2"; } else if (ch == "<" && stream.eat("-")) { return "arrow"; } else if (ch == "=" && state.ctx.argList) { return "arg-is"; } else if (opChars.test(ch)) { if (ch == "$") return "dollar"; stream.eatWhile(opChars); return "operator"; } else if (/[\(\){}\[\];]/.test(ch)) { curPunc = ch; if (ch == ";") return "semi"; return null; } else { return null; } } function tokenString(quote) { return function(stream, state) { if (stream.eat("\\")) { var ch = stream.next(); if (ch == "x") stream.match(/^[a-f0-9]{2}/i); else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next(); else if (ch == "u") stream.match(/^[a-f0-9]{4}/i); else if (ch == "U") stream.match(/^[a-f0-9]{8}/i); else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/); return "string-2"; } else { var next; while ((next = stream.next()) != null) { if (next == quote) { state.tokenize = tokenBase; break; } if (next == "\\") { stream.backUp(1); break; } } return "string"; } }; } function push(state, type, stream) { state.ctx = {type: type, indent: state.indent, align: null, column: stream.column(), prev: state.ctx}; } function pop(state) { state.indent = state.ctx.indent; state.ctx = state.ctx.prev; } return { startState: function() { return {tokenize: tokenBase, ctx: {type: "top", indent: -config.indentUnit, align: false}, indent: 0, afterIdent: false}; }, token: function(stream, state) { if (stream.sol()) { if (state.ctx.align == null) state.ctx.align = false; state.indent = stream.indentation(); } if (stream.eatSpace()) return null; var style = state.tokenize(stream, state); if (style != "comment" && state.ctx.align == null) state.ctx.align = true; var ctype = state.ctx.type; if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state); if (curPunc == "{") push(state, "}", stream); else if (curPunc == "(") { push(state, ")", stream); if (state.afterIdent) state.ctx.argList = true; } else if (curPunc == "[") push(state, "]", stream); else if (curPunc == "block") push(state, "block", stream); else if (curPunc == ctype) pop(state); state.afterIdent = style == "variable" || style == "keyword"; return style; }, indent: function(state, textAfter) { if (state.tokenize != tokenBase) return 0; var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx, closing = firstChar == ctx.type; if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit); else if (ctx.align) return ctx.column + (closing ? 0 : 1); else return ctx.indent + (closing ? 0 : config.indentUnit); }, lineComment: "#" }; }); CodeMirror.defineMIME("text/x-rsrc", "r"); });
jieter/cdnjs
ajax/libs/codemirror/4.9.0/mode/r/r.js
JavaScript
mit
5,622
define( "dojo/nls/ja/colors", ({ // local representation of all CSS3 named colors, companion to dojo.colors. To be used where descriptive information // is required for each color, such as a palette widget, and not for specifying color programatically. //Note: due to the SVG 1.0 spec additions, some of these are alternate spellings for the same color (e.g. gray / grey). //TODO: should we be using unique rgb values as keys instead and avoid these duplicates, or rely on the caller to do the reverse mapping? aliceblue: "アリスブルー", antiquewhite: "アンティークホワイト", aqua: "アクア", aquamarine: "碧緑", azure: "薄い空色", beige: "ベージュ", bisque: "ビスク", black: "黒", blanchedalmond: "皮なしアーモンド", blue: "青", blueviolet: "青紫", brown: "茶", burlywood: "バーリーウッド", cadetblue: "くすんだ青", chartreuse: "淡黄緑", chocolate: "チョコレート", coral: "珊瑚", cornflowerblue: "コーンフラワーブルー", cornsilk: "コーンシルク", crimson: "深紅", cyan: "シアンブルー", darkblue: "ダークブルー", darkcyan: "ダークシアンブルー", darkgoldenrod: "ダークゴールデンロッド", darkgray: "ダークグレイ", darkgreen: "ダークグリーン", darkgrey: "ダークグレイ", // same as darkgray darkkhaki: "ダークカーキ", darkmagenta: "ダークマジェンタ", darkolivegreen: "ダークオリーブグリーン", darkorange: "ダークオレンジ", darkorchid: "ダークオーキッド", darkred: "ダークレッド", darksalmon: "ダークサーモン", darkseagreen: "ダークシーグリーン", darkslateblue: "ダークスレートブルー", darkslategray: "ダークスレートグレイ", darkslategrey: "ダークスレートグレイ", // same as darkslategray darkturquoise: "ダークターコイズ", darkviolet: "ダークバイオレット", deeppink: "濃いピンク", deepskyblue: "濃い空色", dimgray: "くすんだグレイ", dimgrey: "くすんだグレイ", // same as dimgray dodgerblue: "ドッジャーブルー", firebrick: "赤煉瓦色", floralwhite: "フローラルホワイト", forestgreen: "フォレストグリーン", fuchsia: "紫紅色", gainsboro: "ゲインズボーロ", ghostwhite: "ゴーストホワイト", gold: "金", goldenrod: "ゴールデンロッド", gray: "グレイ", green: "緑", greenyellow: "緑黄色", grey: "グレイ", // same as gray honeydew: "ハニーデュー", hotpink: "ホットピンク", indianred: "インディアンレッド", indigo: "藍色", ivory: "アイボリー", khaki: "カーキ", lavender: "ラベンダー", lavenderblush: "ラベンダーブラッシ", lawngreen: "ローングリーン", lemonchiffon: "レモンシフォン", lightblue: "ライトブルー", lightcoral: "ライトコーラル", lightcyan: "ライトシアン", lightgoldenrodyellow: "ライトゴールデンロッドイエロー", lightgray: "ライトグレイ", lightgreen: "ライトグリーン", lightgrey: "ライトグレイ", // same as lightgray lightpink: "ライトピンク", lightsalmon: "ライトサーモン", lightseagreen: "ライトシーグリーン", lightskyblue: "ライトスカイブルー", lightslategray: "ライトスレートグレイ", lightslategrey: "ライトスレートグレイ", // same as lightslategray lightsteelblue: "ライトスチールブルー", lightyellow: "ライトイエロー", lime: "ライム", limegreen: "ライムグリーン", linen: "亜麻色", magenta: "赤紫", maroon: "えび茶", mediumaquamarine: "ミディアムアクアマリーン", mediumblue: "ミディアムブルー", mediumorchid: "ミディアムオーキッド", mediumpurple: "ミディアムパープル", mediumseagreen: "ミディアムシーグリーン", mediumslateblue: "ミディアムスレートブルー", mediumspringgreen: "ミディアムスプリンググリーン", mediumturquoise: "ミディアムターコイズ", mediumvioletred: "ミディアムバイオレットレッド", midnightblue: "ミッドナイトブルー", mintcream: "ミントクリーム", mistyrose: "ミスティローズ", moccasin: "モカシン", navajowhite: "ナバホホワイト", navy: "濃紺", oldlace: "オールドレイス", olive: "オリーブ", olivedrab: "濃黄緑", orange: "オレンジ", orangered: "オレンジレッド", orchid: "薄紫", palegoldenrod: "ペイルゴールデンロッド", palegreen: "ペイルグリーン", paleturquoise: "ペイルターコイズ", palevioletred: "ペイルバイオレットレッド", papayawhip: "パパイアホイップ", peachpuff: "ピーチパフ", peru: "ペルー", pink: "ピンク", plum: "深紫", powderblue: "淡青", purple: "紫", red: "赤", rosybrown: "ロージーブラウン", royalblue: "藤色", saddlebrown: "サドルブラウン", salmon: "サーモン", sandybrown: "砂褐色", seagreen: "シーグリーン", seashell: "シーシェル", sienna: "黄褐色", silver: "銀", skyblue: "スカイブルー", slateblue: "スレートブルー", slategray: "スレートグレイ", slategrey: "スレートグレイ", // same as slategray snow: "雪色", springgreen: "スプリンググリーン", steelblue: "鋼色", tan: "茶褐色", teal: "ティール", thistle: "シスル", tomato: "トマト色", transparent: "透明", turquoise: "ターコイズ", violet: "すみれ色", wheat: "小麦色", white: "白", whitesmoke: "ホワイトスモーク", yellow: "黄", yellowgreen: "黄緑" }) );
schoren/cdnjs
ajax/libs/dojo/1.9.0/nls/ja/colors.js.uncompressed.js
JavaScript
mit
5,660
define( "dojo/nls/fi/colors", ({ // local representation of all CSS3 named colors, companion to dojo.colors. To be used where descriptive information // is required for each color, such as a palette widget, and not for specifying color programatically. //Note: due to the SVG 1.0 spec additions, some of these are alternate spellings for the same color (e.g. gray / grey). //TODO: should we be using unique rgb values as keys instead and avoid these duplicates, or rely on the caller to do the reverse mapping? aliceblue: "vaaleanharmaansininen", antiquewhite: "antiikinvalkoinen", aqua: "sinivihreä", aquamarine: "vedenvihreä", azure: "taivaansininen", beige: "vaaleanruskea", bisque: "vaaleanruskea", black: "musta", blanchedalmond: "kuorittu manteli", blue: "sininen", blueviolet: "sinivioletti", brown: "ruskea", burlywood: "puunruskea", cadetblue: "meren vihreä", chartreuse: "kellanvihreä", chocolate: "suklaanruskea", coral: "koralli", cornflowerblue: "syvänsininen", cornsilk: "maissinkeltainen", crimson: "karmiininpunainen", cyan: "syaani", darkblue: "tummansininen", darkcyan: "tumma turkoosi", darkgoldenrod: "tumma kultapiisku", darkgray: "tummanharmaa", darkgreen: "tummanvihreä", darkgrey: "tummanharmaa", // same as darkgray darkkhaki: "tumma khaki", darkmagenta: "tumma magenta", darkolivegreen: "tummanoliivinvihreä", darkorange: "tummanoranssi", darkorchid: "tumma orkidea", darkred: "tummanpunainen", darksalmon: "tumma lohenpunainen", darkseagreen: "tumma merenvihreä", darkslateblue: "tumma siniharmaa", darkslategray: "tummanharmaa", darkslategrey: "tummanharmaa", // same as darkslategray darkturquoise: "tumma turkoosi", darkviolet: "tummanvioletti", deeppink: "syvä vaaleanpunainen", deepskyblue: "tumma taivaansininen", dimgray: "himmeänharmaa", dimgrey: "himmeänharmaa", // same as dimgray dodgerblue: "Dodger-sininen", firebrick: "poltetun tiilen punainen", floralwhite: "kukanvalkoinen", forestgreen: "metsänvihreä", fuchsia: "purppura", gainsboro: "gainsboro", ghostwhite: "lakananvalkoinen", gold: "kulta", goldenrod: "kullanruskea", gray: "harmaa", green: "vihreä", greenyellow: "vihreänkeltainen", grey: "harmaa", // same as gray honeydew: "hunajameloninvihreä", hotpink: "pinkki", indianred: "kirkkaanpunainen", indigo: "indigo", ivory: "norsunluu", khaki: "khaki", lavender: "laventeli", lavenderblush: "laventelinpunainen", lawngreen: "ruohonvihreä", lemonchiffon: "sitruunankeltainen", lightblue: "vaaleansininen", lightcoral: "vaalea koralli", lightcyan: "vaalea syaani", lightgoldenrodyellow: "vaalea kultapiiskunkeltainen", lightgray: "vaaleanharmaa", lightgreen: "vaaleanvihreä", lightgrey: "vaaleanharmaa", // same as lightgray lightpink: "vaaleanpunainen", lightsalmon: "vaalea lohenpunainen", lightseagreen: "vaalea merenvihreä", lightskyblue: "vaalea taivaansininen", lightslategray: "vaaleanharmaa", lightslategrey: "vaaleanharmaa", // same as lightslategray lightsteelblue: "vaalea teräksensininen", lightyellow: "vaaleankeltainen", lime: "vaaleanvihreä", limegreen: "limetinvihreä", linen: "pellavanvaalea", magenta: "magenta", maroon: "kastanjanruskea", mediumaquamarine: "keskivaalea vedenvihreä", mediumblue: "keskisininen", mediumorchid: "keskivaalea orkidea", mediumpurple: "keskivaalea violetti", mediumseagreen: "keskivaalea merenvihreä", mediumslateblue: "keskivaalea siniharmaa", mediumspringgreen: "keskivaalea keväänvihreä", mediumturquoise: "keskivaalea turkoosi", mediumvioletred: "keskivaalea lila", midnightblue: "yönsininen", mintcream: "minttukreemi", mistyrose: "utuinen ruusu", moccasin: "nahanruskea", navajowhite: "navajonvalkoinen", navy: "laivastonsininen", oldlace: "vanha pitsi", olive: "oliivinvihreä", olivedrab: "oliivinruskea", orange: "oranssi", orangered: "oranssinpunainen", orchid: "orkidea", palegoldenrod: "haalea kultapiisku", palegreen: "haalea vihreä", paleturquoise: "haalea turkoosi", palevioletred: "haalea lila", papayawhip: "papaijavaahto", peachpuff: "persikka", peru: "peru", pink: "vaaleanpunainen", plum: "luumunpunainen", powderblue: "harmaansininen", purple: "violetti", red: "punainen", rosybrown: "punertavanruskea", royalblue: "syvänsininen", saddlebrown: "satulanruskea", salmon: "lohenpunainen", sandybrown: "hiekanruskea", seagreen: "merenvihreä", seashell: "simpukankuori", sienna: "siena", silver: "hopea", skyblue: "taivaansininen", slateblue: "savensininen", slategray: "savenharmaa", slategrey: "savenharmaa", // same as slategray snow: "lumivalkoinen", springgreen: "keväänvihreä", steelblue: "teräksensininen", tan: "kellanruskea", teal: "sinivihreä", thistle: "ohdake", tomato: "tomaatinpunainen", transparent: "läpinäkyvä", turquoise: "turkoosi", violet: "violetti", wheat: "vehnänkeltainen", white: "valkoinen", whitesmoke: "savunvalkea", yellow: "keltainen", yellowgreen: "kellanvihreä" }) );
nareshs435/cdnjs
ajax/libs/dojo/1.10.3/nls/fi/colors.js.uncompressed.js
JavaScript
mit
5,001
<!-- @license Copyright (c) 2014 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Core Field</title> <script src="../webcomponentsjs/webcomponents.js"></script> <link rel="import" href="core-field.html"> <style> html { font-family: 'Helvetica Neue', 'Roboto', 'Arial', sans-serif; font-size: 14px; } core-field { border: 1px solid #ddd; margin: 10px; height: 40px; } div.icon { display: inline-block; width: 32px; height: 32px; background-repeat: no-repeat; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAmdJREFUeNrsV7FqFFEUPfe8FSFYJSSbLcQ+oE3EzsrCNqTITwg2/omFVb5ARWxsDHZWlhqCdoJFCGSnEFZWMu8ei70Lbye72R12IYV5cFmYmffuuWfOPXPXJOE6F3HN6wbADYBO84KZAQB6vd6+pL1VJDGz96enp+8AoNl1UxnY2tq6I2kfQF5FxFlciAEA5u5G0gAw53zJKEjCzAggxaUsyd390mEpJYvkFqG5AM7Pz4fdbrczYmySs0jekfQ15/wpkjwxswdmVjdBSLIAykg+FwACKYtNE5VL+nZ2dvaquPej2+0+M7P7JJtMlAy07gJrhpmlnPMRgBrARUSdcz4yszRtT6sumJK8SSkBDALAuFSamc/YcyUItql+LKKU0l4kHyvdST4NvVgbFlox4O4g6SR3t7e3X0j6AOCPmR0A2HX32t1bMTATgCSzsSs1lrtnM3sI4FGo3CXlGYksnmkPIDZPOORY0ZLKg1n0uJeO13iu1SuYsGeSDLH9cvfP7v6z3++fAMDGxsYOyXskH5O8OyLJfZFhZ64Gxskl/c05v6yq6qSoVAAQQL4D+Li+vr6TUnpO8nYYwkq6ILn7YVVVx0X/1424AFBXVXXs7ofhfst3AUmTxH6//yUS5bL6KY6XhsPh8draGuO1YVU+UFabmz4QvzWAejAY/F6ZD7i7SGpzc/NtyxnAwzeWAyAJ7u4kW83voybQ8gzE97z9rDeqHPM00LmCwjeSDlY0kr2eea9pFsWkcysALju4etGmWZLPY0CFqrEiALNadyYAFd97WxJA6ZpaVAM+bYBcEoQW0sB/98/o3wDaEFXSD7l9+QAAAABJRU5ErkJggg==); } </style> </head> <body theme="core-light-theme" unresolved> <core-field> <div class="icon"></div> <input placeholder="hi!" flex> </core-field> <core-field> <div class="icon"></div> <input placeholder="Search" flex> <icon></icon> </core-field> <core-field> <div class="icon"></div> <label>I'm a label!</label> <input placeholder="I have a label" flex> </core-field> <core-field> <input placeholder="I have no icon" flex> </core-field> </body> </html>
chaitanyambilgikar/polymer-sites
bower_components/core-field/demo.html
HTML
mit
6,172
import { Action } from './scheduler/Action'; import { Subscription } from './Subscription'; export interface IScheduler { now(): number; schedule<T>(work: (this: Action<T>, state?: T) => void, delay?: number, state?: T): Subscription; } /** * An execution context and a data structure to order tasks and schedule their * execution. Provides a notion of (potentially virtual) time, through the * `now()` getter method. * * Each unit of work in a Scheduler is called an {@link Action}. * * ```ts * class Scheduler { * now(): number; * schedule(work, delay?, state?): Subscription; * } * ``` * * @class Scheduler */ export class Scheduler implements IScheduler { public static now: () => number = Date.now ? Date.now : () => +new Date(); constructor(private SchedulerAction: typeof Action, now: () => number = Scheduler.now) { this.now = now; } /** * A getter method that returns a number representing the current time * (at the time this function was called) according to the scheduler's own * internal clock. * @return {number} A number that represents the current time. May or may not * have a relation to wall-clock time. May or may not refer to a time unit * (e.g. milliseconds). */ public now: () => number; /** * Schedules a function, `work`, for execution. May happen at some point in * the future, according to the `delay` parameter, if specified. May be passed * some context object, `state`, which will be passed to the `work` function. * * The given arguments will be processed an stored as an Action object in a * queue of actions. * * @param {function(state: ?T): ?Subscription} work A function representing a * task, or some unit of work to be executed by the Scheduler. * @param {number} [delay] Time to wait before executing the work, where the * time unit is implicit and defined by the Scheduler itself. * @param {T} [state] Some contextual data that the `work` function uses when * called by the Scheduler. * @return {Subscription} A subscription in order to be able to unsubscribe * the scheduled work. */ public schedule<T>(work: (this: Action<T>, state?: T) => void, delay: number = 0, state?: T): Subscription { return new this.SchedulerAction<T>(this, work).schedule(state, delay); } }
raymonddavis/Angular-SailsJs-SocketIo
web/node_modules/rxjs/src/Scheduler.ts
TypeScript
mit
2,343
Prism.languages.glsl=Prism.languages.extend("clike",{comment:[/\/\*[\w\W]*?\*\//,/\/\/(?:\\(?:\r\n|[\s\S])|.)*/],number:/\b(?:0x[\da-f]+|(?:\.\d+|\d+\.?\d*)(?:e[+-]?\d+)?)[ulf]*\b/i,keyword:/\b(?:attribute|const|uniform|varying|buffer|shared|coherent|volatile|restrict|readonly|writeonly|atomic_uint|layout|centroid|flat|smooth|noperspective|patch|sample|break|continue|do|for|while|switch|case|default|if|else|subroutine|in|out|inout|float|double|int|void|bool|true|false|invariant|precise|discard|return|d?mat[234](?:x[234])?|[ibdu]?vec[234]|uint|lowp|mediump|highp|precision|[iu]?sampler[123]D|[iu]?samplerCube|sampler[12]DShadow|samplerCubeShadow|[iu]?sampler[12]DArray|sampler[12]DArrayShadow|[iu]?sampler2DRect|sampler2DRectShadow|[iu]?samplerBuffer|[iu]?sampler2DMS(?:Array)?|[iu]?samplerCubeArray|samplerCubeArrayShadow|[iu]?image[123]D|[iu]?image2DRect|[iu]?imageCube|[iu]?imageBuffer|[iu]?image[12]DArray|[iu]?imageCubeArray|[iu]?image2DMS(?:Array)?|struct|common|partition|active|asm|class|union|enum|typedef|template|this|resource|goto|inline|noinline|public|static|extern|external|interface|long|short|half|fixed|unsigned|superp|input|output|hvec[234]|fvec[234]|sampler3DRect|filter|sizeof|cast|namespace|using)\b/}),Prism.languages.insertBefore("glsl","comment",{preprocessor:{pattern:/(^[ \t]*)#(?:(?:define|undef|if|ifdef|ifndef|else|elif|endif|error|pragma|extension|version|line)\b)?/m,lookbehind:!0,alias:"builtin"}});
ahocevar/cdnjs
ajax/libs/prism/1.1.0/components/prism-glsl.min.js
JavaScript
mit
1,437
tinyMCE.addI18n('ar.searchreplace_dlg',{findwhat:"\u0627\u0628\u062d\u062b \u0639\u0646",replacewith:"\u0627\u0633\u062a\u0628\u062f\u0644 \u0628\u0640",direction:"\u0627\u0644\u0627\u062a\u062c\u0627\u0647",up:"\u0644\u0623\u0639\u0644\u0649",down:"\u0644\u0623\u0633\u0641\u0644",mcase:"\u062d\u0627\u0644\u0647 \u0627\u0644\u062a\u0637\u0627\u0628\u0642",findnext:"\u0627\u0628\u062d\u062b \u0639\u0646 \u0627\u0644\u062a\u0627\u0644\u0649",allreplaced:"\u062a\u0645\u062a \u0639\u0645\u0644\u064a\u0647 \u0627\u0644\u0627\u0633\u062a\u0628\u062f\u0627\u0644","searchnext_desc":"\u0628\u062d\u062b \u0645\u0631\u0647 \u0627\u062e\u0631\u0649",notfound:"\u0644\u0642\u062f \u0627\u0646\u062a\u0647\u0649 \u0627\u0644\u0628\u062d\u062b \u0648\u0644\u0645 \u0646\u0639\u062b\u0631 \u0639\u0644\u0649 \u0627\u0649 \u0646\u062a\u064a\u062c\u0647","search_title":"\u0628\u062d\u062b","replace_title":"\u0628\u062d\u062b/\u0627\u0633\u062a\u0628\u062f\u0627\u0644",replaceall:"\u0627\u0633\u062a\u0628\u062f\u0627\u0644 \u0627\u0644\u0643\u0644",replace:"\u0627\u0633\u062a\u0628\u062f\u0627\u0644"});
mkoryak/cdnjs
ajax/libs/tinymce/3.5.8/plugins/searchreplace/langs/ar_dlg.js
JavaScript
mit
1,097
var global = require('./$.global') , core = require('./$.core') , hide = require('./$.hide') , redefine = require('./$.redefine') , ctx = require('./$.ctx') , PROTOTYPE = 'prototype'; var $export = function(type, name, source){ var IS_FORCED = type & $export.F , IS_GLOBAL = type & $export.G , IS_STATIC = type & $export.S , IS_PROTO = type & $export.P , IS_BIND = type & $export.B , target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE] , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}) , key, own, out, exp; if(IS_GLOBAL)source = name; for(key in source){ // contains in native own = !IS_FORCED && target && key in target; // export native or passed out = (own ? target : source)[key]; // bind timers to global for call from export context exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // extend global if(target && !own)redefine(target, key, out); // export if(exports[key] != out)hide(exports, key, exp); if(IS_PROTO && expProto[key] != out)expProto[key] = out; } }; global.core = core; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap module.exports = $export;
chriswongtv/node-all-paths
node_modules/core-js/modules/$.export.js
JavaScript
mit
1,504
// CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod(require("../../lib/codemirror")); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; CodeMirror.runMode = function(string, modespec, callback, options) { var mode = CodeMirror.getMode(CodeMirror.defaults, modespec); var ie = /MSIE \d/.test(navigator.userAgent); var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9); if (callback.nodeType == 1) { var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize; var node = callback, col = 0; node.innerHTML = ""; callback = function(text, style) { if (text == "\n") { // Emitting LF or CRLF on IE8 or earlier results in an incorrect display. // Emitting a carriage return makes everything ok. node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text)); col = 0; return; } var content = ""; // replace tabs for (var pos = 0;;) { var idx = text.indexOf("\t", pos); if (idx == -1) { content += text.slice(pos); col += text.length - pos; break; } else { col += idx - pos; content += text.slice(pos, idx); var size = tabSize - col % tabSize; col += size; for (var i = 0; i < size; ++i) content += " "; pos = idx + 1; } } if (style) { var sp = node.appendChild(document.createElement("span")); sp.className = "cm-" + style.replace(/ +/g, " cm-"); sp.appendChild(document.createTextNode(content)); } else { node.appendChild(document.createTextNode(content)); } }; } var lines = CodeMirror.splitLines(string), state = (options && options.state) || CodeMirror.startState(mode); for (var i = 0, e = lines.length; i < e; ++i) { if (i) callback("\n"); var stream = new CodeMirror.StringStream(lines[i]); if (!stream.string && mode.blankLine) mode.blankLine(state); while (!stream.eol()) { var style = mode.token(stream, state); callback(stream.current(), style, i, stream.start, state); stream.start = stream.pos; } } }; });
gasolin/cdnjs
ajax/libs/codemirror/4.2.0/addon/runmode/runmode.js
JavaScript
mit
2,501
define( "dojo/nls/ca/colors", ({ // local representation of all CSS3 named colors, companion to dojo.colors. To be used where descriptive information // is required for each color, such as a palette widget, and not for specifying color programatically. //Note: due to the SVG 1.0 spec additions, some of these are alternate spellings for the same color (e.g. gray / grey). //TODO: should we be using unique rgb values as keys instead and avoid these duplicates, or rely on the caller to do the reverse mapping? aliceblue: "blau cian clar", antiquewhite: "blanc antic", aqua: "aigua", aquamarine: "aiguamarina", azure: "atzur", beige: "beix", bisque: "crema", black: "negre", blanchedalmond: "ametlla pàl·lid", blue: "blau", blueviolet: "blau violeta", brown: "marró", burlywood: "marró arenós", cadetblue: "blau marí", chartreuse: "Llimona pàl·lid", chocolate: "xocolata", coral: "corall", cornflowerblue: "blau blauet", cornsilk: "cru", crimson: "carmesí", cyan: "cian", darkblue: "blau fosc", darkcyan: "cian fosc", darkgoldenrod: "ocre fosc", darkgray: "gris fosc", darkgreen: "verd fosc", darkgrey: "gris fosc", // same as darkgray darkkhaki: "caqui fosc", darkmagenta: "magenta fosc", darkolivegreen: "verd oliva fosc", darkorange: "taronja fosc", darkorchid: "orquídia fosc", darkred: "vermell fosc", darksalmon: "salmó fosc", darkseagreen: "verd marí fosc", darkslateblue: "blau pissarra fosc", darkslategray: "gris pissarra fosc", darkslategrey: "gris pissarra fosc", // same as darkslategray darkturquoise: "turquesa fosc", darkviolet: "violeta fosc", deeppink: "rosa profund", deepskyblue: "blau cel profund", dimgray: "gris fosc", dimgrey: "gris fosc", // same as dimgray dodgerblue: "blau Dodger", firebrick: "maó refractari", floralwhite: "blanc floral", forestgreen: "verd bosc", fuchsia: "fúcsia", gainsboro: "gainsboro", ghostwhite: "blanc fantasma", gold: "daurat", goldenrod: "ocre", gray: "gris", green: "verd", greenyellow: "verd grogós", grey: "gris", // same as gray honeydew: "rosada de mel", hotpink: "rosa fúcsia", indianred: "vermell indi", indigo: "índigo", ivory: "marbre", khaki: "caqui", lavender: "lavanda", lavenderblush: "lavanda vermellosa", lawngreen: "verd gespa", lemonchiffon: "groc brisa", lightblue: "blau clar", lightcoral: "corall clar", lightcyan: "cian clar", lightgoldenrodyellow: "groc ocre clar", lightgray: "gris clar", lightgreen: "verd clar", lightgrey: "gris clar", // same as lightgray lightpink: "rosa clar", lightsalmon: "salmó clar", lightseagreen: "verd marí clar", lightskyblue: "blau cel clar", lightslategray: "gris pissarra clar", lightslategrey: "gris pissarra clar", // same as lightslategray lightsteelblue: "blau acer clar", lightyellow: "groc clar", lime: "verd llimona", limegreen: "verd llimona verda", linen: "lli", magenta: "magenta", maroon: "marró vermellós", mediumaquamarine: "aiguamarina mitjana", mediumblue: "blau mitjà", mediumorchid: "orquídia mitjana", mediumpurple: "porpra mitjana", mediumseagreen: "verd marí mitjà", mediumslateblue: "blau pissarra mitjà", mediumspringgreen: "verd primavera mitjà", mediumturquoise: "turquesa mitjana", mediumvioletred: "vermell violeta mitjà", midnightblue: "blau mitjanit", mintcream: "menta pàl·lid", mistyrose: "rosa dens", moccasin: "mocassí", navajowhite: "blanc Navajo", navy: "blau marí", oldlace: "rosa cremós", olive: "oliva", olivedrab: "gris oliva", orange: "taronja", orangered: "taronja vermellós", orchid: "orquídia", palegoldenrod: "ocre pàl·lid", palegreen: "verd pàl·lid", paleturquoise: "turquesa pàl·lid", palevioletred: "vermell porpra pàl·lid", papayawhip: "préssec pastel", peachpuff: "préssec", peru: "Perú", pink: "rosa", plum: "pruna", powderblue: "blau grisós", purple: "porpra", red: "vermell", rosybrown: "marró rosat", royalblue: "blau marí intens", saddlebrown: "marró mitjà", salmon: "salmó", sandybrown: "marró arenós", seagreen: "verd marí", seashell: "petxina marina", sienna: "siena", silver: "argent", skyblue: "blau cel", slateblue: "blau pissarra", slategray: "gris pissarra", slategrey: "gris pissarra", // same as slategray snow: "neu", springgreen: "verd de primavera", steelblue: "blau acer", tan: "tan", teal: "verd blavós", thistle: "card", tomato: "tomàquet", transparent: "transparent", turquoise: "turquesa", violet: "violeta", wheat: "blat", white: "blanc", whitesmoke: "blanc fumat", yellow: "groc", yellowgreen: "verd grogós" }) );
pcarrier/cdnjs
ajax/libs/dojo/1.8.9/nls/ca/colors.js.uncompressed.js
JavaScript
mit
4,608