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
/* * /MathJax/jax/output/HTML-CSS/fonts/STIX/General/Regular/GreekSSBold.js * * Copyright (c) 2012 Design Science, Inc. * * Part of the MathJax library. * See http://www.mathjax.org for details. * * Licensed under the Apache License, Version 2.0; * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 */ MathJax.Hub.Insert(MathJax.OutputJax["HTML-CSS"].FONTDATA.FONTS.STIXGeneral,{120662:[690,0,690,25,665],120663:[676,0,636,80,594],120664:[676,0,591,80,569],120665:[690,0,720,40,680],120666:[676,0,635,80,597],120667:[676,0,653,25,623],120668:[676,0,715,80,635],120669:[691,19,778,35,743],120670:[676,0,440,65,375],120671:[676,0,712,80,707],120672:[690,0,706,40,666],120673:[676,0,913,80,833],120674:[676,18,724,80,644],120675:[676,0,640,35,605],120676:[692,18,778,35,743],120677:[676,0,715,80,635],120678:[676,0,581,80,569],120679:[691,19,778,35,743],120680:[676,0,674,28,632],120681:[676,0,641,14,627],120682:[691,0,748,20,728],120683:[676,0,800,25,775],120684:[676,0,740,40,700],120685:[691,0,806,15,791],120686:[691,0,752,32,720],120687:[664,30,735,45,685],120688:[473,14,662,40,629],120689:[692,205,512,39,487],120690:[473,205,502,10,477],120691:[692,14,502,25,477],120692:[473,14,451,25,434],120693:[692,205,500,28,488],120694:[473,205,510,35,474],120695:[692,14,500,23,477],120696:[461,14,319,53,296],120697:[473,0,527,55,512],120698:[692,14,554,18,520],120699:[461,205,550,39,517],120700:[473,14,492,55,472],120701:[692,205,501,28,489],120702:[473,14,501,25,476],120703:[461,14,594,10,572],120704:[473,205,511,38,486],120705:[473,205,498,26,486],120706:[461,14,520,25,552],120707:[461,14,479,6,472],120708:[473,14,514,35,489],120709:[473,205,634,25,609],120710:[473,205,573,9,553],120711:[473,205,680,25,699],120712:[461,14,740,42,689],120713:[691,14,501,25,476],120714:[473,14,462,25,440],120715:[692,14,536,35,522],120716:[473,14,570,14,554],120717:[692,205,634,25,609],120718:[473,205,494,25,469],120719:[461,14,848,6,839]});MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir+"/General/Regular/GreekSSBold.js");
nagyist/OpenF2-cdnjs
ajax/libs/mathjax/2.1.0/jax/output/HTML-CSS/fonts/STIX/General/Regular/GreekSSBold.js
JavaScript
mit
2,125
/* * /MathJax/jax/output/HTML-CSS/fonts/STIX/General/Regular/BBBold.js * * Copyright (c) 2012 Design Science, Inc. * * Part of the MathJax library. * See http://www.mathjax.org for details. * * Licensed under the Apache License, Version 2.0; * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 */ MathJax.Hub.Insert(MathJax.OutputJax["HTML-CSS"].FONTDATA.FONTS.STIXGeneral,{120120:[662,0,741,50,691],120121:[662,0,676,70,626],120123:[662,0,722,70,677],120124:[662,0,622,70,567],120125:[662,0,469,70,567],120126:[676,13,706,45,664],120128:[662,0,322,78,244],120129:[662,14,560,40,495],120130:[674,0,735,70,729],120131:[662,0,591,70,571],120132:[662,0,855,70,785],120134:[676,14,760,45,715],120138:[676,14,636,35,597],120139:[662,0,527,20,622],120140:[662,14,698,65,633],120141:[662,0,568,12,653],120142:[662,0,920,12,949],120143:[662,0,768,35,733],120144:[662,0,563,12,685],120146:[460,10,561,45,506],120147:[683,10,565,50,524],120148:[460,10,520,45,475],120149:[683,10,574,45,519],120150:[460,10,523,45,478],120151:[683,0,368,25,431],120152:[460,218,574,45,519],120153:[683,0,544,55,489],120154:[683,0,258,55,203],120155:[683,217,305,-15,250],120156:[683,0,551,50,539],120157:[683,0,258,55,203],120158:[460,0,830,55,775],120159:[460,0,544,55,489],120160:[458,12,553,45,508],120161:[460,218,574,55,529],120162:[460,218,574,45,519],120163:[463,0,301,55,407],120164:[460,10,519,36,483],120165:[633,10,329,20,297],120166:[450,10,544,55,489],120167:[450,0,443,20,479],120168:[450,0,676,20,695],120169:[450,0,560,30,530],120170:[450,218,468,20,510],120171:[450,0,519,43,476],120792:[676,14,540,28,512],120793:[693,0,540,91,355],120794:[676,0,547,48,514],120795:[676,14,540,49,478],120796:[676,0,540,20,524],120797:[662,14,540,35,489],120798:[676,14,540,28,512],120799:[662,0,540,24,511],120800:[676,14,540,28,512],120801:[676,12,540,28,512]});MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir+"/General/Regular/BBBold.js");
melvinsembrano/cdnjs
ajax/libs/mathjax/2.1/jax/output/HTML-CSS/fonts/STIX/General/Regular/BBBold.js
JavaScript
mit
2,022
/* * /MathJax/jax/output/HTML-CSS/fonts/STIX/General/BoldItalic/BasicLatin.js * * Copyright (c) 2012 Design Science, Inc. * * Part of the MathJax library. * See http://www.mathjax.org for details. * * Licensed under the Apache License, Version 2.0; * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 */ MathJax.Hub.Insert(MathJax.OutputJax["HTML-CSS"].FONTDATA.FONTS["STIXGeneral-bold-italic"],{32:[0,0,250,0,0],33:[684,13,389,67,370],34:[685,-398,555,136,536],35:[700,0,500,-32,532],36:[733,100,500,-20,497],37:[706,29,757,80,707],38:[682,19,849,76,771],39:[685,-398,278,128,268],40:[685,179,333,28,344],41:[685,179,333,-44,271],42:[685,-252,500,101,492],43:[506,0,570,33,537],44:[134,182,250,-60,144],45:[282,-166,333,2,271],46:[135,13,250,-9,139],47:[685,18,278,-64,342],48:[683,14,500,17,477],49:[683,0,500,5,419],50:[683,0,500,-27,446],51:[683,13,500,-14,450],52:[683,0,500,-15,503],53:[669,13,500,-11,486],54:[679,15,500,23,509],55:[669,0,500,52,525],56:[683,13,500,3,476],57:[683,10,500,-12,475],58:[459,13,333,23,264],59:[459,183,333,-25,264],60:[518,12,570,31,539],61:[399,-107,570,33,537],62:[518,12,570,31,539],63:[684,13,500,79,470],64:[685,18,939,118,825],65:[683,0,667,-68,593],66:[669,0,667,-25,624],67:[685,18,667,32,677],68:[669,0,722,-46,685],69:[669,0,667,-27,653],70:[669,0,667,-13,660],71:[685,18,722,21,705],72:[669,0,778,-24,799],73:[669,0,389,-32,406],74:[669,99,500,-46,524],75:[669,0,667,-21,702],76:[669,0,611,-22,590],77:[669,12,889,-29,917],78:[669,15,722,-27,748],79:[685,18,722,27,691],80:[669,0,611,-28,613],81:[685,208,722,27,691],82:[669,0,667,-28,623],83:[685,18,556,2,526],84:[669,0,611,49,650],85:[669,18,722,67,744],86:[669,18,667,66,715],87:[669,18,889,64,940],88:[669,0,667,-24,694],89:[669,0,611,71,659],90:[669,0,611,-12,589],91:[674,159,333,-37,362],92:[685,18,278,-1,279],93:[674,157,333,-56,343],94:[669,-304,570,67,503],95:[-75,125,500,0,500],96:[697,-516,333,85,297],97:[462,14,500,-21,456],98:[699,13,500,-14,444],99:[462,13,444,-5,392],100:[699,13,500,-21,517],101:[462,13,444,5,398],102:[698,205,333,-169,446],103:[462,203,500,-52,477],104:[699,9,556,-13,498],105:[684,9,278,2,262],106:[685,207,278,-189,279],107:[699,8,500,-23,483],108:[699,9,278,2,290],109:[462,9,778,-14,723],110:[462,9,556,-6,494],111:[462,13,500,-3,441],112:[462,205,500,-120,446],113:[462,205,500,1,471],114:[462,0,389,-21,389],115:[462,13,389,-19,333],116:[594,9,278,-11,281],117:[462,9,556,15,493],118:[462,13,444,15,401],119:[462,13,667,15,614],120:[462,13,500,-45,469],121:[462,205,444,-94,392],122:[449,78,389,-43,368],123:[686,187,348,4,436],124:[685,18,220,66,154],125:[686,187,348,-129,303],126:[331,-175,570,54,516]});MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir+"/General/BoldItalic/BasicLatin.js");
linjunpop/cdnjs
ajax/libs/mathjax/2.1/jax/output/HTML-CSS/fonts/STIX/General/BoldItalic/BasicLatin.js
JavaScript
mit
2,843
/* * /MathJax/jax/output/HTML-CSS/fonts/STIX/General/Italic/GeneralPunctuation.js * * Copyright (c) 2012 Design Science, Inc. * * Part of the MathJax library. * See http://www.mathjax.org for details. * * Licensed under the Apache License, Version 2.0; * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 */ MathJax.Hub.Insert(MathJax.OutputJax["HTML-CSS"].FONTDATA.FONTS["STIXGeneral-italic"],{8208:[257,-191,333,49,282],8209:[257,-191,333,49,282],8210:[258,-192,500,-8,508],8211:[243,-197,500,-6,505],8212:[243,-197,889,-6,894],8216:[666,-436,333,171,310],8217:[666,-436,333,151,290],8218:[101,129,333,44,183],8219:[666,-436,333,169,290],8220:[666,-436,556,166,514],8221:[666,-436,556,151,499],8222:[101,129,556,57,405],8223:[666,-436,556,169,499],8224:[666,159,500,101,488],8225:[666,143,500,22,491],8226:[444,-59,523,70,455],8230:[100,11,889,57,762],8240:[706,19,1117,80,1067],8241:[706,19,1479,80,1429],8249:[403,-37,333,51,281],8250:[403,-37,333,52,282],8254:[820,-770,500,0,500],8260:[676,10,167,-169,337]});MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir+"/General/Italic/GeneralPunctuation.js");
ColinEberhardt/cdnjs
ajax/libs/mathjax/2.0/jax/output/HTML-CSS/fonts/STIX/General/Italic/GeneralPunctuation.js
JavaScript
mit
1,211
body{text-align:center;margin-left:auto;margin-right:auto;}.yui3-d0,.yui3-d1,.yui3-d1f,.yui3-d2,.yui3-d2f,.yui3-d3,.yui3-d3f{margin:auto;text-align:left;width:57.69em;*width:56.25em;}.yui3-t1,.yui3-t2,.yui3-t3,.yui3-t4,.yui3-t5,.yui3-t6{margin:auto;text-align:left;width:100%;}.yui3-d0{margin:auto 10px;width:auto;}.yui3-d0f{width:100%;}.yui3-d2{width:73.076em;*width:71.25em;}.yui3-d2f{width:950px;}.yui3-d3{width:74.923em;*width:73.05em;}.yui3-d3f{width:974px;}.yui3-b{position:relative;}.yui3-b{_position:static;}.yui3-main .yui3-b{position:static;}.yui3-main{width:100%;}.yui3-t1 .yui3-main,.yui3-t2 .yui3-main,.yui3-t3 .yui3-main{float:right;margin-left:-25em;}.yui3-t4 .yui3-main,.yui3-t5 .yui3-main,.yui3-t6 .yui3-main{float:left;margin-right:-25em;}.yui3-t1 .yui3-b{float:left;width:12.30769em;*width:12.00em;}.yui3-t1 .yui3-main .yui3-b{margin-left:13.30769em;*margin-left:12.975em;}.yui3-t2 .yui3-b{float:left;width:13.84615em;*width:13.50em;}.yui3-t2 .yui3-main .yui3-b{margin-left:14.84615em;*margin-left:14.475em;}.yui3-t3 .yui3-b{float:left;width:23.0769em;*width:22.50em;}.yui3-t3 .yui3-main .yui3-b{margin-left:24.0769em;*margin-left:23.475em;}.yui3-t4 .yui3-b{float:right;width:13.8456em;*width:13.50em;}.yui3-t4 .yui3-main .yui3-b{margin-right:14.8456em;*margin-right:14.475em;}.yui3-t5 .yui3-b{float:right;width:18.4615em;*width:18.00em;}.yui3-t5 .yui3-main .yui3-b{margin-right:19.4615em;*margin-right:18.975em;}.yui3-t6 .yui3-b{float:right;width:23.0769em;*width:22.50em;}.yui3-t6 .yui3-main .yui3-b{margin-right:24.0769em;*margin-right:23.475em;}.yui3-main .yui3-b{float:none;width:auto;}.yui3-gb .yui3-u,.yui3-g .yui3-gb .yui3-u,.yui3-gb .yui3-g,.yui3-gb .yui3-gb,.yui3-gb .yui3-gc,.yui3-gb .yui3-gd,.yui3-gb .yui3-ge,.yui3-gb .yui3-gf,.yui3-gc .yui3-u,.yui3-gc .yui3-g,.yui3-gd .yui3-u{float:left;}.yui3-g .yui3-u,.yui3-g .yui3-g,.yui3-g .yui3-gb,.yui3-g .yui3-gc,.yui3-g .yui3-gd,.yui3-g .yui3-ge,.yui3-g .yui3-gf,.yui3-gc .yui3-u,.yui3-gd .yui3-g,.yui3-g .yui3-gc .yui3-u,.yui3-ge .yui3-u,.yui3-ge .yui3-g,.yui3-gf .yui3-g,.yui3-gf .yui3-u{float:right;}.yui3-g div.first,.yui3-gb div.first,.yui3-gc div.first,.yui3-gd div.first,.yui3-ge div.first,.yui3-gf div.first,.yui3-g .yui3-gc div.first,.yui3-g .yui3-ge div.first,.yui3-gc div.first div.first{float:left;}.yui3-g .yui3-u,.yui3-g .yui3-g,.yui3-g .yui3-gb,.yui3-g .yui3-gc,.yui3-g .yui3-gd,.yui3-g .yui3-ge,.yui3-g .yui3-gf{width:49.1%;}.yui3-gb .yui3-u,.yui3-g .yui3-gb .yui3-u,.yui3-gb .yui3-g,.yui3-gb .yui3-gb,.yui3-gb .yui3-gc,.yui3-gb .yui3-gd,.yui3-gb .yui3-ge,.yui3-gb .yui3-gf,.yui3-gc .yui3-u,.yui3-gc .yui3-g,.yui3-gd .yui3-u{width:32%;margin-left:2.0%;}.yui3-gb .yui3-u{*width:31.8%;*margin-left:1.9%;}.yui3-gc div.first,.yui3-gd .yui3-u{width:66%;_width:65.7%;}.yui3-gd div.first{width:32%;_width:31.5%;}.yui3-ge div.first,.yui3-gf .yui3-u{width:74.2%;_width:74%;}.yui3-ge .yui3-u,.yui3-gf div.first{width:24%;_width:23.8%;}.yui3-g .yui3-gb div.first,.yui3-gb div.first,.yui3-gc div.first,.yui3-gd div.first{margin-left:0;}.yui3-g .yui3-g .yui3-u,.yui3-gb .yui3-g .yui3-u,.yui3-gc .yui3-g .yui3-u,.yui3-gd .yui3-g .yui3-u,.yui3-ge .yui3-g .yui3-u,.yui3-gf .yui3-g .yui3-u{width:49%;*width:48.1%;*margin-left:0;}.yui3-g .yui3-gb div.first,.yui3-gb .yui3-gb div.first{*margin-right:0;*width:32%;_width:31.7%;}.yui3-g .yui3-gc div.first,.yui3-gd .yui3-g{width:66%;}.yui3-gb .yui3-g div.first{*margin-right:4%;_margin-right:1.3%;}.yui3-gb .yui3-gc div.first,.yui3-gb .yui3-gd div.first{*margin-right:0;}.yui3-gb .yui3-gb .yui3-u,.yui3-gb .yui3-gc .yui3-u{*margin-left:1.8%;_margin-left:4%;}.yui3-g .yui3-gb .yui3-u{_margin-left:1.0%;}.yui3-gb .yui3-gd .yui3-u{*width:66%;_width:61.2%;}.yui3-gb .yui3-gd div.first{*width:31%;_width:29.5%;}.yui3-g .yui3-gc .yui3-u,.yui3-gb .yui3-gc .yui3-u{width:32%;_float:right;margin-right:0;_margin-left:0;}.yui3-gb .yui3-gc div.first{width:66%;*float:left;*margin-left:0;}.yui3-gb .yui3-ge .yui3-u,.yui3-gb .yui3-gf .yui3-u{margin:0;}.yui3-gb .yui3-gb .yui3-u{_margin-left:.7%;}.yui3-gb .yui3-g div.first,.yui3-gb .yui3-gb div.first{*margin-left:0;}.yui3-gc .yui3-g .yui3-u,.yui3-gd .yui3-g .yui3-u{*width:48.1%;*margin-left:0;}.yui3-gb .yui3-gd div.first{width:32%;}.yui3-g .yui3-gd div.first{_width:29.9%;}.yui3-ge .yui3-g{width:24%;}.yui3-gf .yui3-g{width:74.2%;}.yui3-gb .yui3-ge div.yui3-u,.yui3-gb .yui3-gf div.yui3-u{float:right;}.yui3-gb .yui3-ge div.first,.yui3-gb .yui3-gf div.first{float:left;}.yui3-gb .yui3-ge .yui3-u,.yui3-gb .yui3-gf div.first{*width:24%;_width:20%;}.yui3-gb .yui3-ge div.first,.yui3-gb .yui3-gf .yui3-u{*width:73.5%;_width:65.5%;}.yui3-ge div.first .yui3-gd .yui3-u{width:65%;}.yui3-ge div.first .yui3-gd div.first{width:32%;}#bd:after,.yui3-g:after,.yui3-gb:after,.yui3-gc:after,.yui3-gd:after,.yui3-ge:after,.yui3-gf:after,.yui3-t1:after,.yui3-t2:after,.yui3-t3:after,.yui3-t4:after,.yui3-t5:after,.yui3-t6:after{content:".";display:block;height:0;clear:both;visibility:hidden;}#bd,.yui3-g,.yui3-gb,.yui3-gc,.yui3-gd,.yui3-ge,.yui3-gf,.yui3-t1,.yui3-t2,.yui3-t3,.yui3-t4,.yui3-t5,.yui3-t6{zoom:1;}
DeuxHuitHuit/cdnjs
ajax/libs/yui/3.1.2/cssgrids/grids-min.css
CSS
mit
5,058
webshims.register('jmebase', function($, webshims, window, doc, undefined){ "use strict"; var props = {}; var fns = {}; var slice = Array.prototype.slice; var readyLength = 0; var options = $.extend({selector: '.mediaplayer'}, webshims.cfg.mediaelement.jme); var baseSelector = options.selector; webshims.cfg.mediaelement.jme = options; if(!$.jme){ $.jme = {}; } $.extend($.jme, { pluginsClasses: [], pluginsSel: '', plugins: {}, props: props, fns: fns, data: function(elem, name, value){ var data = $(elem).data('jme') || $.data(elem, 'jme', {}); if(value === undefined){ return (name) ? data[name] : data; } else { data[name] = value; } }, runPlugin: function(sel){ if(readyLength){ $(document.querySelectorAll(baseSelector)).each(function(){ var controls = this.querySelectorAll(sel); if(controls.length){ $(this).jmeFn('addControls', controls); } }); } }, registerPlugin: function(name, plugin){ this.plugins[name] = plugin; if(!plugin.nodeName){ plugin.nodeName = ''; } if(!plugin.className){ plugin.className = name; } this.pluginsClasses.push('.'+plugin.className); this.pluginsSel = this.pluginsClasses.join(', '); options[name] = $.extend(plugin.options || {}, options[name]); if(options[name] && options[name].text){ plugin.text = options[name].text; } else if(options.i18n && options.i18n[name]){ plugin.text = options.i18n[name]; } this.runPlugin('.'+plugin.className); }, configmenuPlugins: {}, addToConfigmenu: function(name, create){ this.configmenuPlugins[name] = create; }, defineMethod: function(name, fn){ fns[name] = fn; }, defineProp: function(name, desc){ if(!desc){ desc = {}; } if(!desc.set){ if(desc.readonly){ desc.set = function(){ throw(name +' is readonly'); }; } else { desc.set = $.noop; } } if(!desc.get){ desc.get = function(elem){ return $.jme.data(elem, name); }; } props[name] = desc; }, prop: function(elem, name, value){ if(!props[name]){ return $.prop(elem, name, value); } if(value === undefined){ return props[name].get( elem ); } else { var setValue = props[name].set(elem, value); if(setValue === undefined){ setValue = value; } if(setValue != 'noDataSet'){ $.jme.data(elem, name, setValue); } } } }); $.fn.jmeProp = function(name, value){ return $.access( this, $.jme.prop, name, value, arguments.length > 1 ); }; $.fn.jmeFn = function(fn){ var args = slice.call( arguments, 1 ); var ret; this.each(function(){ if(!$.jme.data(this).media){ $(this).closest(baseSelector).jmePlayer(); webshims.warn('jmeFn called to early or on wrong element!'); } ret = (fns[fn] || $.prop(this, fn)).apply(this, args); if(ret !== undefined){ return false; } }); return (ret !== undefined) ? ret : this; }; var idlStates = { emptied: 1, pause: 1 }; var unwaitingEvents = { canplay: 1, canplaythrough: 1 }; $.jme.initJME = function(context, insertedElement){ readyLength += $(context.querySelectorAll(baseSelector)).add(insertedElement.filter(baseSelector)).jmePlayer().length; }; $.jme.getDOMList = function(attr){ var list = []; if(!attr){ attr = []; } if(typeof attr == 'string'){ attr = attr.split(' '); } $.each(attr, function(i, id){ if(id){ id = document.getElementById(id); if(id){ list.push(id); } } }); return list; }; $.jme.getButtonText = function(button, classes){ var isCheckbox; var lastState; var txtChangeFn = function(state){ if(lastState === state){return;} lastState = state; button .removeClass(classes[(state) ? 0 : 1]) .addClass(classes[state]) ; if(isCheckbox){ button.prop('checked', !!state); (button.data('checkboxradio') || {refresh: $.noop}).refresh(); } }; if (button.is('[type="checkbox"], [type="radio"]')){ button.prop('checked', function(){ return this.defaultChecked; }); isCheckbox = true; } else if(button.is('a')){ button.on('click', function(e){ e.preventDefault(); }); } return txtChangeFn; }; $.fn.jmePlayer = function(opts){ return this.each(function(){ var mediaUpdateFn, canPlay, removeCanPlay, canplayTimer, lastState, stopEmptiedEvent, forceRender; var media = $('audio, video', this).eq(0); var base = $(this); var jmeData = $.jme.data(this); var mediaData = $.jme.data(media[0]); base.addClass(media.prop('nodeName').toLowerCase()+'player'); mediaData.player = base; mediaData.media = media; if(!jmeData.media){ forceRender = function(){ base[0].className = base[0].className; }; removeCanPlay = function(){ media.off('canplay', canPlay); clearTimeout(canplayTimer); }; canPlay = function(){ var state = (media.prop('paused')) ? 'idle' : 'playing'; base.attr('data-state', state); }; mediaUpdateFn = function(e){ var state = e.type; var readyState; var paused; removeCanPlay(); if(unwaitingEvents[state] && lastState != 'waiting'){ return; } if(stopEmptiedEvent && state == 'emptied'){ return; } if(state == 'ended' || $.prop(this, 'ended')){ state = 'ended'; } else if(state == 'waiting'){ if($.prop(this, 'readyState') > 2){ state = ''; } else { canplayTimer = setTimeout(function(){ if(media.prop('readyState') > 2){ canPlay(); } }, 9); media.on('canPlay', canPlay); } } else if(idlStates[state]){ state = 'idle'; } else { readyState = $.prop(this, 'readyState'); paused = $.prop(this, 'paused'); if(!paused && readyState < 3){ state = 'waiting'; } else if(!paused && readyState > 2){ state = 'playing'; } else { state = 'idle'; } } if(state == 'idle' && base._seekpause){ state = false; } if(state){ lastState = state; base.attr('data-state', state); setTimeout(forceRender); } }; jmeData.media = media; jmeData.player = base; media .on('emptied waiting canplay canplaythrough playing ended pause mediaerror', mediaUpdateFn) .on('volumechange updateJMEState', function(){ var volume = $.prop(this, 'volume'); base[!volume || $.prop(this, 'muted') ? 'addClass' : 'removeClass']('state-muted'); if(volume < 0.01){ volume = 'no'; } else if(volume < 0.36){ volume = 'low'; } else if(volume < 0.7){ volume = 'medium'; } else { volume = 'high'; } base.attr('data-volume', volume); }) ; if($.jme.pluginsSel){ base.jmeFn('addControls', $(base[0].querySelectorAll($.jme.pluginsSel))); } if(mediaUpdateFn){ media.on('updateJMEState', mediaUpdateFn).triggerHandler('updateJMEState'); } } }); }; $.jme.defineProp('isPlaying', { get: function(elem){ return (!$.prop(elem, 'ended') && !$.prop(elem, 'paused') && $.prop(elem, 'readyState') > 1 && !$.data(elem, 'mediaerror')); }, readonly: true }); $.jme.defineProp('player', { readonly: true }); $.jme.defineProp('media', { readonly: true }); $.jme.defineProp('srces', { get: function(elem){ var srces; var data = $.jme.data(elem); var src = data.media.prop('src'); if(src){ return [{src: src}]; } srces = $.map($('source', data.media).get(), function(source){ var i, len; var src = { src: $.prop(source, 'src') }; var attributes = source.attributes; for(i = 0, len = attributes.length; i < len; i++){ if(!('specified' in attributes[i]) || attributes[i].specified){ src[attributes[i].nodeName] = attributes[i].nodeValue; } } return src; }); return srces; }, set: function(elem, srces){ var data = $.jme.data(elem); var setSrc = function(i, src){ if(typeof src == 'string'){ src = {src: src}; } $(document.createElement('source')).attr(src).appendTo(data.media); }; data.media.removeAttr('src').find('source').remove(); if($.isArray(srces)){ $.each(srces, setSrc); } else { setSrc(0, srces); } data.media.jmeFn('load'); return 'noDataSet'; } }); $.jme.defineMethod('togglePlay', function(){ $(this).jmeFn( ( props.isPlaying.get(this) ) ? 'pause' : 'play' ); }); $.jme.defineMethod('addControls', function(controls){ var data = $.jme.data(this) || {}; if(!data.media){return;} var oldControls = $.jme.data(data.player[0], 'controlElements') || $([]); controls = $(controls); if($.jme.pluginsSel){ controls = controls.find($.jme.pluginsSel).add(controls.filter($.jme.pluginsSel)); } if(controls.length){ $.each($.jme.plugins, function(name, plugin){ var control, options, i, opt; var pluginControls = controls.filter('.'+plugin.className); for(i = 0; i < pluginControls.length; i++){ control = $(pluginControls[i]); options = $.jme.data(pluginControls[i]); options.player = data.player; options.media = data.media; if(!options._rendered){ options._rendered = true; if(plugin.options){ for(opt in plugin.options){ if(!(opt in options)){ options[opt] = plugin.options[opt]; } } } plugin._create(control, data.media, data.player, options); } } }); $.jme.data(data.player[0], 'controlElements', oldControls.add(controls)); data.player.triggerHandler('controlsadded'); } }); webshims.ready('DOM mediaelement', function(){ webshims.isReady('jme', true); webshims.addReady($.jme.initJME); webshims.isReady('jme-base', true); if(webshims.cfg.debug !== false && document.getElementsByTagName('video').length && !document.querySelector(baseSelector)){ webshims.warn("found video element but video wasn't wrapped inside a ."+ baseSelector +" element. Will not add control UI"); } }); }); ;webshims.register('mediacontrols', function($, webshims, window){ "use strict"; var pseudoClasses = 'pseudoClasses'; var options = webshims.cfg.mediaelement.jme; var baseSelector = options.selector; var jme = $.jme; var unknownStructure = '<div class="{%class%}"></div>'; var btnStructure = '<button class="{%class%}" type="button" aria-label="{%text%}"></button>'; var slideStructure = '<div class="{%class%} media-range" aria-label="{%text%}"></div>'; var timeStructure = '<div class="{%class%}">00:00</div>'; var noVolumeClass = (function(){ var audio; var ret = ''; if(window.Audio){ try { audio = new Audio(); audio.volume = 0.55; ret = ((Math.round(audio.volume * 100) / 100) == 0.55) ? '' : ' no-volume-api'; } catch(e){} } return ret; })(); var getBarHtml = (function(){ var cache = {}; var regTemplate = /\{\{(.+?)\}\}/igm; return function(template, invalidCache){ if(!template){ template = options.barTemplate; } if(!cache[template] || invalidCache){ cache[template] = template.replace(regTemplate, function(match, matchName){ var plugin = jme.plugins[matchName]; if(plugin){ if(!plugin.structure){ webshims.warn('no structure option provided for plugin: '+ matchName +'. Fallback to standard div'); plugin.structure = unknownStructure; } return plugin.structure.replace('{%class%}', matchName).replace('{%text%}', plugin.text || ''); } return match; }); } return cache[template] || ''; }; })(); var ios = /iP(hone|od|ad)/i.test(navigator.platform); var ios6 = ios && parseInt(((navigator.appVersion).match(/OS (\d+)_\d+/) || ['','8'])[1], 10) < 7; var modern = window.Modernizr; var hasYtBug = (!modern || !modern.videoautoplay) && (ios || /android/i.test(navigator.userAgent)); var loadLazy = function(){ if(!loadLazy.loaded){ loadLazy.loaded = true; webshims.loader.loadList(['mediacontrols-lazy', 'range-ui']); } }; var lazyLoadPlugin = function(fn){ if(!fn){ fn = '_create'; } var rfn = function(c, media){ var obj = this; var args = arguments; loadLazy(); webshims.ready('mediacontrols-lazy', function(){ if(rfn != obj[fn] && $.data(media[0])){ return obj[fn].apply(obj, args); } else { webshims.error('stop too much recursion'); } }); }; return rfn; }; webshims.loader.addModule('mediacontrols-lazy', { src: 'jme/mediacontrols-lazy', d: ['dom-support'] }); var userActivity = { _create: lazyLoadPlugin() }; jme.plugins.useractivity = userActivity; jme.defineProp('controlbar', { set: function(elem, value){ value = !!value; var controls, playerSize; var data = jme.data(elem); var controlBar = $('div.jme-mediaoverlay, div.jme-controlbar', data.player); var structure = ''; if(value && !controlBar[0]){ if(data._controlbar){ data._controlbar.appendTo(data.player); } else { if(ios6){ data.media.removeAttr('controls'); data.media.mediaLoad(); } if(hasYtBug){ data.player.addClass('has-yt-bug'); } data.media.prop('controls', false); structure = getBarHtml(); data._controlbar = $( options.barStructure ); controlBar = data._controlbar.find('div.jme-cb-box').addClass('media-controls'); controls = data._controlbar.filter('.jme-media-overlay'); controls = controls.add( controlBar ); $(structure).appendTo(controlBar); data._controlbar.appendTo(data.player); data.player.jmeFn('addControls', controls); playerSize = (function(){ var lastSize = {}; var sizes = [ {size: 290, name: 'xx-small', names: 's xs xxs'}, {size: 380, name: 'x-small', names: 's xs'}, {size: 478, name: 'small', names: 's'}, {size: 756, name: 'medium', names: 'm'}, {size: 1024, name: 'large', names: 'l'}, {size: Number.MAX_VALUE, name: 'x-large', names: 'l xl'} ]; var len = sizes.length; return function(){ var size; var i = 0; var width = data.player.outerWidth(); var fSize = Math.max(parseInt(data.player.css('fontSize'), 10) || 16, 13); width = width * (16 / fSize); for(; i < len; i++){ if(sizes[i].size >= width){ size = sizes[i]; break; } } if(lastSize.name != size.name){ lastSize = size; data.player.attr('data-playersize', size.name); data.player.attr('data-playersizes', size.names); } }; })(); var $poster = $('<div class="ws-poster" />').insertAfter(data.media); var posterState = (function(){ var lastPosterState, lastYoutubeState, lastPoster, isYt; var hasFlash = window.swfmini && swfmini.hasFlashPlayerVersion('10.0.3'); var regYt = /youtube\.com\/[watch\?|v\/]+/i; var isInitial = data.media.prop('paused'); var isEnded = data.media.prop('ended'); if(isInitial){ data.player.addClass('initial-state'); } if(isEnded){ data.player.addClass('ended-state'); } if(!('backgroundSize' in $poster[0].style)){ data.player.addClass('no-backgroundsize'); } data.media.on('play playing waiting seeked seeking', function(e){ if(!e){ e.type = 'playing'; } if(isInitial && (!isYt || !hasYtBug || e.type == 'playing' || data.media.prop('readyState') || data.media.prop('networkState'))){ isInitial = false; data.player.removeClass('initial-state'); } if(isEnded){ isEnded = false; data.player.removeClass('ended-state'); } }); data.media.on('ended', function(){ if(!isEnded && !data.media.prop('loop') && data.media.prop('ended')){ isEnded = true; data.player.addClass('ended-state'); } }); return function(){ var hasYt; var poster = data.media.attr('poster'); var hasPoster = !!poster; var currentSrc = data.media.prop('currentSrc') || ''; isYt = regYt.test(currentSrc); hasYt = (hasFlash && hasPoster) ? false : isYt; if(!hasPoster && isYt){ poster = currentSrc.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i) || ''; if(poster){ poster = 'https://img.youtube.com/vi/'+ poster[1] +'/0.jpg'; hasPoster = !!poster; } } if(lastPoster !== poster){ lastPoster = poster; $poster[0].style.backgroundImage = poster ? 'url('+poster+')' : ''; } if(lastPosterState !== hasPoster){ lastPosterState = hasPoster; data.player[hasPoster ? 'removeClass' : 'addClass']('no-poster'); } if(data.media.prop('paused')){ data.player.addClass('initial-state'); isInitial = true; } if(isEnded){ isEnded = false; data.player.removeClass('ended-state'); } //https://code.google.com/p/gdata-issues/issues/detail?id=5415 data.player[isYt ? 'addClass' : 'removeClass']('yt-video'); if(lastYoutubeState !== hasYt){ lastYoutubeState = hasYt; data.player[hasYt ? 'addClass' : 'removeClass']('has-ytposter'); } }; })(); userActivity._create(data.player, data.media, data.player); data.media.on('emptied loadstart', function(){ setTimeout(posterState); }); playerSize(); posterState(); webshims.ready('dom-support', function(){ data.player.onWSOff('updateshadowdom', playerSize); controls.add(data._controlbar).add($poster).addClass(webshims.shadowClass); webshims.addShadowDom(); }); } } else if(!value) { controlBar.detach(); } return value; } }); jme.registerPlugin('play-pause', { structure: btnStructure, text: 'play / pause', _create: lazyLoadPlugin() }); jme.registerPlugin('mute-unmute', { structure: btnStructure, text: 'mute / unmute', _create: lazyLoadPlugin() }); jme.registerPlugin('jme-media-overlay', { _create: lazyLoadPlugin() }); jme.registerPlugin('volume-slider', { structure: slideStructure, text: 'volume level', _create: lazyLoadPlugin() }); jme.registerPlugin('time-slider', { structure: slideStructure, options: { format: ['mm', 'ss'] }, text: 'time position', _create: lazyLoadPlugin() }); jme.defineProp('format', { set: function(elem, format){ if(!$.isArray(format)){ format = format.split(':'); } var data = jme.data(elem); data.format = format; $(elem).triggerHandler('updatetimeformat'); data.player.triggerHandler('updatetimeformat'); return 'noDataSet'; } }); jme.registerPlugin('duration-display', { structure: timeStructure, options: { format: "mm:ss" }, _create: lazyLoadPlugin() }); jme.defineProp('countdown', { set: function(elem, value){ var data = jme.data(elem); data.countdown = !!value; $(elem).triggerHandler('updatetimeformat'); data.player.triggerHandler('updatetimeformat'); return 'noDataSet'; } }); jme.registerPlugin('currenttime-display', { structure: timeStructure, options: { format: "mm:ss", countdown: false }, _create: lazyLoadPlugin() }); /** * Added Poster Plugin * @author mderting */ /* * the old technique wasn't fully bullet proof * beside this, jme2 adovactes to use the new improved state-classes to handle visual effect on specific state (see CSS change) */ jme.registerPlugin('poster-display', { structure: '<div />', options: { }, _create: lazyLoadPlugin() }); jme.registerPlugin('fullscreen', { options: { fullscreen: true, autoplayfs: false }, structure: btnStructure, text: 'enter fullscreen / exit fullscreen', _create: lazyLoadPlugin() }); jme.registerPlugin('mediaconfigmenu', { structure: btnStructure, text: 'configuration', _create: lazyLoadPlugin() }); jme.registerPlugin('captions', { structure: btnStructure, text: 'subtitles', _create: function(control, media, base){ var trackElems = media.find('track').filter(':not([kind]), [kind="subtitles"], [data-kind="subtitles"], [kind="captions"], [data-kind="captions"]'); control.wsclonedcheckbox = $(control).clone().attr({role: 'checkbox'}).insertBefore(control); base.attr('data-tracks', trackElems.length > 1 ? 'many' : trackElems.length); control.attr('aria-haspopup', 'true'); lazyLoadPlugin().apply(this, arguments); } }); jme.registerPlugin('chapters', { structure: btnStructure, text: 'chapters', _create: function(control, media, base){ var trackElems = media.find('track').filter('[kind="chapters"], [data-kind="chapters"]'); control.attr('aria-haspopup', 'true'); if(trackElems.length){ webshims._polyfill(['track']); base.addClass('has-chapter-tracks'); } lazyLoadPlugin().apply(this, arguments); } }); webshims.ready(webshims.cfg.mediaelement.plugins.concat(['mediaelement', 'jme-base']), function(){ if(!options.barTemplate){ options.barTemplate = '<div class="play-pause-container">{{play-pause}}</div><div class="playlist-container"><div class="playlist-box"><div class="playlist-button-container">{{playlist-prev}}</div><div class="playlist-button-container">{{playlist-next}}</div></div></div><div class="currenttime-container">{{currenttime-display}}</div><div class="progress-container">{{time-slider}}</div><div class="duration-container">{{duration-display}}</div><div class="mute-container">{{mute-unmute}}</div><div class="volume-container">{{volume-slider}}</div><div class="chapters-container"><div class="chapters-controls mediamenu-wrapper">{{chapters}}</div></div><div class="subtitle-container mediamenu-wrapper"><div class="subtitle-controls">{{captions}}</div></div><div class="mediaconfig-container"><div class="mediaconfig-controls mediamenu-wrapper">{{mediaconfigmenu}}</div></div><div class="fullscreen-container">{{fullscreen}}</div>'; } if(!options.barStructure){ options.barStructure = '<div class="jme-media-overlay"></div><div class="jme-controlbar'+ noVolumeClass +'" tabindex="-1"><div class="jme-cb-box"></div></div>'; } webshims.addReady(function(context, insertedElement){ $(baseSelector, context).add(insertedElement.filter(baseSelector)).jmeProp('controlbar', true); }); }); webshims.ready('WINDOWLOAD', loadLazy); });
jieter/cdnjs
ajax/libs/webshim/1.15.7/dev/shims/combos/99.js
JavaScript
mit
22,575
!function(){function t(t){test.mode(t,e,Array.prototype.slice.call(arguments,1))}var e=CodeMirror.getMode({tabSize:4},"stex");t("word","foo"),t("twoWords","foo bar"),t("beginEndDocument","[tag \\begin][bracket {][atom document][bracket }]","[tag \\end][bracket {][atom document][bracket }]"),t("beginEndEquation","[tag \\begin][bracket {][atom equation][bracket }]"," E=mc^2","[tag \\end][bracket {][atom equation][bracket }]"),t("beginModule","[tag \\begin][bracket {][atom module][bracket }[[]]]"),t("beginModuleId","[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]"),t("importModule","[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]"),t("importModulePath","[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]"),t("psForPDF","[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]"),t("comment","[comment % foo]"),t("tagComment","[tag \\item][comment % bar]"),t("commentTag"," [comment % \\item]"),t("commentLineBreak","[comment %]","foo"),t("tagErrorCurly","[tag \\begin][error }][bracket {]"),t("tagErrorSquare","[tag \\item][error ]]][bracket {]"),t("commentCurly","[comment % }]"),t("tagHash","the [tag \\#] key"),t("tagNumber","a [tag \\$][atom 5] stetson"),t("tagPercent","[atom 100][tag \\%] beef"),t("tagAmpersand","L [tag \\&] N"),t("tagUnderscore","foo[tag \\_]bar"),t("tagBracketOpen","[tag \\emph][bracket {][tag \\{][bracket }]"),t("tagBracketClose","[tag \\emph][bracket {][tag \\}][bracket }]"),t("tagLetterNumber","section [tag \\S][atom 1]"),t("textTagNumber","para [tag \\P][atom 2]"),t("thinspace","x[tag \\,]y"),t("thickspace","x[tag \\;]y"),t("negativeThinspace","x[tag \\!]y"),t("periodNotSentence","J.\\ L.\\ is"),t("periodSentence","X[tag \\@]. The"),t("italicCorrection","[bracket {][tag \\em] If[tag \\/][bracket }] I"),t("tagBracket","[tag \\newcommand][bracket {][tag \\pop][bracket }]"),t("inlineMathTagFollowedByNumber","[keyword $][tag \\pi][number 2][keyword $]"),t("inlineMath","[keyword $][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword $] other text"),t("displayMath","More [keyword $$] [variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text"),t("mathWithComment","[keyword $][variable-2 x] [comment % $]","[variable-2 y][keyword $] other text"),t("lineBreakArgument","[tag \\\\][bracket [[][atom 1cm][bracket ]]]")}();
gaearon/cdnjs
ajax/libs/codemirror/4.12.0/mode/stex/test.min.js
JavaScript
mit
2,506
// Copyright 2008 The Closure Library Authors. 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.provide('goog.editor.plugins.HeaderFormatterTest'); goog.setTestOnly('goog.editor.plugins.HeaderFormatterTest'); goog.require('goog.dom'); goog.require('goog.editor.Command'); goog.require('goog.editor.plugins.BasicTextFormatter'); goog.require('goog.editor.plugins.HeaderFormatter'); goog.require('goog.events.BrowserEvent'); goog.require('goog.testing.LooseMock'); goog.require('goog.testing.editor.FieldMock'); goog.require('goog.testing.editor.TestHelper'); goog.require('goog.testing.jsunit'); goog.require('goog.userAgent'); var field; var editableField; var headerFormatter; var btf; var testHelper; function setUpPage() { field = goog.dom.getElement('field'); testHelper = new goog.testing.editor.TestHelper(field); } function setUp() { testHelper.setUpEditableElement(); editableField = new goog.testing.editor.FieldMock(); headerFormatter = new goog.editor.plugins.HeaderFormatter(); headerFormatter.registerFieldObject(editableField); btf = new goog.editor.plugins.BasicTextFormatter(); btf.registerFieldObject(editableField); } function tearDown() { editableField = null; headerFormatter.dispose(); testHelper.tearDownEditableElement(); } function testHeaderShortcuts() { field.innerHTML = 'myText'; var textNode = field.firstChild; testHelper.select(textNode, 0, textNode, textNode.length); editableField.getElement(); editableField.$anyTimes(); editableField.$returns(field); editableField.getPluginByClassId('Bidi'); editableField.$anyTimes(); editableField.$returns(null); editableField.execCommand( goog.editor.Command.FORMAT_BLOCK, goog.editor.plugins.HeaderFormatter.HEADER_COMMAND.H1); // Bypass EditableField's execCommand and directly call // basicTextFormatter's. Future version of headerformatter will include // that code in its own execCommand. editableField.$does(function() { btf.execCommandInternal( goog.editor.plugins.BasicTextFormatter.COMMAND.FORMAT_BLOCK, goog.editor.plugins.HeaderFormatter.HEADER_COMMAND.H1); }); var event = new goog.testing.LooseMock(goog.events.BrowserEvent); if (goog.userAgent.GECKO) { event.stopPropagation(); } editableField.$replay(); event.$replay(); assertTrue('Event handled', headerFormatter.handleKeyboardShortcut(event, '1', true)); assertEquals('Field contains a header', 'H1', field.firstChild.nodeName); editableField.$verify(); event.$verify(); }
marungo/myblockly
closure-library/closure/goog/editor/plugins/headerformatter_test.js
JavaScript
mit
3,077
(function($){ "use strict"; var isNumber = function(string){ return (typeof string == 'number' || (string && string == string * 1)); }; var retDefault = function(val, def){ if(!(typeof val == 'number' || (val && val == val * 1))){ return def; } return val * 1; }; var createOpts = ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex']; var normalizeTouch = (function(){ var types = { touchstart: 1, touchend: 1, touchmove: 1 }; var normalize = ['pageX', 'pageY']; return function(e){ if(types[e.type] && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches.length){ for(var i = 0; i < normalize.length; i++){ e[normalize[i]] = e.originalEvent.touches[0][normalize[i]]; } } return e; }; })(); var rangeProto = { _create: function(){ var i; this.element.addClass(this.options.baseClass || 'ws-range ws-input').attr({role: 'slider'}).append('<span class="ws-range-rail ws-range-track"><span class="ws-range-min ws-range-progress" /><span class="ws-range-thumb"><span><span data-value="" data-valuetext="" /></span></span></span>'); this.trail = $('.ws-range-track', this.element); this.range = $('.ws-range-progress', this.element); this.thumb = $('.ws-range-thumb', this.trail); this.thumbValue = $('span[data-value]', this.thumb); this.updateMetrics(); this.orig = this.options.orig; for(i = 0; i < createOpts.length; i++){ this[createOpts[i]](this.options[createOpts[i]]); } this.value = this._value; this.value(this.options.value); this.initDataList(); this.element.data('rangeUi', this); this.addBindings(); this._init = true; }, value: $.noop, _value: function(val, _noNormalize, animate){ var left, posDif; var o = this.options; var oVal = val; var thumbStyle = {}; var rangeStyle = {}; if(!_noNormalize && parseFloat(val, 10) != val){ val = o.min + ((o.max - o.min) / 2); } if(!_noNormalize){ val = this.normalizeVal(val); } left = 100 * ((val - o.min) / (o.max - o.min)); if(this._init && val == o.value && oVal == val){return;} o.value = val; if($.fn.stop){ this.thumb.stop(); this.range.stop(); } rangeStyle[this.dirs.width] = left+'%'; if(this.vertical){ left = Math.abs(left - 100); } thumbStyle[this.dirs.left] = left+'%'; if(!animate || !$.fn.animate){ this.thumb[0].style[this.dirs.left] = thumbStyle[this.dirs.left]; this.range[0].style[this.dirs.width] = rangeStyle[this.dirs.width]; } else { if(typeof animate != 'object'){ animate = {}; } else { animate = $.extend({}, animate); } if(!animate.duration){ posDif = Math.abs(left - parseInt(this.thumb[0].style[this.dirs.left] || 50, 10)); animate.duration = Math.max(Math.min(999, posDif * 5), 99); } this.thumb.animate(thumbStyle, animate); this.range.animate(rangeStyle, animate); } if(this.orig && (oVal != val || (!this._init && this.orig.value != val)) ){ this.options._change(val); } this._setValueMarkup(); }, _setValueMarkup: function(){ var o = this.options; var textValue = o.textValue ? o.textValue(this.options.value) : o.options[o.value] || o.value; this.element[0].setAttribute('aria-valuenow', this.options.value); this.element[0].setAttribute('aria-valuetext', textValue); this.thumbValue[0].setAttribute('data-value', this.options.value); this.thumbValue[0].setAttribute('data-valuetext', textValue); if(o.selectedOption){ $(o.selectedOption).removeClass('ws-selected-option'); o.selectedOption = null; } if(o.value in o.options){ o.selectedOption = $('[data-value="'+o.value+'"].ws-range-ticks', this.trail).addClass('ws-selected-option'); } }, initDataList: function(){ if(this.orig){ var listTimer; var that = this; var updateList = function(){ $(that.orig) .jProp('list') .off('updateDatalist', updateList) .on('updateDatalist', updateList) ; clearTimeout(listTimer); listTimer = setTimeout(function(){ if(that.list){ that.list(); } }, 9); }; $(this.orig).on('listdatalistchange', updateList); this.list(); } }, list: function(opts){ var o = this.options; var min = o.min; var max = o.max; var trail = this.trail; var that = this; this.element.attr({'aria-valuetext': o.options[o.value] || o.value}); $('.ws-range-ticks', trail).remove(); $(this.orig).jProp('list').find('option:not([disabled])').each(function(){ o.options[$.prop(this, 'value')] = $.prop(this, 'label') || ''; }); $.each(o.options, function(val, label){ if(!isNumber(val) || val < min || val > max){return;} var left = 100 * ((val - min) / (max - min)); var attr = 'data-value="'+val+'"'; if(label){ attr += ' data-label="'+label+'"'; if(o.showLabels){ attr += ' title="'+label+'"'; } } if(that.vertical){ left = Math.abs(left - 100); } that.posCenter( $('<span class="ws-range-ticks"'+ attr +' style="'+(that.dirs.left)+': '+left+'%;" />').appendTo(trail) ); }); if(o.value in o.options){ this._setValueMarkup(); } }, readonly: function(val){ val = !!val; this.options.readonly = val; this.element.attr('aria-readonly', ''+val); if(this._init){ this.updateMetrics(); } }, disabled: function(val){ val = !!val; this.options.disabled = val; if(val){ this.element.attr({tabindex: -1, 'aria-disabled': 'true'}); } else { this.element.attr({tabindex: this.options.tabindex, 'aria-disabled': 'false'}); } if(this._init){ this.updateMetrics(); } }, tabindex: function(val){ this.options.tabindex = val; if(!this.options.disabled){ this.element.attr({tabindex: val}); } }, title: function(val){ this.element.prop('title', val); }, min: function(val){ this.options.min = retDefault(val, 0); this.element.attr('aria-valuemin', this.options.min); this.value(this.options.value, true); }, max: function(val){ this.options.max = retDefault(val, 100); this.element.attr('aria-valuemax', this.options.max); this.value(this.options.value, true); }, step: function(val){ var o = this.options; var step = val == 'any' ? 'any' : retDefault(val, 1); if(o.stepping){ webshims.error('stepping was removed. Use stepfactor instead.'); } if(o.stepfactor && step != 'any'){ step *= o.stepfactor; } o.step = step; this.value(this.options.value); }, normalizeVal: function(val){ var valModStep, alignValue, step; var o = this.options; if(val <= o.min){ val = o.min; } else if(val >= o.max) { val = o.max; } else if(o.step != 'any'){ step = o.step; valModStep = (val - o.min) % step; alignValue = val - valModStep; if ( Math.abs(valModStep) * 2 >= step ) { alignValue += ( valModStep > 0 ) ? step : ( -step ); } val = alignValue.toFixed(5) * 1; } return val; }, doStep: function(factor, animate){ var step = retDefault(this.options.step, 1); if(this.options.step == 'any'){ step = Math.min(step, (this.options.max - this.options.min) / 10); } this.value( this.options.value + (step * factor), false, animate ); }, getStepedValueFromPos: function(pos){ var val, valModStep, alignValue, step; if(pos <= 0){ val = this.options[this.dirs[this.isRtl ? 'max' : 'min']]; } else if(pos > 100) { val = this.options[this.dirs[this.isRtl ? 'min' : 'max']]; } else { if(this.vertical || this.isRtl){ pos = Math.abs(pos - 100); } val = ((this.options.max - this.options.min) * (pos / 100)) + this.options.min; step = this.options.step; if(step != 'any'){ valModStep = (val - this.options.min) % step; alignValue = val - valModStep; if ( Math.abs(valModStep) * 2 >= step ) { alignValue += ( valModStep > 0 ) ? step : ( -step ); } val = ((alignValue).toFixed(5)) * 1; } } return val; }, addRemoveClass: function(cName, add){ var isIn = this.element.prop('className').indexOf(cName) != -1; var action; if(!add && isIn){ action = 'removeClass'; this.element.removeClass(cName); this.updateMetrics(); } else if(add && !isIn){ action = 'addClass'; } if(action){ this.element[action](cName); if(this._init){ this.updateMetrics(); } } }, addBindings: function(){ var leftOffset, widgetUnits, hasFocus, isActive; var that = this; var o = this.options; var eventTimer = (function(){ var events = {}; return { init: function(name, curVal, fn){ if(!events[name]){ events[name] = {fn: fn}; if(that.orig){ $(that.orig).on(name, function(){ events[name].val = $.prop(that.orig, 'value'); }); } } events[name].val = curVal; }, call: function(name, val){ if(events[name].val != val){ clearTimeout(events[name].timer); events[name].val = val; events[name].timer = setTimeout(function(){ events[name].fn(val, that); }, 0); } } }; })(); var updateValue = function(val, animate){ if(val != o.value){ that.value(val, false, animate); eventTimer.call('input', val); } }; var setValueFromPos = function(e, animate){ if(e.type == 'touchmove'){ e.preventDefault(); normalizeTouch(e); } updateValue(that.getStepedValueFromPos((e[that.dirs.mouse] - leftOffset) * widgetUnits), animate); if(e && e.type == 'mousemove'){ e.preventDefault(); } }; var remove = function(e){ if(e && (e.type == 'mouseup' || e.type == 'touchend')){ eventTimer.call('input', o.value); eventTimer.call('change', o.value); } that.addRemoveClass('ws-active'); $(document).off('mousemove touchmove', setValueFromPos).off('mouseup touchend', remove); $(window).off('blur', removeWin); isActive = false; }; var removeWin = function(e){ if(e.target == window){remove();} }; var add = function(e){ if(isActive || (e.type == 'touchstart' && (!e.originalEvent || !e.originalEvent.touches || e.originalEvent.touches.length != 1))){ return; } e.preventDefault(); $(document).off('mousemove touchmove', setValueFromPos).off('mouseup touchend', remove); $(window).off('blur', removeWin); if(!o.readonly && !o.disabled){ eventTimer.init('input', o.value); eventTimer.init('change', o.value); normalizeTouch(e); that.element.trigger('focus'); that.addRemoveClass('ws-active', true); leftOffset = that.element.offset(); widgetUnits = that.element[that.dirs.innerWidth](); if(!widgetUnits || !leftOffset){return;} leftOffset = leftOffset[that.dirs.pos]; widgetUnits = 100 / widgetUnits; if(e.target.className == 'ws-range-ticks'){ updateValue(e.target.getAttribute('data-value'), o.animate); } else { setValueFromPos(e, o.animate); } isActive = true; $(document) .on(e.type == 'touchstart' ? { touchend: remove, touchmove: setValueFromPos } : { mouseup: remove, mousemove: setValueFromPos } ) ; $(window).on('blur', removeWin); e.stopPropagation(); } }; var elementEvts = { 'touchstart mousedown': add, focus: function(e){ if(!o.disabled && !hasFocus){ if(!isActive){ eventTimer.init('input', o.value); eventTimer.init('change', o.value); } that.addRemoveClass('ws-focus', true); that.updateMetrics(); } hasFocus = true; }, blur: function(e){ that.element.removeClass('ws-focus ws-active'); that.updateMetrics(); hasFocus = false; eventTimer.init('input', o.value); eventTimer.call('change', o.value); }, keyup: function(){ that.addRemoveClass('ws-active'); eventTimer.call('input', o.value); eventTimer.call('change', o.value); }, keydown: function(e){ var step = true; var code = e.keyCode; if(!o.readonly && !o.disabled){ if(that.isRtl){ if(code == 39){ code = 37; } else if(code == 37){ code = 39; } } if (code == 39 || code == 38) { that.doStep(1); } else if (code == 37 || code == 40) { that.doStep(-1); } else if (code == 33) { that.doStep(10, o.animate); } else if (code == 34) { that.doStep(-10, o.animate); } else if (code == 36) { that.value(that.options.max, false, o.animate); } else if (code == 35) { that.value(that.options.min, false, o.animate); } else { step = false; } if (step) { that.addRemoveClass('ws-active', true); eventTimer.call('input', o.value); e.preventDefault(); } } } }; eventTimer.init('input', o.value, this.options.input); eventTimer.init('change', o.value, this.options.change); elementEvts[$.fn.mwheelIntent ? 'mwheelIntent' : 'mousewheel'] = function(e, delta){ if(delta && hasFocus && !o.readonly && !o.disabled){ that.doStep(delta); e.preventDefault(); eventTimer.call('input', o.value); } }; this.element.on(elementEvts); this.thumb.on({ mousedown: add }); if(this.orig){ $(this.orig).jProp('form').on('reset', function(){ var val = $.prop(that.orig, 'value'); that.value(val); setTimeout(function(){ var val2 = $.prop(that.orig, 'value'); if(val != val2){ that.value(val2); } }, 4); }); } if (window.webshims) { webshims.ready('WINDOWLOAD', function(){ webshims.ready('dom-support', function(){ if ($.fn.onWSOff) { var timer; var update = function(){ that.updateMetrics(); }; that.element.onWSOff('updateshadowdom', function(){ clearTimeout(timer); timer = setTimeout(update, 100); }); } }); if (!$.fn.onWSOff && webshims._polyfill) { webshims._polyfill(['dom-support']); } }); } }, posCenter: function(elem, outerWidth){ var temp, eS; if(this.options.calcCenter && (!this._init || this.element[0].offsetWidth)){ if(!elem){ elem = this.thumb; } eS = elem[0].style; if(!outerWidth){ outerWidth = elem[this.dirs.outerWidth](); } outerWidth = outerWidth / -2; eS[this.dirs.marginLeft] = outerWidth +'px'; if(this.options.calcTrail && elem[0] == this.thumb[0]){ temp = this.element[this.dirs.innerHeight](); eS[this.dirs.marginTop] = ((elem[this.dirs.outerHeight]() - temp) / -2) + 'px'; this.range[0].style[this.dirs.marginTop] = ((this.range[this.dirs.outerHeight]() - temp) / -2 ) +'px'; this.range[0].style[this.dirs.posLeft] = outerWidth +'px'; outerWidth *= -1; this.range[0].style[this.dirs.paddingRight] = outerWidth +'px'; this.trail[0].style[this.dirs.left] = outerWidth +'px'; this.trail[0].style[this.dirs.right] = outerWidth +'px'; } } }, updateMetrics: function(){ var width = this.element.innerWidth(); this.vertical = (width && this.element.innerHeight() - width > 10); this.dirs = this.vertical ? {mouse: 'pageY', pos: 'top', posLeft: 'bottom', paddingRight: 'paddingTop', min: 'max', max: 'min', left: 'top', right: 'bottom', width: 'height', innerWidth: 'innerHeight', innerHeight: 'innerWidth', outerWidth: 'outerHeight', outerHeight: 'outerWidth', marginTop: 'marginLeft', marginLeft: 'marginTop'} : {mouse: 'pageX', pos: 'left', posLeft: 'left', paddingRight: 'paddingRight', min: 'min', max: 'max', left: 'left', right: 'right', width: 'width', innerWidth: 'innerWidth', innerHeight: 'innerHeight', outerWidth: 'outerWidth', outerHeight: 'outerHeight', marginTop: 'marginTop', marginLeft: 'marginLeft'} ; if(!this.vertical && this.element.css('direction') == 'rtl'){ this.isRtl = true; this.dirs.left = 'right'; this.dirs.right = 'left'; this.dirs.marginLeft = 'marginRight'; this.dirs.posLeft = 'right'; } this.element [this.vertical ? 'addClass' : 'removeClass']('vertical-range') [this.isRtl ? 'addClass' : 'removeClass']('ws-is-rtl') ; this.updateMetrics = this.posCenter; this.posCenter(); } }; var oCreate = function (o) { function F() {} F.prototype = o; return new F(); }; $.fn.rangeUI = function(opts){ opts = $.extend({ readonly: false, disabled: false, tabindex: 0, min: 0, step: 1, max: 100, value: 50, input: $.noop, change: $.noop, _change: $.noop, showLabels: true, options: {}, calcCenter: true, calcTrail: true }, opts); return this.each(function(){ var obj = $.extend(oCreate(rangeProto), {element: $(this)}); obj.options = opts; obj._create.call(obj); }); }; $.fn.rangeUI.normalizeTouch = normalizeTouch; if(window.webshims && webshims.isReady){ webshims.isReady('range-ui', true); } })(window.webshims ? webshims.$ : jQuery); webshims.register('form-number-date-ui', function ($, webshims, window, document, undefined, options) { "use strict"; var curCfg; var formcfg = webshims.formcfg; var hasFormValidation = webshims.support.formvalidation && !webshims.bugs.bustedValidity; var monthDigits = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']; var stopPropagation = function(e){ e.stopImmediatePropagation(); }; var getMonthOptions = function(opts){ var selectName = 'monthSelect'+opts.monthNames; if(!curCfg[selectName]){ var labels = curCfg.date[opts.monthNames] || monthDigits; curCfg[selectName] = ('<option value=""></option>')+$.map(monthDigits, function(val, i){ return '<option value="'+val+'">'+labels[i]+'</option>'; }).join(''); } return curCfg[selectName]; }; var daySelect = '<select class="dd"><option value=""></option>'+ (function(){ var i = 1; var opts = []; while(i < 32){ opts.push('<option>'+ ((i < 10) ? '0'+ i : i) +'</option>' ); i++; } return opts.join(''); })() +'</select>'; var createFormat = function(name){ if(!curCfg.patterns[name+'Obj']){ var obj = {}; $.each(curCfg.patterns[name].split(curCfg[name+'Format']), function(i, name){ obj[name] = i; }); curCfg.patterns[name+'Obj'] = obj; } }; var createYearSelect = function(obj, opts){ var options, nowY, max, min; if(opts.yearSelect){ nowY = parseInt(opts.value.split('-')[0], 10); max = opts.max.split('-'); min = opts.min.split('-'); options = webshims.picker.createYearSelect(nowY || parseInt(min[0], 10) || parseInt(max[0], 10) || nowYear, max, min); options.unshift('<option />'); $(obj.elements) .filter('select.yy') .html(options.join('')) .each(function(){ if(!nowY){ $('option[selected]', this).removeAttr('selected'); $(this).val(); } }) ; } }; var numericType = webshims.support.inputtypes.tel && navigator.userAgent.indexOf('Mobile') != -1 && !('inputMode' in document.createElement('input') && !('inputmode' in document.createElement('input'))) ? 'tel' : 'text'; var splitInputs = { date: { _create: function(opts){ var obj = { splits: [] }; if(opts.yearSelect){ obj.splits.push($('<select class="yy"></select>')[0]); } else { obj.splits.push($('<input type="'+ numericType +'" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]); } if(opts.monthSelect){ obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]); } else { obj.splits.push($('<input type="'+ numericType +'" class="mm" inputmode="numeric" maxlength="2" size="2" />')[0]); } if(opts.daySelect){ obj.splits.push($(daySelect)[0]); } else { obj.splits.push($('<input type="'+ numericType +'" class="dd ws-spin" inputmode="numeric" maxlength="2" size="2" />')[0]); } obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1], $('<span class="ws-input-seperator" />')[0], obj.splits[2]]; createYearSelect(obj, opts); return obj; }, sort: function(element){ createFormat('d'); var i = 0; var seperators = $('.ws-input-seperator', element).html(curCfg.dFormat); var inputs = $('input, select', element); $.each(curCfg.patterns.dObj, function(name, value){ var input = inputs.filter('.'+ name); if(input[0]){ input.appendTo(element); if(i < seperators.length){ seperators.eq(i).insertAfter(input); } i++; } }); } }, month: { _create: function(opts){ var obj = { splits: [] }; if(opts.yearSelect){ obj.splits.push($('<select class="yy"></select>')[0]); } else { obj.splits.push($('<input type="'+ numericType +'" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]); } if(opts.monthSelect){ obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]); } else { obj.splits.push($('<input type="text" class="mm ws-spin" />')[0]); if(opts.onlyMonthDigits){ $().attr({inputmode: 'numeric', size: 2, maxlength: 2}); try { obj.splits[1].setAttribute('type', numericType); } catch(e){} } } obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1]]; createYearSelect(obj, opts); return obj; }, sort: function(element){ var seperator = $('.ws-input-seperator', element).html(curCfg.dFormat); var mm = $('input.mm, select.mm', element); var action; if(curCfg.date.showMonthAfterYear){ mm.appendTo(element); action = 'insertBefore'; } else { mm.prependTo(element); action = 'insertAfter'; } seperator[action](mm); } } }; var nowDate = new Date(new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 )); var nowYear = nowDate.getFullYear(); nowDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), nowDate.getHours()).getTime(); var steps = { number: { step: 1 }, // week: { // step: 1, // start: new Date(nowDate) // }, 'datetime-local': { step: 60, start: new Date(nowDate).getTime() }, time: { step: 60 }, month: { step: 1, start: new Date(nowDate) }, date: { step: 1, start: new Date(nowDate) } }; var labelWidth = (function(){ var getId = function(){ return webshims.getID(this); }; return function(element, labels, noFocus){ $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')}); if(!noFocus){ labels.on('click', function(e){ if(!e.isDefaultPrevented()){ element.getShadowFocusElement().focus(); e.preventDefault(); return false; } }); } }; })(); var addZero = function(val){ val = val+''; if(!val){return "";} return val.length == 1 ? '0'+val : val; }; var loadPicker = function(type, name){ type = (type == 'color' ? 'color' : 'forms')+'-picker'; if(!loadPicker[name+'Loaded'+type]){ loadPicker[name+'Loaded'+type] = true; webshims.ready(name, function(){ webshims.loader.loadList([type]); }); } return type; }; options.addZero = addZero; webshims.loader.addModule('forms-picker', { noAutoCallback: true, css: 'styles/forms-picker.css', options: options }); webshims.loader.addModule('color-picker', { noAutoCallback: true, css: 'jpicker/jpicker.css', options: options, d: ['forms-picker'] }); options.steps = steps; (function(){ formcfg.de = $.extend(true, { numberFormat: { ",": ".", ".": "," }, timeSigns: ":. ", numberSigns: ',', dateSigns: '.', dFormat: ".", patterns: { d: "dd.mm.yy" }, month: { currentText: 'Aktueller Monat' }, time: { currentText: 'Jetzt' }, date: { close: 'schließen', clear: 'Löschen', prevText: 'Zurück', nextText: 'Vor', currentText: 'Heute', monthNames: ['Januar','Februar','März','April','Mai','Juni', 'Juli','August','September','Oktober','November','Dezember'], monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun', 'Jul','Aug','Sep','Okt','Nov','Dez'], dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'], dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'], dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'], weekHeader: 'KW', firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: '' } }, formcfg.de || {}); formcfg.en = $.extend(true, { numberFormat: { ".": ".", ",": "," }, numberSigns: '.', dateSigns: '-', timeSigns: ":. ", dFormat: "-", patterns: { d: "yy-mm-dd" }, month: { currentText: 'This month' }, time: { "currentText": "Now" }, date: { "closeText": "Done", clear: 'Clear', "prevText": "Prev", "nextText": "Next", "currentText": "Today", "monthNames": ["January","February","March","April","May","June","July","August","September","October","November","December"], "monthNamesShort": ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"], "dayNames": ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"], "dayNamesShort": ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"], "dayNamesMin": ["Su","Mo","Tu","We","Th","Fr","Sa"], "weekHeader": "Wk", "firstDay": 1, "isRTL": false, "showMonthAfterYear": false, "yearSuffix": "" } }, formcfg.en || {}); if(!formcfg['en-US']){ formcfg['en-US'] = $.extend(true, {}, formcfg.en, { date: {firstDay: 0}, patterns: {d: "mm/dd/yy"}, dateSigns: '-', dFormat: "/", meridian: ['AM', 'PM'] }); } if(!formcfg['en-GB']){ formcfg['en-GB'] = $.extend(true, {}, formcfg.en, { date: {firstDay: 1}, patterns: {d: "dd/mm/yy"}, dateSigns: '-', dFormat: "/", meridian: ['AM', 'PM'] }); } if(!formcfg['en-AU']){ formcfg['en-AU'] = $.extend(true, {}, formcfg['en-GB']); } if(!formcfg['']){ formcfg[''] = formcfg['en']; } curCfg = formcfg['']; var processLangCFG = function(langCfg){ if(!langCfg.date.monthkeys){ var create = function(i, name){ var strNum; var num = i + 1; strNum = (num < 10) ? '0'+num : ''+num; langCfg.date.monthkeys[num] = strNum; langCfg.date.monthkeys[name] = strNum; langCfg.date.monthkeys[name.toLowerCase()] = strNum; }; langCfg.date.monthkeys = {}; langCfg.date.monthDigits = monthDigits; langCfg.numberSigns += '-'; if(langCfg.meridian){ langCfg.timeSigns += langCfg.meridian[0] + langCfg.meridian[1] + langCfg.meridian[0].toLowerCase() + langCfg.meridian[1].toLowerCase(); } $.each(langCfg.date.monthNames, create); $.each(langCfg.date.monthNamesShort, create); } if(!langCfg.colorSigns){ langCfg.colorSigns = '#abcdefABCDEF'; } if(!langCfg['datetime-localSigns']){ langCfg['datetime-localSigns'] = langCfg.dateSigns+langCfg.timeSigns; } if(!langCfg['datetime-local']){ langCfg['datetime-local'] = {}; } if(!langCfg.time){ langCfg.time = {}; } if(!langCfg['datetime-local'].currentText && langCfg.time.currentText){ langCfg['datetime-local'].currentText = langCfg.time.currentText; } }; var triggerLocaleChange = function(){ processLangCFG(curCfg); $(document).triggerHandler('wslocalechange'); }; curCfg = webshims.activeLang(formcfg); triggerLocaleChange(); $(formcfg).on('change', function(){ curCfg = formcfg.__active; triggerLocaleChange(); }); })(); (function(){ var retDefault = function(val, def){ if(!(typeof val == 'number' || (val && val == val * 1))){ return def; } return val * 1; }; var formatVal = { number: function(val, o, noCorrect){ var parts, len, i, isNegative; if(o && o.nogrouping){ return (val+'').replace(/\,/g, '').replace(/\./, curCfg.numberFormat['.']); } val += ''; if(val.charAt(0) == '-'){ isNegative = true; val = val.replace('-', ''); } parts = val.split('.'); len = parts[0].length; i = len - 1; val = ""; while(i >= 0) { val = parts[0].charAt(i) + val; if (i > 0 && (len - i) % 3 === 0) { val = curCfg.numberFormat[','] + val; } --i; } if(parts[1] != null){ if(!noCorrect){ parts[1] = parts[1].replace(/\-/g, '0'); } val += curCfg.numberFormat['.'] + parts[1]; } if(isNegative){ val = '-'+val; } return val; }, time: function(val, o, noCorrect){ var fVal, i; if(val){ val = val.split(':'); if(val.length != 2 || isNaN(parseInt(val[0] || '', 10)) || isNaN(parseInt(val[1] || '', 10))){ return val.join(':'); } if(curCfg.meridian){ fVal = (val[0] * 1); if(fVal && fVal >= 12){ val[0] = addZero(fVal - 12+''); fVal = 1; } else { fVal = 0; } if(val[0] === '00'){ val[0] = '12'; } } if(!noCorrect){ for(i = 0; i < val.length; i++){ val[i] = addZero(val[i]); } if(!val[1]){ val[1] = '00'; } } val = $.trim(val.join(':')); if(fVal != null && curCfg.meridian){ val += ' '+curCfg.meridian[fVal]; } } return val; }, 'datetime-local': function(val, o){ var fVal = $.trim(val || '').split('T'); if(fVal.length == 2){ val = this.date(fVal[0], o) +' '+this.time(fVal[1], o); } return val; }, // week: function(val){ // return val; // }, //todo empty val for month/split month: function(val, options){ var names; var p = val.split('-'); if(p[0] && p[1]){ if(!options || !options.monthSelect){ names = curCfg.date[options.monthNames] || curCfg.date.monthNames; p[1] = names[(p[1] * 1) - 1]; } if(options && options.splitInput){ val = [p[0] || '', p[1] || '']; } else if(p[1]){ val = curCfg.date.showMonthAfterYear ? p.join(' ') : p[1]+' '+p[0]; } } else if(options && options.splitInput){ val = [p[0] || '', p[1] || '']; } return val; }, date: function(val, opts){ var p = (val+'').split('-'); if(p[2] && p[1] && p[0]){ if(opts && opts.splitInput){ val = p; } else { val = curCfg.patterns.d.replace('yy', p[0] || ''); val = val.replace('mm', p[1] || ''); val = val.replace('dd', p[2] || ''); } } else if(opts && opts.splitInput){ val = [p[0] || '', p[1] || '', p[2] || '']; } return val; }, color: function(val, opts){ var ret = '#000000'; if(val){ val = val.toLowerCase(); if(val.length == 7 && createHelper('color').isValid(val)) { ret = val; } } return ret; } }; var parseVal = { number: function(val){ return (val+'').split(curCfg.numberFormat[',']).join('').replace(curCfg.numberFormat['.'], '.'); }, // week: function(val){ // return val; // }, 'datetime-local': function(val, o){ var tmp; var fVal = $.trim(val || '').split(/\s+/); if(fVal.length == 2){ if(fVal[0].indexOf(':') != -1 && fVal[1].indexOf(':') == -1){ tmp = fVal[1]; fVal[1] = fVal[0]; fVal[0] = tmp; } val = this.date(fVal[0], o) +'T'+ this.time(fVal[1], o); } else if (fVal.length == 3) { val = this.date(fVal[0], o) +'T'+ this.time(fVal[1]+fVal[2], o); } return val; }, time: function(val){ var fVal; if(val && curCfg.meridian){ val = val.toUpperCase(); if(val.substr(0,2) === "12"){ val = "00" + val.substr(2); } if(val.indexOf(curCfg.meridian[1]) != -1){ val = val.split(':'); fVal = (val[0].replace(curCfg.meridian[1], '') * 1); if(!isNaN(fVal)){ val[0] = fVal + 12; } val = val.join(':'); } val = $.trim(val.replace(curCfg.meridian[0], '').replace(curCfg.meridian[1], '')); } return val; }, month: function(val, opts, noCorrect){ var regSplit = opts.monthNames == 'monthNamesShort' ? /[\s-\/\\]+/ : /[\.\s-\/\\]+/; var p = (!opts.splitInput) ? val.trim().split(regSplit) : val; if(p.length == 2 && p[0] && p[1]){ p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0]; p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1]; if(p[1].length == 2 && p[0].length > 3){ val = p[0]+'-'+p[1]; } else if(p[0].length == 2 && p[1].length > 3){ val = p[1]+'-'+p[0]; } else { val = ''; } } else if(opts.splitInput) { val = ''; } return val; }, date: function(val, opts, noCorrect){ createFormat('d'); var tmp, obj; var ret = ''; if(opts.splitInput){ obj = {yy: 0, mm: 1, dd: 2}; } else { obj = curCfg.patterns.dObj; val = val.split(curCfg.dFormat); } if(val.length == 3 && val[0] && val[1] && val[2] && (!noCorrect || (val[obj.yy].length > 3 && val[obj.mm].length == 2 && val[obj.dd].length == 2))){ if(!opts.noDayMonthSwitch && val[obj.mm] > 12 && val[obj.dd] < 13){ tmp = val[obj.dd]; val[obj.dd] = val[obj.mm]; val[obj.mm] = tmp; } if(val[obj.yy].length < 4){ tmp = ((new Date()).getFullYear() +'').substr(0, 4 - val[obj.yy].length); if(val[obj.yy] > 50){ tmp--; } val[obj.yy] = tmp + val[obj.yy]; } ret = ([addZero(val[obj.yy]), addZero(val[obj.mm]), addZero(val[obj.dd])]).join('-'); } return ret; }, color: function(val, opts){ var ret = '#000000'; if(val){ val = val.toLowerCase(); if (val.indexOf('#') !== 0) { val = '#' + val; } if(val.length == 4){ val = '#' + val.charAt(1) + val.charAt(1) + val.charAt(2) + val.charAt(2) + val.charAt(3) + val.charAt(3); } if(val.length == 7 && createHelper('color').isValid(val)) { ret = val; } } return ret; } }; var placeholderFormat = { date: function(val, opts){ var hintValue = (val || '').split('-'); if(hintValue.length == 3){ hintValue = opts.splitInput ? hintValue : curCfg.patterns.d.replace('yy', hintValue[0]).replace('mm', hintValue[1]).replace('dd', hintValue[2]); } else { hintValue = opts.splitInput ? [val, val, val] : val; } return hintValue; }, month: function(val, opts){ var hintValue = (val || '').split('-'); if(hintValue.length == 2){ hintValue = opts.splitInput ? hintValue : curCfg.date.showMonthAfterYear ? hintValue[0] +' '+hintValue[1] : hintValue[1] +' '+ hintValue[0]; } else { hintValue = opts.splitInput ? [val, val] : val; } return hintValue; } }; var createHelper = (function(){ var types = {}; return function(type){ var input; if(!types[type]){ input = $('<input type="'+type+'" step="any" />'); types[type] = { asNumber: function(val){ var type = (typeof val == 'object') ? 'valueAsDate' : 'value'; return input.prop(type, val).prop('valueAsNumber'); }, asValue: function(val){ var type = (typeof val == 'object') ? 'valueAsDate' : 'valueAsNumber'; return input.prop(type, val).prop('value'); }, asDate: function(val){ var type = (typeof val == 'number') ? 'valueAsNumber' : 'value'; return input.prop(type, val).prop('valueAsDate'); }, isValid: function(val, attrs){ if(attrs && (attrs.nodeName || attrs.jquery)){ attrs = { min: $(attrs).prop('min') || '', max: $(attrs).prop('max') || '', step: $(attrs).prop('step') || 'any' }; } attrs = $.extend({step: 'any', min: '', max: ''}, attrs || {}); return input.attr(attrs).prop('value', val).is(':valid') && input.prop('value') == val; } }; } return types[type]; }; })(); steps.range = steps.number; var wsWidgetProto = { _create: function(){ var i, that, timedMirror; var o = this.options; var createOpts = this.createOpts; this.type = o.type; this.orig = o.orig; this.buttonWrapper = $('<span class="input-buttons '+this.type+'-input-buttons"></span>').insertAfter(this.element); this.options.containerElements.push(this.buttonWrapper[0]); o.mirrorValidity = o.mirrorValidity && this.orig && hasFormValidation; if(o.splitInput && this._addSplitInputs){ if(o.monthSelect){ this.element.addClass('ws-month-select'); } this._addSplitInputs(); } else { this.inputElements = this.element; } if( steps[this.type] && typeof steps[this.type].start == 'object'){ steps[this.type].start = this.asNumber(steps[this.type].start); } for(i = 0; i < createOpts.length; i++){ if(o[createOpts[i]] != null){ this[createOpts[i]](o[createOpts[i]], o[createOpts[i]]); } } if(this.type == 'color'){ this.inputElements.prop('maxLength', 7); } this.addBindings(); $(this.element).data('wsWidget'+o.type, this); if(o.buttonOnly){ this.inputElements.prop({readOnly: true}); } this._init = true; if(o.mirrorValidity){ that = this; timedMirror = function(){ clearTimeout(timedMirror._timerDealy); timedMirror._timerDealy = setTimeout(timedMirror._wsexec, 9); }; timedMirror._wsexec = function(){ clearTimeout(timedMirror._timerDealy); that.mirrorValidity(true); }; timedMirror(); $(this.orig).on('change input', function(e){ if(e.type == 'input'){ timedMirror(); } else { timedMirror._wsexec(); } }); } }, mirrorValidity: function(_noTest){ // if(this._init && this.options.mirrorValidity){ if(!_noTest){ $.prop(this.orig, 'validity'); } var message = $(this.orig).getErrorMessage(); if(message !== this.lastErrorMessage){ this.inputElements.prop('setCustomValidity', function(i, val){ if(val._supvalue){ val._supvalue.call(this, message); } }); this.lastErrorMessage = message; } } }, addBindings: function(){ var that = this; var o = this.options; var run = function(){ that._addBindings(); }; if(this._addBindings){ run(); } else { webshims.ready('forms-picker', run); loadPicker(this.type, 'WINDOWLOAD'); } this.inputElements .add(this.buttonWrapper) .add(this.element) .one('mousedown focusin', function(e){ loadPicker(that.type, 'DOM'); }) .on({ 'change input focus focusin blur focusout': function(e){ var oVal, nVal; $(e.target).trigger('ws__'+e.type); if(o.toFixed && o.type == 'number' && e.type == 'change'){ oVal = that.element.prop('value'); nVal = that.toFixed(oVal, true); if(oVal != nVal){ that.element[0].value = nVal; } } } }) ; if(this.type != 'color'){ (function(){ var localeChange, select, selectVal; if(!o.splitInput){ localeChange = function(){ if(o.value){ that.value(o.value, true); } if(placeholderFormat[that.type] && o.placeholder){ that.placeholder(o.placeholder); } }; } else { localeChange = function(){ that.reorderInputs(); if(o.monthSelect){ select = that.inputElements.filter('select.mm'); selectVal = select.prop('value'); select.html(getMonthOptions(o)); select.prop('value', selectVal); } }; that.reorderInputs(); } $(that.orig).onWSOff('wslocalechange', localeChange); })(); } }, required: function(val, boolVal){ this.inputElements.attr({'aria-required': ''+boolVal}); this.mirrorValidity(); }, parseValue: function(noCorrect){ var value = this.inputElements.map(function(){ return $.prop(this, 'value'); }).get(); if(!this.options.splitInput){ value = value[0]; } return parseVal[this.type](value, this.options, noCorrect); }, formatValue: function(val, noSplit){ return formatVal[this.type](val, noSplit === false ? false : this.options); }, createOpts: ['readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'], placeholder: function(val){ var options = this.options; options.placeholder = val; var placeholder = val; if(placeholderFormat[this.type]){ placeholder = placeholderFormat[this.type](val, this.options); } if(options.splitInput && typeof placeholder == 'object'){ $.each(this.splits, function(i, elem){ if($.nodeName(elem, 'select')){ $(elem).children('option:first-child').text(placeholder[i]); } else { $.prop(elem, 'placeholder', placeholder[i]); } }); } else { this.element.prop('placeholder', placeholder); } }, list: function(val){ if(this.type == 'number'){ this.element.attr('list', $.attr(this.orig, 'list')); } this.options.list = val; this._propertyChange('list'); }, _propertyChange: $.noop, tabindex: function(val){ this.options.tabindex = val; this.inputElements.prop('tabindex', this.options.tabindex); $('button', this.buttonWrapper).prop('tabindex', this.options.tabindex); }, title: function(val){ if(!val && this.orig && $.attr(this.orig, 'title') == null){ val = null; } this.options.title = val; if(val == null){ this.inputElements.removeAttr('title'); } else { this.inputElements.prop('title', this.options.title); } } }; ['defaultValue', 'value'].forEach(function(name){ var formatName = 'format'+name; wsWidgetProto[name] = function(val, force){ if(!this._init || force || val !== this.options[name] || this.options[formatName] != this.element.prop(name)){ this.options[formatName] = this.formatValue(val); this.element.prop(name, this.options[formatName]); this.options[name] = val; this._propertyChange(name); this.mirrorValidity(); } }; }); ['readonly', 'disabled'].forEach(function(name){ var isDisabled = name == 'disabled'; wsWidgetProto[name] = function(val, boolVal){ var options = this.options; if(options[name] != boolVal || !this._init){ options[name] = !!boolVal; if(!isDisabled && options.buttonOnly){ this.inputElements.attr({'aria-readonly': options[name]}); } else { this.inputElements.prop(name, options[name]); } this.buttonWrapper[options[name] ? 'addClass' : 'removeClass']('ws-'+name); if(isDisabled){ $('button', this.buttonWrapper).prop('disabled', options[name]); } } }; }); var spinBtnProto = $.extend({}, wsWidgetProto, { _create: function(){ var o = this.options; var helper = createHelper(o.type); this.elemHelper = $('<input type="'+ o.type+'" />'); this.asNumber = helper.asNumber; this.asValue = helper.asValue; this.isValid = helper.isValid; this.asDate = helper.asDate; wsWidgetProto._create.apply(this, arguments); this._init = false; this.buttonWrapper.html('<span unselectable="on" class="step-controls"><span class="step-up step-control"></span><span class="step-down step-control"></span></span>'); if(this.type == 'number'){ this.inputElements.attr('inputmode', 'numeric'); } if((!o.max && typeof o.relMax == 'number') || (!o.min && typeof o.relMin == 'number')){ webshims.error('relMax/relMin are not supported anymore calculate at set it your own.'); } if(this.options.relDefaultValue){ webshims.warn('relDefaultValue was removed use startValue instead!'); } this._init = true; }, createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'], _addSplitInputs: function(){ if(!this.inputElements){ var create = splitInputs[this.type]._create(this.options); this.splits = create.splits; this.inputElements = $(create.elements).prependTo(this.element).filter('input, select'); } }, addZero: addZero, _setStartInRange: function(){ var start = this.options.startValue && this.asNumber( this.options.startValue ) || steps[this.type].start || 0; if(!isNaN(this.minAsNumber) && start < this.minAsNumber){ start = this.minAsNumber; } else if(!isNaN(this.maxAsNumber) && start > this.maxAsNumber){ start = this.maxAsNumber; } try { this.elemHelper.prop('valueAsNumber', start); } catch(e){ webshims.warn('valueAsNumber set: '+e); } this.options.defValue = this.elemHelper.prop('value'); }, reorderInputs: function(){ if(splitInputs[this.type]){ var element = this.element.attr('dir', curCfg.date.isRTL ? 'rtl' : 'ltr'); splitInputs[this.type].sort(element, this.options); setTimeout(function(){ var data = webshims.data(element); if(data && data.shadowData){ data.shadowData.shadowFocusElement = element.find('input, select')[0] || element[0]; } }, 9); } }, step: function(val){ var defStep = steps[this.type]; this.options.step = val; this.elemHelper.prop('step', retDefault(val, defStep.step)); this.mirrorValidity(); }, _beforeValue: function(val){ this.valueAsNumber = this.asNumber(val); this.options.value = val; if(isNaN(this.valueAsNumber) || (!isNaN(this.minAsNumber) && this.valueAsNumber < this.minAsNumber) || (!isNaN(this.maxAsNumber) && this.valueAsNumber > this.maxAsNumber)){ this._setStartInRange(); } else { this.elemHelper.prop('value', val); this.options.defValue = ""; } }, toFixed: function(val, force){ var o = this.options; if(o.toFixed && o.type == 'number' && val && !isNaN(this.valueAsNumber) && (force || !this.element.is(':focus')) && (!o.fixOnlyFloat || (this.valueAsNumber % 1))){ val = formatVal[this.type](this.valueAsNumber.toFixed(o.toFixed), this.options); } return val; } }); ['defaultValue', 'value'].forEach(function(name){ var isValue = name == 'value'; spinBtnProto[name] = function(val, force, isLive){ var selectionEnd; if(!this._init || force || val || this.options[name] !== val){ if(isValue){ this._beforeValue(val); } else { this.elemHelper.prop(name, val); } val = formatVal[this.type](val, this.options); if(this.options.splitInput){ $.each(this.splits, function(i, elem){ if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){ $('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true); } else { $.prop(elem, name, val[i]); } }); } else { val = this.toFixed(val); if(isLive && this._getSelectionEnd){ selectionEnd = this._getSelectionEnd(val); } this.element.prop(name, val); if(selectionEnd != null){ this.element.prop('selectionEnd', selectionEnd); } } this._propertyChange(name); this.mirrorValidity(); } }; }); $.each({min: 1, max: -1}, function(name, factor){ var numName = name +'AsNumber'; spinBtnProto[name] = function(val){ this.elemHelper.prop(name, val); this[numName] = this.asNumber(val); if(this.valueAsNumber != null && (isNaN(this.valueAsNumber) || (!isNaN(this[numName]) && (this.valueAsNumber * factor) < (this[numName] * factor)))){ this._setStartInRange(); } this.options[name] = val; if(this._init){ createYearSelect({elements: this.inputElements}, this.options); } this._propertyChange(name); this.mirrorValidity(); }; }); $.fn.wsBaseWidget = function(opts){ opts = $.extend({}, opts); return this.each(function(){ webshims.objectCreate(wsWidgetProto, { element: { value: $(this) } }, opts); }); }; $.fn.wsBaseWidget.wsProto = wsWidgetProto; $.fn.spinbtnUI = function(opts){ opts = $.extend({ monthNames: 'monthNamesShort' }, opts); return this.each(function(){ webshims.objectCreate(spinBtnProto, { element: { value: $(this) } }, opts); }); }; $.fn.spinbtnUI.wsProto = spinBtnProto; webshims._format = formatVal; })(); if(!$.fn.wsTouchClick){ $.fn.wsTouchClick = (function(){ var supportsTouchaction = ('touchAction' in document.documentElement.style); var addTouch = !supportsTouchaction && ('ontouchstart' in window) && document.addEventListener; return function(target, handler){ var touchData, touchEnd, touchStart, stopClick, allowClick; var runHandler = function(){ if(!stopClick){ return handler.apply(this, arguments); } }; if($.isFunction(target)){ handler = target; target = false; this.on('click', runHandler); } else { this.on('click', target, runHandler); } if(addTouch){ allowClick = function(){ stopClick = false; }; touchEnd = function(e){ var ret, touch; e = e.originalEvent || {}; $(this).off('touchend touchcancel', touchEnd); var changedTouches = e.changedTouches || e.touches; if(e.type == 'touchcancel' || !touchData || !changedTouches || changedTouches.length != 1){ return; } touch = changedTouches[0]; if(Math.abs(touchData.x - touch.pageX) > 40 || Math.abs(touchData.y - touch.pageY) > 40 || Date.now() - touchData.now > 300){ return; } e.preventDefault(); stopClick = true; setTimeout(allowClick, 400); ret = handler.apply(this, arguments); return ret; }; touchStart = function(e){ var touch, elemTarget; if((!e || e.touches.length != 1)){ return; } touch = e.touches[0]; elemTarget = target ? $(touch.target).closest(target) : $(this); if(!elemTarget.length){ return; } touchData = { x: touch.pageX, y: touch.pageY, now: Date.now() }; elemTarget.on('touchend touchcancel', touchEnd); }; this.each(function(){ this.addEventListener('touchstart', touchStart, true); }); } else if(supportsTouchaction && !target){ this.css('touch-action', 'manipulation'); } return this; }; })(); } (function(){ var picker = {}; var modern = window.Modernizr; var assumeVirtualKeyBoard = (modern && (modern.touchevents || modern.touch)) || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase())); webshims.inlinePopover = { _create: function(){ this.element = $('<div class="ws-inline-picker"><div class="ws-po-box" /></div>').data('wspopover', this); this.contentElement = $('.ws-po-box', this.element); this.element.insertAfter(this.options.prepareFor); }, show: $.noop, hide: $.noop, preventBlur: $.noop, isVisible: true }; picker.isInRange = function(value, max, min){ return !((min[0] && min[0] > value[0]) || (max[0] && max[0] < value[0])); }; picker.createYearSelect = function(value, max, min, valueAdd, stepper){ if(!stepper){ stepper = {start: value, step: 1, label: value}; } var temp; var goUp = true; var goDown = true; var options = ['<option selected="">'+ stepper.label + '</option>']; var i = 0; var createOption = function(value, add){ var value2, label; if(stepper.step > 1){ value2 = value + stepper.step - 1; label = value+' – '+value2; } else { label = value; } if(picker.isInRange([value], max, min) || (value2 && picker.isInRange([value2], max, min))){ options[add]('<option value="'+ (value+valueAdd) +'">'+ label +'</option>'); return true; } }; if(!valueAdd){ valueAdd = ''; } while(i < 18 && (goUp || goDown)){ i++; if(goUp){ temp = stepper.start - (i * stepper.step); goUp = createOption(temp, 'unshift'); } if(goDown){ temp = stepper.start + (i * stepper.step); goDown = createOption(temp, 'push'); } } return options; }; picker._genericSetFocus = function(element, _noFocus){ element = $(element || this.activeButton); if(!this.popover.openedByFocus && !_noFocus){ var that = this; var setFocus = function(noTrigger){ clearTimeout(that.timer); that.timer = setTimeout(function(){ if(element[0]){ element.trigger('focus'); if(noTrigger !== true && !element.is(':focus')){ setFocus(true); } } }, that.popover.isVisible ? 0 : 360); }; this.popover.activateElement(element); setFocus(); } }; picker._actions = { changeInput: function(val, popover, data){ if(!data.options.noChangeDismiss){ picker._actions.cancel(val, popover, data); } data.setChange(val); }, cancel: function(val, popover, data){ if(!data.options.inlinePicker){ popover.stopOpen = true; if(!popover.openedByFocus && assumeVirtualKeyBoard){ $('button', data.buttonWrapper).trigger('focus'); } else { data.element.getShadowFocusElement().trigger('focus'); } setTimeout(function(){ popover.stopOpen = false; }, 9); popover.hide(); } } }; picker.commonInit = function(data, popover){ if(data._commonInit){return;} data._commonInit = true; var tabbable; popover.isDirty = true; popover.element.on('updatepickercontent pickerchange', function(){ tabbable = false; }); if(!data.options.inlinePicker){ popover.contentElement.on({ keydown: function(e){ if(e.keyCode == 9){ if(!tabbable){ tabbable = $('input:not(:disabled), [tabindex="0"]:not(:disabled)', this).filter(':visible'); } var index = tabbable.index(e.target); if(e.shiftKey && index <= 0){ tabbable.last().focus(); return false; } if(!e.shiftKey && index >= tabbable.length - 1){ tabbable.first().focus(); return false; } } else if(e.keyCode == 27){ data.element.getShadowFocusElement().focus(); popover.hide(); return false; } } }); } data._propertyChange = (function(){ var timer; var update = function(){ if(popover.isVisible){ popover.element.triggerHandler('updatepickercontent'); } }; return function(prop){ if(prop == 'value' && (!data.options.inlinePicker || data._handledValue )){return;} popover.isDirty = true; if(popover.isVisible){ clearTimeout(timer); timer = setTimeout(update, 9); } }; })(); popover.activeElement = $([]); popover.activateElement = function(element){ element = $(element); if(element[0] != popover.activeElement[0]){ popover.activeElement.removeClass('ws-focus'); element.addClass('ws-focus'); } popover.activeElement = element; }; popover.element.on({ wspopoverbeforeshow: function(){ data.element.triggerHandler('wsupdatevalue'); popover.element.triggerHandler('updatepickercontent'); } }); $(data.orig).on('remove', function(e){ if(!e.originalEvent){ $(document).off('wslocalechange', data._propertyChange); } }); }; picker._common = function(data){ if(data.options.nopicker){return;} var options = data.options; var popover = webshims.objectCreate(options.inlinePicker ? webshims.inlinePopover : webshims.wsPopover, {}, $.extend(options.popover || {}, {prepareFor: options.inlinePicker ? data.buttonWrapper : data.element})); var opener = $('<button type="button" class="ws-popover-opener"><span /></button>').appendTo(data.buttonWrapper); var showPickerContent = function(){ (picker[data.type].showPickerContent || picker.showPickerContent)(data, popover); }; var show = function(){ var type = loadPicker(data.type, 'DOM'); if(!options.disabled && !options.readonly && (options.inlinePicker || !popover.isVisible)){ webshims.ready(type, showPickerContent); popover.show(data.element); } }; var open = function(){ if((options.inlinePicker || popover.isVisible) && popover.activeElement){ popover.openedByFocus = false; popover.activeElement.focus(); } show(); }; var toogle = function(){ if(popover.openedByFocus || !popover.isVisible){ open(); } else { popover.hide(); } }; options.containerElements.push(popover.element[0]); popover.element .addClass(data.type+'-popover input-picker') .attr({role: 'application'}) .on({ wspopoverhide: function(){ popover.openedByFocus = false; }, focusin: function(e){ if(popover.activateElement){ popover.openedByFocus = false; popover.activateElement(e.target); } }, focusout: function(){ if(popover.activeElement){ popover.activeElement.removeClass('ws-focus'); } if(options.inlinePicker){ popover.openedByFocus = true; } } }) ; labelWidth(popover.element.children('div.ws-po-outerbox').attr({role: 'group'}), options.labels, true); labelWidth(opener, options.labels, true); if(options.tabindex != null){ opener.attr({tabindex: options.tabindex}); } if(options.disabled){ opener.prop({disabled: true}); } opener.wsTouchClick(toogle); if(options.inlinePicker){ popover.openedByFocus = true; } else { opener .on({ mousedown: function(){ stopPropagation.apply(this, arguments); popover.preventBlur(); }, keydown: function(e){ if(e.keyCode == 40 && e.altKey){ open(); } }, 'focus mousedown': (function(){ var allowClose = true; var reset = function(){ allowClose = true; }; return function(e){ if(e.type == 'mousedown'){ allowClose = false; setTimeout(reset); } if(e.type == 'focus' && allowClose && options.openOnFocus && popover.openedByFocus && (popover.options.appendTo == 'auto' || popover.options.appendTo == 'element')){ popover.hide(); } else { popover.preventBlur(); } }; })() }) ; (function(){ var mouseFocus = false; var resetMouseFocus = function(){ mouseFocus = false; }; data.inputElements.on({ keydown: function(e){ if(e.keyCode == 40 && e.altKey && !$.nodeName(e.target, 'select')){ open(); } }, focus: function(e){ if(!popover.stopOpen && (options.buttonOnly || options.openOnFocus || (mouseFocus && options.openOnMouseFocus)) && !$.nodeName(e.target, 'select')){ popover.openedByFocus = options.buttonOnly ? false : !options.noInput; show(); } else { popover.preventBlur(); } }, mousedown: function(e){ mouseFocus = true; setTimeout(resetMouseFocus, 9); if(options.buttonOnly && popover.isVisible && popover.activeElement){ popover.openedByFocus = false; setTimeout(function(){ popover.openedByFocus = false; popover.activeElement.focus(); }, 4); } if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){ popover.openedByFocus = options.buttonOnly ? false : !options.noInput; show(); } popover.preventBlur(); } }); })(); } data.popover = popover; data.opener = opener; $(data.orig).on('remove', function(e){ if(!e.originalEvent){ setTimeout(function(){ opener.remove(); popover.element.remove(); }, 4); } }); if(options.inlinePicker){ show(); } }; picker.month = picker._common; picker.date = picker._common; picker.time = picker._common; picker['datetime-local'] = picker._common; // picker.week = picker._common; picker.color = function(data){ var ret = picker._common.apply(this, arguments); var alpha = $(data.orig).data('alphacontrol'); var colorIndicator = data.opener .prepend('<span class="ws-color-indicator-bg"><span class="ws-color-indicator" /></span>') .find('.ws-color-indicator') ; var showColor = function(){ colorIndicator.css({backgroundColor: $.prop(this, 'value') || '#000000'}); }; var showOpacity = (function(){ var timer; var show = function(){ try { var value = data.alpha.prop('valueAsNumber') / (data.alpha.prop('max') || 1); if(!isNaN(value)){ colorIndicator.css({opacity: value}); } } catch(er){} }; return function(e){ clearTimeout(timer); timer = setTimeout(show, !e || e.type == 'change' ? 4: 40); }; })(); data.alpha = (alpha) ? $('#'+alpha) : $([]); $(data.orig).on('wsupdatevalue change', showColor).each(showColor); data.alpha.on('wsupdatevalue change input', showOpacity).each(showOpacity); return ret; }; webshims.picker = picker; })(); (function(){ var stopCircular, isCheckValidity; var supportInputTypes = webshims.support.inputtypes; var inputTypes = { }; var boolAttrs = {disabled: 1, required: 1, readonly: 1}; var copyProps = [ 'disabled', 'readonly', 'value', 'defaultValue', 'min', 'max', 'step', 'title', 'required', 'placeholder' ]; // var copyAttrs = ['data-placeholder', 'tabindex']; $.each(copyProps.concat(copyAttrs), function(i, name){ var fnName = name.replace(/^data\-/, ''); webshims.onNodeNamesPropertyModify('input', name, function(val, boolVal){ if(!stopCircular){ var shadowData = webshims.data(this, 'shadowData'); if(shadowData && shadowData.data && shadowData.nativeElement === this && shadowData.data[fnName]){ if(boolAttrs[fnName]){ shadowData.data[fnName](val, boolVal); } else { shadowData.data[fnName](val); } } } }); }); if(options.replaceUI && 'valueAsNumber' in document.createElement('input')){ var reflectFn = function(){ if(webshims.data(this, 'hasShadow')){ $.prop(this, 'value', $.prop(this, 'value')); } }; webshims.onNodeNamesPropertyModify('input', 'valueAsNumber', reflectFn); webshims.onNodeNamesPropertyModify('input', 'valueAsDate', reflectFn); $.each({stepUp: 1, stepDown: -1}, function(name, stepFactor){ var stepDescriptor = webshims.defineNodeNameProperty('input', name, { prop: { value: function(){ var ret; if(stepDescriptor.prop && stepDescriptor.prop._supvalue){ ret = stepDescriptor.prop._supvalue.apply(this, arguments); reflectFn.apply(this, arguments); } return ret; } } }); }); } var extendType = (function(){ return function(name, data){ inputTypes[name] = data; data.attrs = $.merge([], copyAttrs, data.attrs); data.props = $.merge([], copyProps, data.props); }; })(); var isVisible = function(){ return $.css(this, 'display') != 'none'; }; var sizeInput = function(data){ var init, parent, lastWidth, left, right, isRtl, hasButtons; var oriStyleO = data.orig.style; var styleO = data.element[0].style; if($.support.boxSizing == null){ $(function(){ parent = data.orig.parentNode; }); } else { parent = data.orig.parentNode; } var updateStyles = function(){ var curWidth, marginR, marginL, assignWidth; var correctWidth = 0.8; if(parent){ curWidth = parent.offsetWidth; } if(!init || (curWidth && curWidth != lastWidth)){ lastWidth = curWidth; oriStyleO.display = ''; styleO.display = 'none'; if(!init){ hasButtons = data.buttonWrapper && data.buttonWrapper.filter(isVisible).length; isRtl = hasButtons && data.buttonWrapper.css('direction') == 'rtl'; if(isRtl){ left = 'Right'; right = 'Left'; } else { left = 'Left'; right = 'Right'; } if(hasButtons){ data.buttonWrapper[isRtl ? 'addClass' : 'removeClass']('ws-is-rtl'); } } marginR = $.css( data.orig, 'margin'+right); styleO['margin'+left] = $.css( data.orig, 'margin'+left); styleO['margin'+right] = hasButtons ? '0px' : marginR; if(hasButtons){ marginL = (parseInt(data.buttonWrapper.css('margin'+left), 10) || 0); styleO['padding'+right] = ''; if(marginL < 0){ marginR = (parseInt(marginR, 10) || 0) + ((data.buttonWrapper.outerWidth() + marginL) * -1); data.buttonWrapper[0].style['margin'+right] = marginR+'px'; styleO['padding'+right] = ((parseInt( data.element.css('padding'+right), 10) || 0) + data.buttonWrapper.outerWidth()) +'px'; } else { data.buttonWrapper[0].style['margin'+right] = marginR; correctWidth = data.buttonWrapper.outerWidth(true) + correctWidth; } } assignWidth = $(data.orig).outerWidth() - correctWidth; styleO.display = ''; data.element.outerWidth(assignWidth); oriStyleO.display = 'none'; init = true; } }; oriStyleO.webkitAppearance = 'none'; data.element.onWSOff('updateshadowdom', updateStyles, true); }; var implementType = function(){ var type = $.prop(this, 'type'); var i, opts, data, optsName, labels, cNames, hasInitialFocus; if(inputTypes[type] && webshims.implement(this, 'inputwidgets') && (!supportInputTypes[type] || !$(this).hasClass('ws-noreplace'))){ data = {}; optsName = type; hasInitialFocus = $(this).is(':focus'); labels = $(this).jProp('labels'); opts = $.extend(webshims.getOptions(this, type, [options.widgets, options[type], $($.prop(this, 'form')).data(type)]), { orig: this, type: type, labels: labels, options: {}, input: function(val){ opts._change(val, 'input'); }, change: function(val){ opts._change(val, 'change'); }, _change: function(val, trigger){ stopCircular = true; $.prop(opts.orig, 'value', val); stopCircular = false; if(trigger){ $(opts.orig).trigger(trigger); } }, containerElements: [] }); for(i = 0; i < copyProps.length; i++){ opts[copyProps[i]] = $.prop(this, copyProps[i]); } for(i = 0; i < copyAttrs.length; i++){ optsName = copyAttrs[i].replace(/^data\-/, ''); if(optsName == 'placeholder' || !opts[optsName]){ opts[optsName] = $.attr(this, copyAttrs[i]) || opts[optsName]; } } if(opts.formatMonthNames){ webshims.error('formatMonthNames was renamded to monthNames'); } if(opts.onlyMonthDigits){ opts.monthNames = 'monthDigits'; } data.shim = inputTypes[type]._create(opts); webshims.addShadowDom(this, data.shim.element, { data: data.shim || {} }); data.shim.options.containerElements.push(data.shim.element[0]); cNames = $.prop(this, 'className'); if(opts.classes){ cNames += ' '+opts.classes; $(this).addClass(opts.classes); } if(opts.splitInput || type == 'range'){ cNames = cNames.replace('form-control', ''); } data.shim.element.on('change input', stopPropagation).addClass(cNames+' '+webshims.shadowClass); if(data.shim.buttonWrapper){ data.shim.buttonWrapper.addClass('input-button-size-'+(data.shim.buttonWrapper.children().filter(isVisible).length)+' '+webshims.shadowClass); if(data.shim.buttonWrapper.filter(isVisible).length){ data.shim.element.addClass('has-input-buttons'); } } labelWidth($(this).getShadowFocusElement(), labels); $(this).on('change', function(e){ if(!stopCircular){ data.shim.value($.prop(this, 'value')); } }); (function(){ var has = { focusin: true, focus: true }; var timer; var hasFocusTriggered = false; var hasFocus = false; $(data.shim.options.containerElements) .on({ 'focusin focus focusout blur': function(e){ if(e.type == 'focus'){ e.stopPropagation(); } else { e.stopImmediatePropagation(); } hasFocus = has[e.type]; clearTimeout(timer); timer = setTimeout(function(){ if(hasFocus != hasFocusTriggered){ hasFocusTriggered = hasFocus; $(opts.orig).triggerHandler(hasFocus ? 'focus' : 'blur'); $(opts.orig).trigger(hasFocus ? 'focusin' : 'focusout'); } hasFocusTriggered = hasFocus; }, 9); } }) ; })(); if(hasFormValidation){ $(opts.orig).on('firstinvalid', function(e){ if(!webshims.fromSubmit && isCheckValidity){return;} $(opts.orig).off('invalid.replacedwidgetbubble').on('invalid.replacedwidgetbubble', function(evt){ if(!evt.isDefaultPrevented()){ webshims.validityAlert.showFor( e.target ); e.preventDefault(); evt.preventDefault(); } $(opts.orig).off('invalid.replacedwidgetbubble'); }); }); } if(opts.calculateWidth){ sizeInput(data.shim); } else { $(this).css('display', 'none'); } if(hasInitialFocus){ $(this).getShadowFocusElement().trigger('focus'); } } }; if(hasFormValidation){ ['input', 'form'].forEach(function(name){ var desc = webshims.defineNodeNameProperty(name, 'checkValidity', { prop: { value: function(){ isCheckValidity = true; var ret = desc.prop._supvalue.apply(this, arguments); isCheckValidity = false; return ret; } } }); }); } var replace = {}; if(options.replaceUI){ $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : { 'range': 1, 'number': 1, 'time': 1, 'month': 1, 'date': 1, 'color': 1, 'datetime-local': 1 }), function(name, val){ if(supportInputTypes[name] && val == 'auto'){ replace[name] = webshims._getAutoEnhance(val); } }); } if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){ replace.number = 1; } if(replace.range !== false && (!supportInputTypes.range || replace.range)){ extendType('range', { _create: function(opts, set){ var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); return data; } }); } ['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){ extendType(name, { _create: function(opts, set){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){ opts.splitInput = true; } if(opts.splitInput && !splitInputs[name]){ webshims.warn('splitInput not supported for '+ name); opts.splitInput = false; } var markup = opts.splitInput ? '<span class="ws-'+name+' ws-input ws-inputreplace" role="group"></span>' : '<input class="ws-'+name+' ws-inputreplace" type="text" />'; var data = $(markup).insertAfter(opts.orig); if(steps[name]){ data = data.spinbtnUI(opts).data('wsWidget'+name); } else { data = data.wsBaseWidget(opts).data('wsWidget'+name); } if(webshims.picker && webshims.picker[name]){ webshims.picker[name](data); } return data; } }); } }); var init = function(){ webshims.addReady(function(context, contextElem){ $('input', context) .add(contextElem.filter('input')) .each(implementType) ; }); }; if($('<input />').prop('labels') == null){ webshims.defineNodeNamesProperty('button, input, keygen, meter, output, progress, select, textarea', 'labels', { prop: { get: function(){ if(this.type == 'hidden'){return null;} var id = this.id; var labels = $(this) .closest('label') .filter(function(){ var hFor = (this.attributes['for'] || {}); return (!hFor.specified || hFor.value == id); }) ; if(id) { labels = labels.add('label[for="'+ id +'"]'); } return labels.get(); }, writeable: false } }); } if(formcfg._isLoading){ $(formcfg).one('change', init); } else { init(); } })(); });
sashberd/cdnjs
ajax/libs/webshim/1.15.8/dev/shims/combos/11.js
JavaScript
mit
73,528
/* * # Semantic UI - 1.7.2 * https://github.com/Semantic-Org/Semantic-UI * http://www.semantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ .ui.feed{margin:1em 0}.ui.feed:first-child,.ui.feed:last-child{margin-top:0}.ui.feed>.event{display:table;width:100%;padding:.5rem 0;margin:0;background:0 0;border-top:none}.ui.feed>.event:first-child{border-top:0;padding-top:0}.ui.feed>.event:last-child{padding-bottom:0}.ui.feed>.event>.label{display:table-cell;width:2.5em;height:2.5em;vertical-align:top;text-align:left}.ui.feed>.event>.label .icon{opacity:1;font-size:1.5em;width:100%;padding:.25em;background:0 0;border:none;border-radius:none;color:rgba(0,0,0,.6)}.ui.feed>.event>.label img{width:100%;height:auto;border-radius:500rem}.ui.feed>.event>.label+.content{padding:.5em 0 .5em 1.25em}.ui.feed>.event>.content{display:table-cell;vertical-align:top;text-align:left;word-wrap:break-word}.ui.feed>.event:last-child>.content{padding-bottom:0}.ui.feed>.event>.content a{cursor:pointer}.ui.feed>.event>.content .date{margin:-.5rem 0 0;padding:0;font-weight:400;font-size:1em;font-style:normal;color:rgba(0,0,0,.4)}.ui.feed>.event>.content .summary{margin:0;font-size:1em;font-weight:700;color:rgba(0,0,0,.8)}.ui.feed>.event>.content .summary img{display:inline-block;width:auto;height:2em;margin:-.25em .25em 0 0;border-radius:.25em;vertical-align:middle}.ui.feed>.event>.content .user{display:inline-block;font-weight:700;margin-right:0;vertical-align:baseline}.ui.feed>.event>.content .user img{margin:-.25em .25em 0 0;width:auto;height:2em;vertical-align:middle}.ui.feed>.event>.content .summary>.date{display:inline-block;float:none;font-weight:400;font-size:.875em;font-style:normal;margin:0 0 0 .5em;padding:0;color:rgba(0,0,0,.4)}.ui.feed>.event>.content .extra{margin:.5em 0 0;background:0 0;padding:0;color:rgba(0,0,0,.8)}.ui.feed>.event>.content .extra.images img{display:inline-block;margin:0 .25em 0 0;width:6em}.ui.feed>.event>.content .extra.text{padding:.5em 1em;border-left:3px solid rgba(0,0,0,.2);font-size:1em;max-width:500px;line-height:1.33}.ui.feed>.event>.content .meta{display:inline-block;font-size:.875em;margin:.5em 0 0;background:0 0;border:none;border-radius:0;box-shadow:none;padding:0;color:rgba(0,0,0,.6)}.ui.feed>.event>.content .meta>*{position:relative;margin-left:.75em}.ui.feed>.event>.content .meta>:after{content:'';color:rgba(0,0,0,.2);top:0;left:-1em;opacity:1;position:absolute;vertical-align:top}.ui.feed>.event>.content .meta .like{color:'';-webkit-transition:.2s color ease;transition:.2s color ease}.ui.feed>.event>.content .meta .like:hover .icon{color:#ff2733}.ui.feed>.event>.content .meta .active.like .icon{color:#ef404a}.ui.feed>.event>.content .meta>:first-child{margin-left:0}.ui.feed>.event>.content .meta>:first-child::after{display:none}.ui.feed>.event>.content .meta a,.ui.feed>.event>.content .meta>.icon{cursor:pointer;opacity:1;color:rgba(0,0,0,.5);-webkit-transition:color .2s ease;transition:color .2s ease}.ui.feed>.event>.content .meta a:hover,.ui.feed>.event>.content .meta a:hover .icon,.ui.feed>.event>.content .meta>.icon:hover{color:rgba(0,0,0,.8)}.ui.small.feed{font-size:.9em}.ui.feed{font-size:1em}.ui.large.feed{font-size:1.1em}
jonathantneal/cdnjs
ajax/libs/semantic-ui/1.7.2/components/feed.min.css
CSS
mit
3,282
<?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\VarDumper\Caster; /** * Helper for filtering out properties in casters. * * @author Nicolas Grekas <p@tchwork.com> */ class Caster { const EXCLUDE_VERBOSE = 1; const EXCLUDE_VIRTUAL = 2; const EXCLUDE_DYNAMIC = 4; const EXCLUDE_PUBLIC = 8; const EXCLUDE_PROTECTED = 16; const EXCLUDE_PRIVATE = 32; const EXCLUDE_NULL = 64; const EXCLUDE_EMPTY = 128; const EXCLUDE_NOT_IMPORTANT = 256; const EXCLUDE_STRICT = 512; const PREFIX_VIRTUAL = "\0~\0"; const PREFIX_DYNAMIC = "\0+\0"; const PREFIX_PROTECTED = "\0*\0"; /** * Casts objects to arrays and adds the dynamic property prefix. * * @param object $obj The object to cast. * @param \ReflectionClass $reflector The class reflector to use for inspecting the object definition. * * @return array The array-cast of the object, with prefixed dynamic properties. */ public static function castObject($obj, \ReflectionClass $reflector) { if ($reflector->hasMethod('__debugInfo')) { $a = $obj->__debugInfo(); } else { $a = (array) $obj; } if ($a) { $p = array_keys($a); foreach ($p as $i => $k) { if (!isset($k[0]) || ("\0" !== $k[0] && !$reflector->hasProperty($k))) { $p[$i] = self::PREFIX_DYNAMIC.$k; } elseif (isset($k[16]) && "\0" === $k[16] && 0 === strpos($k, "\0class@anonymous\0")) { $p[$i] = "\0".$reflector->getParentClass().'@anonymous'.strrchr($k, "\0"); } } $a = array_combine($p, $a); } return $a; } /** * Filters out the specified properties. * * By default, a single match in the $filter bit field filters properties out, following an "or" logic. * When EXCLUDE_STRICT is set, an "and" logic is applied: all bits must match for a property to be removed. * * @param array $a The array containing the properties to filter. * @param int $filter A bit field of Caster::EXCLUDE_* constants specifying which properties to filter out. * @param string[] $listedProperties List of properties to exclude when Caster::EXCLUDE_VERBOSE is set, and to preserve when Caster::EXCLUDE_NOT_IMPORTANT is set. * * @return array The filtered array */ public static function filter(array $a, $filter, array $listedProperties = array()) { foreach ($a as $k => $v) { $type = self::EXCLUDE_STRICT & $filter; if (null === $v) { $type |= self::EXCLUDE_NULL & $filter; } if (empty($v)) { $type |= self::EXCLUDE_EMPTY & $filter; } if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !in_array($k, $listedProperties, true)) { $type |= self::EXCLUDE_NOT_IMPORTANT; } if ((self::EXCLUDE_VERBOSE & $filter) && in_array($k, $listedProperties, true)) { $type |= self::EXCLUDE_VERBOSE; } if (!isset($k[1]) || "\0" !== $k[0]) { $type |= self::EXCLUDE_PUBLIC & $filter; } elseif ('~' === $k[1]) { $type |= self::EXCLUDE_VIRTUAL & $filter; } elseif ('+' === $k[1]) { $type |= self::EXCLUDE_DYNAMIC & $filter; } elseif ('*' === $k[1]) { $type |= self::EXCLUDE_PROTECTED & $filter; } else { $type |= self::EXCLUDE_PRIVATE & $filter; } if ((self::EXCLUDE_STRICT & $filter) ? $type === $filter : $type) { unset($a[$k]); } } return $a; } }
indigo423/ouce-website
vendor/symfony/var-dumper/Caster/Caster.php
PHP
mit
4,048
/** * selectize.bootstrap3.css (v0.7.1) - Bootstrap 3 Theme * Copyright (c) 2013 Brian Reavis & contributors * * 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. * * @author Brian Reavis <brian@thirdroute.com> */ .selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder { background: #f2f2f2 !important; background: rgba(0, 0, 0, 0.06) !important; border: 0 none !important; visibility: visible !important; -webkit-box-shadow: inset 0 0 12px 4px #ffffff; box-shadow: inset 0 0 12px 4px #ffffff; } .selectize-control.plugin-drag_drop .ui-sortable-placeholder::after { content: '!'; visibility: hidden; } .selectize-control.plugin-drag_drop .ui-sortable-helper { -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); } .selectize-dropdown-header { position: relative; padding: 3px 12px; background: #f8f8f8; border-bottom: 1px solid #d0d0d0; -webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0; } .selectize-dropdown-header-close { position: absolute; top: 50%; right: 12px; margin-top: -12px; font-size: 20px !important; line-height: 20px; color: #333333; opacity: 0.4; } .selectize-dropdown-header-close:hover { color: #000000; } .selectize-dropdown.plugin-optgroup_columns .optgroup { float: left; border-top: 0 none; border-right: 1px solid #f2f2f2; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .selectize-dropdown.plugin-optgroup_columns .optgroup:last-child { border-right: 0 none; } .selectize-dropdown.plugin-optgroup_columns .optgroup:before { display: none; } .selectize-dropdown.plugin-optgroup_columns .optgroup-header { border-top: 0 none; } .selectize-control.plugin-remove_button .item { position: relative; padding-right: 24px !important; } .selectize-control.plugin-remove_button .item .remove { position: absolute; top: 0; right: 0; bottom: 0; display: inline-block; width: 17px; padding: 1px 0 0 0; font-size: 12px; font-weight: bold; color: inherit; text-align: center; vertical-align: middle; border-left: 1px solid rgba(0, 0, 0, 0); -webkit-border-radius: 0 2px 2px 0; -moz-border-radius: 0 2px 2px 0; border-radius: 0 2px 2px 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .selectize-control.plugin-remove_button .item .remove:hover { background: rgba(0, 0, 0, 0.05); } .selectize-control.plugin-remove_button .item.active .remove { border-left-color: rgba(0, 0, 0, 0); } .selectize-control { position: relative; } .selectize-dropdown, .selectize-input, .selectize-input input { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; -webkit-font-smoothing: inherit; line-height: 20px; color: #333333; } .selectize-input, .selectize-control.single .selectize-input.focus { display: inline-block; cursor: text; background: #ffffff; } .selectize-input { position: relative; z-index: 1; display: inline-block; width: 100%; padding: 6px 12px; overflow: hidden; border: 1px solid #cccccc; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: none; box-shadow: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .selectize-control.multi .selectize-input.has-items { padding: 5px 12px 2px; } .selectize-input.full { background-color: #ffffff; } .selectize-input.disabled, .selectize-input.disabled * { cursor: default !important; } .selectize-input.focus { -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); } .selectize-input.dropdown-active { -webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0; } .selectize-input > * { display: -moz-inline-stack; display: inline-block; *display: inline; vertical-align: baseline; zoom: 1; } .selectize-control.multi .selectize-input > div { padding: 1px 3px; margin: 0 3px 3px 0; color: #333333; cursor: pointer; background: #efefef; border: 0 solid rgba(0, 0, 0, 0); } .selectize-control.multi .selectize-input > div.active { color: #ffffff; background: #428bca; border: 0 solid rgba(0, 0, 0, 0); } .selectize-control.multi .selectize-input.disabled > div, .selectize-control.multi .selectize-input.disabled > div.active { color: #808080; background: #ffffff; border: 0 solid rgba(77, 77, 77, 0); } .selectize-input > input { max-width: 100% !important; max-height: none !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important; line-height: inherit !important; text-indent: 0 !important; background: none !important; border: 0 none !important; -webkit-box-shadow: none !important; box-shadow: none !important; -webkit-user-select: auto !important; } .selectize-input > input:focus { outline: none !important; } .selectize-input::after { display: block; clear: left; content: ' '; } .selectize-input.dropdown-active::before { position: absolute; right: 0; bottom: 0; left: 0; display: block; height: 1px; background: #ffffff; content: ' '; } .selectize-dropdown { position: absolute; z-index: 2; margin: -1px 0 0 0; background: #ffffff; border: 1px solid #cccccc; border-top: 0 none; -webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px; -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .selectize-dropdown [data-selectable] { overflow: hidden; cursor: pointer; } .selectize-dropdown [data-selectable] .highlight { background: rgba(255, 237, 40, 0.4); -webkit-border-radius: 1px; -moz-border-radius: 1px; border-radius: 1px; } .selectize-dropdown [data-selectable], .selectize-dropdown .optgroup-header { padding: 3px 12px; } .selectize-dropdown .optgroup:first-child .optgroup-header { border-top: 0 none; } .selectize-dropdown .optgroup-header { color: #999999; cursor: default; background: #ffffff; } .selectize-dropdown .active { color: #ffffff; background-color: #428bca; } .selectize-dropdown .active.create { color: #ffffff; } .selectize-dropdown .create { color: rgba(51, 51, 51, 0.5); } .selectize-dropdown-content { max-height: 200px; overflow-x: hidden; overflow-y: auto; } .selectize-control.single .selectize-input, .selectize-control.single .selectize-input input { cursor: pointer; } .selectize-control.single .selectize-input.focus, .selectize-control.single .selectize-input.focus input { cursor: text; } .selectize-control.single .selectize-input:after { position: absolute; top: 50%; right: 17px; display: block; width: 0; height: 0; margin-top: -3px; border-color: #000000 transparent transparent transparent; border-style: solid; border-width: 5px 5px 0 5px; content: ' '; } .selectize-control.single .selectize-input.dropdown-active:after { margin-top: -4px; border-color: transparent transparent #000000 transparent; border-width: 0 5px 5px 5px; } .selectize-control .selectize-input.disabled { background-color: #ffffff; opacity: 0.5; } .selectize-dropdown, .selectize-dropdown.form-control { z-index: 1000; height: auto; padding: 0; margin: 2px 0 0 0; background: #ffffff; border: 1px solid #cccccc; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); } .selectize-dropdown .optgroup-header { font-size: 12px; line-height: 1.428571429; } .selectize-dropdown .optgroup:first-child:before { display: none; } .selectize-dropdown .optgroup:before { display: block; height: 1px; margin: 9px 0; margin-right: -12px; margin-left: -12px; overflow: hidden; background-color: #e5e5e5; content: ' '; } .selectize-dropdown-content { padding: 5px 0; } .selectize-dropdown-header { padding: 6px 12px; } .selectize-input { min-height: 34px; } .selectize-input.dropdown-active { -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .selectize-input.dropdown-active::before { display: none; } .selectize-input.focus { border-color: #66afe9; outline: 0; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); } .selectize-control.multi .selectize-input.has-items { padding-right: 9px; padding-left: 9px; } .selectize-control.multi .selectize-input > div { -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .form-control.selectize-control { height: auto; padding: 0; background: none; border: none; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; -webkit-box-shadow: none; box-shadow: none; }
szimek/cdnjs
ajax/libs/selectize.js/0.7.1/css/selectize.bootstrap3.css
CSS
mit
9,940
/* * # Semantic UI - 1.7.2 * https://github.com/Semantic-Org/Semantic-UI * http://www.semantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ *,:after,:before{box-sizing:inherit}html{box-sizing:border-box}input[type=email],input[type=password],input[type=search],input[type=text]{-webkit-appearance:none;-moz-appearance:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}
fchasen/jsdelivr
files/semantic-ui/1.7.2/components/reset.min.css
CSS
mit
2,218
(function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['exports', 'echarts'], factory); } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { // CommonJS factory(exports, require('echarts')); } else { // Browser globals factory({}, root.echarts); } }(this, function (exports, echarts) { var log = function (msg) { if (typeof console !== 'undefined') { console && console.error && console.error(msg); } } if (!echarts) { log('ECharts is not Loaded'); return; } if (!echarts.registerMap) { log('ECharts Map is not loaded') return; } echarts.registerMap('云南', {"type":"FeatureCollection","features":[{"id":"530100","geometry":{"type":"Polygon","coordinates":["@@FKCQEGAGDIBQBCHIFMBCCEFADG@G@OHQ@EHIAGBO@OBCDCACBEAINc@MHO@OFEHS@GBKAC@EFG@GAAEAAEAUBIDELGFOFCAEFE@CECDEEICOAE@IDGCGJGPEFIRIJ@NHJ@BGCYBIFELATADC@CEC@ALODKFEHANDDFIL@FJNL@JEP@H@PMHKRGJINI@GBCNGDEBCEEGGAIGCG@CC@CRETO@CBQEIAMFKFGLIDGDW@CHBJGJICGBAJ@BGFIRI@CNQ@IIKISOWKc@ICEBIFGBEBAFA\\@BEACMAIEBEHEBGEAE@CAAM@EDGFCXE@@AKCKBCEMDEHI@CGEAGA@FKBCIAA@ABC@EEEK@KDQDENEBCAAMAAA@ADEGC@ETDHCPKI@EEN@BABG@ADDDABCFBDDPJBFIJDDVBRAFEJEDIHA\\RHDV@@EGKAI@EJIVITAPBFD`VFJBFAFBDHDBHF@J@H@FHLEBEHC@KDO@KACIKCG@CJKHCD@ZVFBLGDBCH@HJEBOF@BACODGFCHAHBFDFFLDFHRBHGDGAGKG@EDCHCFELMDEAIUSCECAO@CASSIA@GGGAAFOBCRIDIHI@AMODG@COCEAII@AHE@GC@AAJIBICEGEAGIQEESKCMFKGQBOXOBQTCPJH@LIBCAGDAHAJQHGSECE@KY@IDA@WUKCOIQCcDEHKDM@OPKPGDI@E@EGCGBCLGJSFEBEAEKOMMAGBILEDELG@A@GGG@MACGCBOCEEAKJGBMBCCCIEAC@GLA@E@KFCAGGGCAD@FABGMGABE@GIC@@@AHC@A@IHEFIDE@CMIICGGMG@A@IKMWKw]GGAOIGAE@KKMAEAEGAECACBEAII[H@DDJ@DADGAGLKFCJAFDFBN@NCBC@ACECKCAECE@CBA@AIFC@EG[KIK@CGAKFEFIBICAMBGEQ@AIIS@GO[CQFAH@BCLABADADBRKBBDDVGEABCAABIICACECBKNCHGN@HGBQBGAECCCG@GFEHCRKD@BLDLAL@JBBJFHBbCb@N@NGLQJE@HBBD@LEDB@DCHDBBBIHFFD^HDHBFLDBH@FETG@FNBFKJAJBBA@AFAB@DDFBBKDEDMIQCEbY@CACKE@EGM@EDGDCP@HARODE@QEGECC@GDK@KEIEGIGGCEEAODK@eG[S@]BCFCN@NEJIBCDALGDCBE@AEACA@CFCPE@MBCFCRGAGJG@EFIBQDCNA@CCADC@ASICC@IBOAEBKE@IQEACAEAKBCGJEFI@GAE@QEO@CLGPGDGHU\\IBEAM@EBAD@HIEKBAB@FBDBJEBGHBDAJBPABCFBF@AJD@HAFBFJDHDFF^FDHBFADCFIDCLCFINAFBDjH\\LNRBHABEBMDEP@\\NZBLCHCNKFMCcG_BWRWFO@M@ICEOQFIHKBEBENG@CACK]IM@CLKDEAACKKMCQGIEIECKYECGS@CBCNIAKEGSKEOIK@EVGBG@IGMIGIIaUGGCGOEEKECQEECEIEAiACGBGACBGACCCGSKKQCCIGJOFCACOOKIEaKE@@HKJWFAH@BFDN@TDXVBF@DCBMFGD@D@DHJ\\HDDABABQ@SDUCABCFCBMB@DFFCDKAEAE@SFKFEDEH@DQPEDE@IJE@KJCFE@CAM@SN@FADODK@E@@DDD@BABMLSJAD@DCBKB@DDBADABIBAAAECCECE@CDKJMRIDGBECAC@MBC@GOCCACIBEHCLAFEBCEI@CBC@OGC_HEAAKBUCEMEAC@AJCJWBKDM@EEIMIKCCEGEGEAKBAFBBAACCAAEDALCDC@CACECKAQFSBCBCRC@IEOB@D@LADCBIEGKEAGDCDG@EMCAGFC@ACHGACGAGHCPILKDEAIEKWCCGHIBMEMMADAVBHFL@LBJ@NBRAJDDADEBSEGGG@IKI@E@KHKCGBSAGHGPGBBH@FEHBDHH@FCFAFDRGD@DABEBBJEH@FD@BBAH@JGVB\\DHBJDFAFFT@LJP@H@DFFLBBHFFHTDL@FFF@HDD@HHNBHFHGLKFG@QAQRCBEAGMEEEEGGGDIFEFCNDL@XDNAFLDDDAZJ\\CLEHFHBDDT@JDNGTALIRERQNCRIPA@AoGOGESGOFADEDECCBAA@QACAEEKCABIE@KDCAI@KE@OCAIH@MEGC@ADBLCD@HCDEDCAKKCQAYNC@AGEKCACASCCDG@IHEFKAQBALEDCACGE@CBI@AAAK@OEAMGAACM@CCAKCKKGE@@BCPABCBIBGBg@CI@CFEDMJKJOHWEOKSOGCCGMIGAAAWIM@UAEEGECQCCA@CDCLK@KDGACIAAGGEDEACKAAC@OFC@EKaMUAG@IHCBCGI@CDCLGDG@EPKN@FA@CUGMGI@ACCKICG@GFC@KKCIEKAEKIG@K@CB@DDD@JKFM@AACKEASMI@]EIKCBEHC@KJANABADBLHBDD[XEB_@GCCGCAO@MASGO@C@GBMNKACDKDABBDJFLDLBJFEDODFHAJCF@JIFKDUIOBIFAAIIOICGECI@CABOE@K@MFEFI@ADBFFDH@BDADCBUEEGAC@CECGSGCMKOAIFED@HGAODQJGASA@EHIBE@CIEUS@ECEMEEAEBC@EA@@@RGJALCBGCIBE@MQGKC]@KISECWGEEBKFEF@NDH@@GAAGBECCOCGAGBGDEBCCAEKGACFEBG@ICM@UMICCC@CECEBGLILEBGBAHEFPHLJ@BGJAFCDGFIAEBKJKDM@IDEFE@QCABFHADMZEHWNY\\QC@DGLCXINBDZCBFTLPPBF`FJFDH@JBFNBHDDFFHGFDFHCDADAJBHDJXLHDbGJALAVCJBFCHY^KVBFBDZ@LFFFMRAVCNHDDLFDBNGFAHHJFrBRFF@DKRAPFJADIFCD@PADBDAFBDAFTD@TELIJDB@BHH@BBBDBABBBENFPKFCFBFF@FD@BIHCDBHDJBFGFI@G@ECC@QLEHAHEP@HDFFHBLCFGBGAIASMGCIBIC@DEDCF@JDNLR@FRRDFBHDH@BDHFDCDAFFLALIDM@EBCBEJBFDDCHQCCC]IIBMHCJ@JADEFKLABFNBFAZCDEBEFEN@D@DHJDLRNDF@D@HFDV@BCAK@GCMDEHGHALDD@NCTO@IGSBAHEN@VDZLRNPBFJJFZXF@JCFENAJ@FAPBFADCD@BB@DFHDDDBBBAJDJBDCPJRDDHBDNFH@FIJBP@XAHCFMCABADPLJVDRPfZ^FJBBDAPEL@DBIH@NJNJF@FFV@HCHQR@RDN@FG@_MIAG@GFCHBnKNILAHDTBFFFBJQFGJKHABBFTHBD@JEPTbFDN@FIRIBOHELAJ@NHP@`TBDCHFD@FIHAF@DDDFBBA@CBADJNBDFFHDBJDAD@XDBDHHLHDBDEN@DDDTAARH\\CREL[NEHAHDJANFREFMBKJAFDLCHDHCNDBJFDRAREDE@UEMKCBINEPGDGAG@ONCFCPCDS@GDADC\\CJEFMACD@FFRLLLRA^@HJXIL[VQRENEF@ZBFNHBB@NAP@T@FHPFBTBFBBDGLAJBHGABHFHHVCRKLKHKFOLIBY@KJ@FBNER@NGH@LPTP@BBKFGJ@DCD@TBDHDLDDDBLIJWHCD@TFDGPBFLPNZBJANEJBFFDBDAH@BHFFJBFCLFPAF@DFDDD@FAHCDBBJBDBILAF@LCDSLKBEAE@KHGBCFCNGFKHCFMFKDONMDKFEDEB@DFFADBRGLUP@REH@FCFKLAF@BJHBDDLB`DFTJNBTAX@RDNHZBFJZJJBPJNDDBXZLRRRJPDLRNFBN@DBVDbALBdNXJHB\\LPJXBJDlLRHFHDNBTFFFD^DJATMZMVCLEVARMDIFQDIDO@GCCMIeaCMC]GKCI@ARGX@DIVMPGVGJEBCDEDOPGLAVFVLF@DGN@NFDDDFDLA^DJPZPLDHAFBBPFPBLBHJJRFFPJHF`HH@NDZ@RDB@FLPHLHHPPLJJFTJNJTD@FIJE@EEK@EHKHCXFX@DANKHFZF\\@dBTJLN@NDLLL@DELGdEP@PDPBXFRFNBFARM\\AP@DZDZCL@LFJBV\\@LDLPDHTBHE\\HAHI"],"encodeOffsets":[[105536,27172]]},"properties":{"cp":[102.712251,25.040609],"name":"昆明市","childNum":1}},{"id":"530300","geometry":{"type":"MultiPolygon","coordinates":[["@@IAABBJLN@LCHEFKDIHCHIJCJBJLLHVBPPNDTHXGN@DRPFFHNBNDHFBAHBB@TCDSFCF@DDFHAFCVADFDD@JFXDFLHDFDJBHDHDNBNGN@DLL@JMTEFKHMDADDHJHDEHAHADAFGPMHAL@FBBDD@PJFBDBLRDBLAJBD@FABGDCTILCNBNNRBPBJFVEJEBKBAREbCFBVBFDDF@HAJBFHBJ@PLDBHAZRHBDFAJBDTNLRFFB@P@L@bCJIBGBEPKFGPOBEAGDMDETUFQLUBGAK\\QNEHK@IAKWeCSHMBUHKLGDICACIGEE@M@MCCEMAECYCICGE@CDMAGMMCAG@EA@A@CACAMEEBMDYFCFQHIDCFG@EASBEJGAGBOLMJGBEJAHCFABBHHHHJHHAFE@EFI@CBI@CISBKAGIGGI@CBSCWFIAEBQOUGQAIDEVOHOJEAEDGCGCC@EEA@CB@FELEJGPEJABCF@@CH@DCD@AEF@HIBEJABAEEBCAC@GFE@KBBJCAAAB@ABCFBDAJBF@HDB@D@DAD@FEFIDALAFGBABEFADBB@JBDBH@LDJ@DCF@B@DALBZCRHnFNDPCTGLDLCJDJDJBDAHKHCL@ZD`@FCFIH@FBDDJDDDDBBAFHFD@BBD@BC@@D@PCJBFCFBFEHALAFBHHJ@DA@@HFDBAJHFDDDBDFBBHFDBDFDADFDBHNF@F@HHFBDDFF@ADFJJTPLZCPBFHL@F@HGHCJKLBHAFFJ@BA@EFABCPIDAFBPCLGHBJCDHLHDAFBNAHEFIDBLCF@FDDBBH@P@BTBPARENM@Q@ALAFBB@HBBDD@JFL@HBFAHBHABDHAFHFLFBBDAFFPDBF@DDH@HDDJABDDAFAHJNFB@HFDBFLLANDFCLBF@FBBBBL@BDFBD@HEJFFGAGBCF@DEJCBG@CHCFEDIEIBCBEHEVK@EFABKJABA@EBGEM@CCEBCEEAIAABGAIAEBE@IJOHGNKD@PKF@NJBFLDH@FEFBN@HAR@JAHBHCFDF@BFJBTIBCLIBE@AAKFAJ@@IDKGIGKCKECAKDOFALD^EFEF@JEFGLGD@FKFC@GTODGHGDG@CAAESCCACBQBCFEFKFEHAHBJCF@PEAGBE@KACFMDIIK@GJK@GDCTOFAACBKACEGCAC@KDCAOKCGAEBC@IBE@IACKAIE]CW@OK[COGEKIICGAC@IACIGIGCGWMScIGBS@CFMDMHCBAEIAIKAEECGDKAIKQAKGMOKCG@KAKBEAOBWHKHGBK@MCGBIOYECKCGCACBEAACEGCM@EFUHEFKDAFCDOCGQBILCDELOFK@IEKAQCEIAH]HKGGAMECAMBG@ACGGEQYAEEECG@M@CFADEAGKC@KCGIEGGI@GCGECG@GFOBMDCD@LJFBFCDCAQDABOHI@AYWK_BGFIHO@GEEMEIGI]GAIDBWGiCIM@K_CESUEAIAIHOJABBLC@ULKJEDCDA@AAEM@GFQ@EIGAC@ADICG@GD[EKAKEGAGBG@EEMBG@AKEACFYRGF@BABA@AKKEAEBAAJM\\WDKEG@CDGHCZDLAHBF@NGDECIBIEIAABAFBDHJFLDFFHJBBRCFEXIRANQBAACGIAGVQ@GCMHOCMDSI_YIDEJCJK@GAQLGF@FB@JD@HCDN@PBHBDFBDCF@D@XAX@JHJFLLH@HDFHDDDHBBBDFB@DBADBBDD@FE@CLABD@BFEDEH@FEB@@DADED@D@DDDBDFBNIBAGQFWIc@WCGIIAG@QDO@[C[IOBIBCFCJ@JKFAH@NRL@HCBGBALCRI@CCC@AFAFEDEBCZMFGNBJAJBHAHCLKEGFKDM@CCIBMAUJIDKCCUGAABE\\KF@JIF@JD@LDBT@RFNAHEDHHABB@GFCAQREXIHGDCZERB@DEDDFABADNBJ@LGJAFCR[HEH@HFLNL@HAJMNcACQCOCEKD[HSFGMM@C@CBGHIRO@CMG@EFCGICJOBIFMNOTOHGRQZKFKJEBEAGEEICAI@CAGKGE@GHALMBSAECGIEAGMOAWGCCGKEUSBECKASGIGGBICG@KBGICEGMGqIg@OAEC@ABAPBHCNARBRFTAHBLAFAPCHKNKLKAKJO@KDOLMBKMGC@GBECEEG@ECECAEBCFG@AOGKAGGIAAAAEBIAMACIEGGCA@C@GEIKKGKG]CCKEGEGCSAIIQGQWO[IE@ABGIMEEKCAGMKAEGAECAIKK@IDEGM@G@AHIAMJG@CIQ@IDE@GEGIECIGI@CBKSIAMGMAOKUGC@CAE@KCMGQOWUCEACCAGEEEACASHI@AGBCLCD@BADAACB@VFDHBLFBPADG@EBA^MDC@CC_BK@GCK@IHED[HGFKBMBG@GDODEAEHABABCFAD@FHB@BEJIDGLCBABGCKKAAEHIDQAEHEBEDGFGVGE@GIEQCECCKAI@I@ODEBCAAIBEHOAGE@GDMBGDIDYCQ@YGA@CHQAKGMCGCE@IG_IBK@GECG@ACFKLM@OKIG@U@QEW@UCIDOAQI@QGCaCMKCAMDIAMOE@QHKNOLIDI@GAEGAECAADEAIGOLC@U@AHKCEIC@EDEJBL@JTNRX@HCFEFGJGLOHUhOPEFEDCHEB]E_KI@ALGDEBGGKEYEgSG@[IeSO@C@EHELKFGNGBUJMDFND@FCF@@HGLOHCJBFAFBHBBHAFJJBPLH@FADBANBDJFGBFHER@NCBE@ECEBEH@D@HWdIJGBGIABAHAFEDINCJALYE@NCJBHDHN\\LDJDBFBDAFCFIB@FBHKBEDBHDH@HAFEFQHIAIGCIEUGCOD]T@FDDHBBB@NKLSJIBMAIGIAKBQH[ZC@GFIDMCCB@DLNBDA@QIM@CBUhIDGBCBCHEDBHGAC@ABKIICCD@FIB@DBD@BQOQWAM@OIACCBEIA]JMJONOHG@@DHNFRFFDHH@JMB@@PPLFRDRADABE@ECYUG@OF[@MOEG@EIEEAC@@FEDI@EACCGOIKCFKL@DJNFPFNBHMHAFAFGLEJPRDF@J@NEPQXAXH`DdENMLGDKDYA[MO@CFANAFGBQAKMG[CiEAMBEJKDCDEJCDEBGAECE]CECGEIEAGBC@BIE@EAADOBIACBGAAHIFCAEAA@ABFLGJC@AB@FBNAF[JGVCHOHKH@DFP@RBF@HEJIFDHLAFBDBFBJRF@ALBFAP@JDDTJ@BCDDB@DMBCDAREJ@FIHBHQHEDAD@NOFED@DDBFB@BAFCDKHCBADIJMFM@EDAD@^\\TfHL@PCFBDFHHHJJFLFL@HCD@FDFH@RCFQPGBO@CDCH@FHN@FLFBD@DaZDFJRCNCFALEACCA@EB@BABIAIBELMA@ESHEFG@CAEKGAGCC]EEJGAACADG@CCAKFC@AA@GIFKRMHM@a@aDGAIEAA@IBKCKAKC@QLGDEF@HDHDDBFAHARGHM@GHMDALFDBDJDAJBBADFBUHCCAAQLCACBABKBADG@EBDRP\\@HJTBJR@HFNADBAJEJEFBLDHL@LJH\\@FEDBJB@DAF@FDDBDLDF@BADMDM@EAECIBEDKLBHCHCBI@CCG@J\\BJAFBDFDHBBFBFLN@LBFJHBPHHx^XLLN@J@BNHHHJDNJ@DCFEJGF@J@BGD@B@@JD@HAFHBHNBA@EBCHDHHDBLEF@B@HKD@FBDJDDNAHALIFBDFAPHDBD@NHH@H@BKHCFKFAJBHNNLPBFAFEFITKHADDHFHF@J@HCLOPON@LCFGdCRDPJLDXVB@JCZ@@LDFTFGHIRGBCBBHADKJG@OISDARWPAPHRELDNTLFFJRBHHFDFAJIJBBD@@HGF@BJJFBPD@DCHNP@BGJCJQJADEPBBHH@HJBTTDBP@DBDFVTBHCHKNEFGDCD@FLHBHCHEFKBGAEGKCEEECGAGBEDCHDPABE@APIF@GDGCAKHEAYUC@GDIL@DDHJLBD@LCP@LGDAFKFEGG@I@E@AGGCACBEAEEI_UECOASBUJIJ@FBJHL@FU@GC[QGBCJIFEFQBUACCJIAEOICCEAADCBCC@BAHABM@FFJ@OLGDSC@FHDCF@BBBNBBBADMFCFCR@LFLFFD@BAB@JBADELB@BHHF@DGJCFFNADDLBL@@WFEDCH@FBNDBF@FBAHGFAFJFNBBDAF[@EBABAFEHAJDF@JLdPXJTJL@JMR@DQJEJAHI@ABDHIJIHGA@DCXCHKJEHELBNFJAR@DSPQF@DDDH@HDBJHHFFADCFMHAD@HMJIJQHGLONG@O@IFK@IM@EJKCEMCGBEFCLKP@BFD@DCDSBKBEFAJDZAHI@MGI@QJEJOFIHDHCH@JBFDPFJCFFD@DEFBFEDEPKHCHAL@PDHFBBB@HEH@FBDAL@HGTEF@PGP@NMdBJAFBDCDAD@PAPBHGJ@FGR@P@HCHEBDFADENGJCVCJBHFHDRELHCTFTBADCBQCI@EBCHAHBV@PBFHHDFEPBXCDC@CDBBZL@DGD@DDDFBNBHGFBJDXNFNALHBLFPANGJ@BERGD@PGNCDCDID@BCtNZRHFBFADGN@BFFH@BFDDJJANMP@DDDH@DDBB@FBFNRLH@DIHCFHZ@JJHH@VEJAHLHB\\@VEFBDDBNBBJGDKHEFAXMJCJ@FBTNHNLHNFL@FABCESBMJCLARCJEH@HDDFAHULAD@DFDDB@DIB@BLDJBHB@BQ@MCEFC@@ADC","@@DED@@AKAED@D"]],"encodeOffsets":[[[105872,27378],[105872,27378]]]},"properties":{"cp":[103.797851,25.501557],"name":"曲靖市","childNum":2}},{"id":"530400","geometry":{"type":"MultiPolygon","coordinates":[["@@BBJ@FCDCCAO@GCCKIGICG@@DBDJHD@HFNN","@@JIFK@SSCBEACBEACBC@KDGJEBCEIBOLQ@CEEAQEqGIBGHEAMECCKGCDMBUNQEEKEY@ACAELUZ]DGAEDIBUBKHICaKGIWGCIACBCBGDCEHEEGCEGCMAAE@ICGIE_EAEOOSKAEYDACJMDWHK@CRDZ[XMFGNYBCEGBARDF@FEJCN@LCLIFAJBHEDCBEHI@AKIOGFEBGHAFAJKHKFAFD@DDDJDVNN@JDH@FADEHBFLDBADCFAHBHDHDPFDHABB@HG@MCE@EFALFFXHFDJT@LD^V^F@JAHDDABKHI@Q@@FBD@FAFBNFDF@FVTJF@DAFGJ@FTBHBRIPCHB@GFCJEPBNLHDHTFD@DBDFHVFDABCACG@ECAEBCJ@FENEL@F@APDBJ@FDDHPJJJBBJEPAVJLCJE@IDEBIEGPCFCIEKAKCIEACBALCDCLBNMHAD@P@THNBP@DBDHHD`@FA\\WCCGAAKBCBABMLID@FGDAJL^FJ@TNFBDLBBN@LE@ICC@CDAL@H@LJBFFLDJLLD@HEH@JDDLBDJ@NHVH@DEBM@OL@FCHKHCD@DHJADGD@JBHNVLb@FED@PBDLBBDCFHFBHJBBDCH@LKLCD@DDBRDFDFHBF@VJNBXBBJHHNDDPHLTFPGXIPILCNEF@DDJh@HAJADABADO@AF@LHDLBLDDN@BDHBBNPFL@BB@BAJ@DHFBDCDKFABBRELGF@JCHDDBTBDLDHF@BMDBZDRLLDBFCDC@GDCAKBCD@FH@NJGDB@PLFJ@DBLCF@AJDBFLBFBD@RBBDAFDFCBCPETHHFHP@nBBB@JODQRMFQJQBKHSCM@ICSACEGFGDKI[BYCCKCBECM@WCKDMFEJEHCHHFFFFHNFBDARQRBH@LEHKEGAGGM@GCC@GEE@ECKGSEEAGKAEE@C@GIO@KESBECEAICGA[HU@IBGAAC@@EFGAIFABA@CHCCQBEDE@EGGACFG@EAGHAHODCBCD@NBP@HBLGN@LLH@HHTFFABCCCBIAQBICM@IEMAGBUBGAE@GECCIBEAEDMDC@GM[KQAIACKEK@IEK@MGAC@UNU\\BHCBGNBJEDCBECI@KAAECAED[CEEEAEAKACDIAAAC@ETIBMAODCF@JHHBBAAEBIJOFCTAJADEBaGGICIc@K@KDCFCLBNILMBEEM@EJEAGOO@CBAACE@CFCACKBEAA@OAGCCI@CABGDCTEOICE@CACKBGCSMKKCU@CGCCCKeEGCADOAE[KQIQGEKGCCCACFCBEMMKMCAACBELC@EEME@OBIAGBABCHKFKLEDYDQTGLCBE@UICCM@OGCCEEEIQCIGEA@Q@EGAAE@EGG@ADA@CECC@_FMCGE@EDKHIBEUIOAICKFCFCHABATED@BDD@FADGLEBG@CBBZLNKDOBIMGEaQCEQDEAIEBIOBMHYEEDIACEGSBCJBKMGEFGGMKCACBMAGAACAQDMECAOUQKEGCCEO@CJCBE@GGIEAIEGAC@@BBLC@UOIME@C@@DJL@BCFEDCBO@ABFPFD@BGFAFBFEHKDNTBHDDHTAFCNEBGFGB@DCBJPNF@FAFED@JADEFUDQ@IBGD@BBDZDDD@JOPI@QEECOMC@KFA@CA@CUKGACBCFAHABO@GFGDGEKACGCASAMEEDEHEBETGLIBELDJEDSBSOEGM@IEC@GBKHC@IASKG@YLCD@BPP@BWRMBSJAB@BFDCDY@MVG@MIEAIDI@MHG@MGOACDABUEGECC@AFCACECKABGDIBEBCJQD@JANDD@NBLCDE@CAEACCGOECESGSAW@EAAAECE@SFWG[G]CA@CE@GEOLEBMDAFKHGDIJKDKFCNCJGDYEKJICMBECEDCJFHAFBBCD@B@@GCE@GAEC@CIKGIGE@CAEFGBAHCDKACE@CCAI@MGMD@BD@AHKCEEBAACEAEEO@@ABEACEAI@CCC@E@EAEGC@CCC@AFE@MGEEE@@CFBBCAMCAC@CCGA@CEE@EGE@EDGBBDBFABCEABCACGIA@GFC@EIDCLC@CCGBAJEBGLED@BCF@DA@AAAEBCCDCPEEG@CD@D@JEBA@ELGBE@CCEEKDCD@NCGCGIWGAEKEAECSMQCI@GDIBMNGDC@ET@BANCLDHDH@JDN@RATEBEFABEJMNE@IFAF@LI@KFEBALADA@EDCNKNC@AAC@CDEDAFBDABGD@FCDBD@CIDE@EBCBKDECK@EBEPKBC@ANE@CLIDEAKCE@IBGCE@ETI@CFGBGNIJKDCPCFC@IJQ@GIQLI@QCCICGKOGOO@MEIGIDEISCGDIKOABG@KCE@SFK@MDOLI@CDEBMCWDOCMBCAM@GWEEI@KDEDCTEDMFE@CGC@GG@CA@EEBC@CCAACCA@CGCACDEGGCIKM@E@EAEEGBEA@@C@ECAEKBCACDCBICCGCAC@EGIGACEGCACSBEEQKUAI@GHKRKDW@GEMK@@OHIDOBIDCBADDNM@CDEFEDG@ECKO[@MDIHEF@HABGFIFK@GEE@OFECGDKJM@A@ABACA@ACKFAFIEEKGACCCAO@ACBIEGAAEAEBE@AE@CAOKFCDICIHAFGBCDABBHGLGA_BI@CB@HFJFR@DCDQD]NIACJIDQAE@EEEACAEBGCOPAHKFBFFF@F@HCD@HEF@FLFD@HCF@JEFADBBBBFBDADCDDD@JHFLBNFGJEDBFJFCFEDADADDJQLCHILDJIXEFA@AFC@@BC@ABABAHCFIBOCCEG@EH@PGJMFCAED@FJHDHAFBBGNTHFPKDKFE@KCE@@NCHILIDAFGDAJGDBFFDBDAFOBUCEA@NGLJNNCFBNGD@DJLFGL@DLFDH@FPDHJ@FG@EHQD@HKJE@IEGCCIG@AAMCICIACCACQBWME@@EBIDCICKAABCFC\\ADCBM@CDBFCDCDI@CHBJEBGJQJABCDBHCBOEGGAK@KEE@FADMJELKFKE@FADFHFTBPABCHBHHDD@DDF@DDHCDCNBHPAFDFAHEHCNED@DCDGDM\\OPKFG@CCGCIICAM@MHCBCAEDWIBGACCEAMKDACGEGBAEAAAMEA@GAA@GCI@EG@EDEAGDMCAOEAIAIN@F@DBXCECHOFED@JEJCNBJHFN@BJJDDLAJKLAD@DBHFF@FAFKNM@IHEF@BNDNLTJFBFDLBFA@DMHF@F@BBD@@BFABDDAAABEDBHADDDAF@@CBEDEFHVVDRDFHDXVDDANFLFHRPPHFJRBJFE@UTAFCD@JGFCDE@EIEBMHEJED@JEFAHEF@HCDCJMPOFUCK@@DDDBJDHEJGNGL@ZIDMDMAEBQJGJAHBHENBFHHBFAJCHQTGPKDMLCFE`BJFN@BADKDGF]HIJANITA\\EL@DDHCHBNAD_\\QVCHFHCJ@FCDEJIFOZS^CLOJGLBHHD@BGPBBP@J@BDEJAHDFHFPED@XHTBLBHHJR\\DHAF@BDCH@FJLHBT@DBFPBRDJANKRAF@HHRHLNPJHCQJELMDMJCTBNGLCZUGSHO@YDIFGAQDGNQ@KFULKAMBICE@CDALAFC@GFGBKIOAALIDKKG@CDGFAHIDEAIJJHBBCJMHCR@LJL@DDLAFFJFDFBDFABEHBDFJFDDPBFBFAJFBFFF@HDNLZLP@FZbLHBFBBJJDLHDBFAJDHBLFDDH@FHDBHPVFBDDJHJBFDFAJGBEDE@ED@HBFCDEEEBCNAFCAEEAAEBCDAJ@D@HEFGPGXABAAEBCB@FBH@FG@EBAF@DFF@FGHAHABEHKHA@CHEBKC@CE@GDAF@LBLGF@DB@BCPFHHBBRDHDBD@TK^@CY_SCEDIDC@ACCMGCC@C@CB@NDHADGGUJGD@HBJNFBFA@EAKIGBCH@FPB@D@JED@XJJFFABCDAJCHBJLB@HIDCNEJFIDCJHDV@@BCH@FBDDBTBJALKBCDAFDBJBFNDJNHDDBF@NID@JBFJHDHLHBTLFBFFBFFH@TDJBFAFDFBL@@CB@BBBFBFJEFEBEDADDFD@H@FBHJBHPDHH@DEFBFCJBXAFELKFYEC@CDANDFDDBHFF@FNHBD@FIH@DEBILEP@FDDJJDNDFADE@M@IAECBIEEO@KII@KJKBK@AB@DC@EEEA@BDB@DABEC@@DDDB@FCBCGA@@BDHD@FAFDCDGBFHGL@FADGDECK@EG@DADB@@BCFAIAAA@AD@DBBED@FEDBDAFDJCNINECCBIN@FDDHDDFBJAHMZG@AEACA@BJG@LFSHCBDFLFLNJAFDF@HCDEJ@HAD@BDDFBBD@HDD@HDDB@DBBEJ@LEJ@NADOAGH@BBFJJBF@BOFKHC@CGD[ACI@E@MJ@DBF@JEBC@ABZbJFJCDCFDFPHH@PFBBA@GF@BJFBLJBBEBOCG@BFFDDF@DGLADBDJBJEH@EBAFGF@LIDQ@ABFXAFCHFHBFEFAFDBLBAFBF@FFB@FDJAFLJDDDBFDBHNFDC@CBCH@DBBFHHJL@JDHANDFBFJBBCD@BCBAHLBB@BEDFBFAD@BDBFEB@FFLDB@DCFC@AFGHCD@PENDRFDF@LGNBR@RCPGPCB@FJFBbAH@DJLJ@HIP@FJJRLHDFDLBHDLTJJBHBPCH@HFL@HJEDBBEJGLGLANIJABGGC@IDCFANBDCFKJANBRKZAHCT@HDDHJDJAHDTNJBHBHADE@CAGEGCE@GFOBGDCTOD@FDH@J@HEAECIAGDCJG@AECE@AEDELEEOFMAABCC@AA@AGG@ACA"]],"encodeOffsets":[[[105527,24614],[104743,25420]]]},"properties":{"cp":[102.543907,24.350461],"name":"玉溪市","childNum":2}},{"id":"530500","geometry":{"type":"Polygon","coordinates":["@@BALEBCCUAAGDAABIHMACE@ACBK@KFGFAXHLAfB@DFFJBHCDONYRKFG@QDGGEOM@GFKGINQJGRaDARFP@VJP@DFH@HJJDFJJFLBRHBFCBGPADCF@JDBPDVBHCBILADA@GDDBDBBFHBBD@HHF@FAPJDDBLDHRHX@HDLAJDLGTGJAFINIHKFAHAPDBAFIPCJ@NDH@@EIM@EDIACR]JEJYDCHAFIAIQQCMD_DK@GEIM@EDGAGDMDQNI@CDECEDEFGAG@C@AIFCDIDEBMBQ@KBCDBDADIAGCAE@KFC@AAAEFG@IFIBAD@TUHGJQHUFGLKFQJMLMNK^@D@JELKFQAIHKHUHGHQHIDAFGJEJQTKLMPGFITQLMFCFIFCJWLEFGJCDCJEDEPGFKHCNSH@BH`BFFLBLFHBDCDGHMBAVE\\OXAlITKNCFGh_HKTFDEHEH@HBFABEPOJGJBDAT@FFJALDHFFBFBBBDB@DDHIJ@DBBH@@JBDH@DDDADFJ@FCF@JCDBBDF@BAACDCDB@DDDHBl@LBNDTAF\\@DEJ@DFFDJHJ@JFFJNPNFJHFDFGTATZRDBBADDRLD@PAL@LFJBJFPDPLB@DQ@CGK@CRGFEFI@WDIJEHCPCBADMLIBE@SBANGBC@MFIAOBAHHTJFBP@PEFBLDTKNEBC@ASQ@GHKNGDCBOHK@GACGCWGSOGCCAS@uMISMOKCKAQDO@OMQSKEGAIDI@IKEQII]SQKMCOIIKEK@I`oLIEGYOUiICeAGQCUlaJEDAQG]GKCI]IGSKYIKGAO€WLKNgDIAUIQCM@MAIWCW@MAeU[]OAMDGAFkFOCSO@Q@UAKEO[IaCACEEAIBIDCBIIGMECQEACBCLKHERFF@D@FEFGBMAGMGCC@CFCPADAJU@IKO@CBGDANBHAEQAMMAMG@A@GJIDAFE@E@WASIEeLODMAOGIWOMQKEMCMKMOcIa@KAUMGGIMCEAGI_Y[BaMWAMEM_QUEOAQDM@MUGESIGKCSFGDKEMICIOE{LaLOCQFHLIˆBJVXBPQ\\INKJARBXIdQ\\E\\EHCJ@TSPINANGHSLOEW@aEIQMOIQAMOE_kKIIMDyCIII[EMI@OMIGAWUAOIMSOscSQSCCAKYGEEAWDK@sSYFQBCCDKAICEIEeGGC_CWISOMAOGM@]IQ@ICECKSEGaUGC_cMIGASEE@gN[CQ@KA_AGAKEOAI@MHOEC@YDM@GCEGEFEBK@GLE@ABKBABDB@NL^BPGDADDV@HBFNHLDLHZLLL@FGJAJIfEBKLKNCF@JFF@DAPCFAPBHRbBTPFFLAFDJGFEBCHHPDPBBJDAHBF@DG@KJADBHGHFJAJIHKF@BBHAFGHMFGF@BBFFDFBBDCDAHBHQXAFDFHAFBFHJFDFDNHNNHNFHJBDADE@EDEDEACBADARIJIFCD@FBB@DI@BHADEBOFCF@JBBJHTFBBGLETCDOHMECCEBEAEDGAKNM@KACBCJA@MDIFIAGBcOIBGAGDMAIGEEECEBGGOCKGCEEBCAQASKMBSJC@CCE@QGEIE@CNBBDBABGJIG@BFR@HDBJ@@DIHBFEBDFEBBJUPIDCDFB@DGHEJBFDBEBGFI@AJKBDHADCB@JK@ULIIIBDDBJCF@FNHBLJBHABB@DLPN@PHCB@TGTEDGBCF@FNXHN@HGN@NADABQ@GFGZILAD@FBBTPJ@JDLAJDT@LDLHFLHJRLJLHDP@NGX@LCRDDC@EJCH@BDAJ@HHN@BEJBBFDBDIHKPIPCNEJAFBNAL@TCPELWFYBUCCCDIACCAI@IFMCEEC@CBC@[WMEIDCHBDHJBHCFKLEBWAOFIEGBCEOEEB@BBL@DKBAAMQODO@C@EGA@EFDF@BADWNA@BGAAAAGBIFEHCLFHEB@FDF@BGFADGFABEA@BDDFCHBHKJCD@@BANAFKHGACEKBDPFD@DKFGAECMM_UY@KAECEGQIGMC@GFEBGFEJE\\BDLA@FOPQJCDBRHdALCD@FDN^pFHFDFLDPBPFTRVLDBB@HELS`OFGCSKCACBGLi^GLELEFW@CFIBBHAJIFGNDFEFBHEFBBFDBHJNJB@HD@BJAD@BPVCLEDALBLBB@DHPBNMHYLKHCHEBEAGLBHGNYLI@SESHEHCH@XKJCFDRCBI@EBEHEPBHHFDJHLDXAnDHF@NErOLDHNJdBR@XG@ADHFJVB\\AJET]pGNGPFHJFbHPHFH@LDJPJLLHHH^MdG`M\\CJJFLAJCRONARBPALCPAL@TAVIbWPQFIPQXmFEN@JRN\\JHnNL@PHHFNTHDN@DAHBNC@B@JJVFTANAvDVLP^N\\H\\BP^DJC\\KXDNHLLJHNHFDJGbDNNRHHPXHBFHRLFFLTNRRH`BPANELMRM\\UTK^IZKPAHBDJXRLFTEHDFdHJHHRFFDHJDHJ@JCDIDMPMBEI_IE@EMECE@CHENcJGJGNANEO_@CDGCO@AZKFEAEDIBM@CMMAA@GJEHCBCDGROBECQQ[@EDOCQBCPO@KK[O{@EFKFIHCH@B@@UFCTCJAJANDTNLBbC\\GT@H@HCJBLC@BCH@FBPBBL@LT@JGL@FLLHJBLAFOLKDGLCRJFH@JEJBBDDETIN@HAHBFDB@BBJDBFLABDT@HABBJBFBTGP@DBNGRAH@FARADB@FDBBCBC@MAEIICO"],"encodeOffsets":[[101378,26221]]},"properties":{"cp":[99.167133,25.111802],"name":"保山市","childNum":1}},{"id":"530600","geometry":{"type":"MultiPolygon","coordinates":[["@@E@C@KDWFIAUKECCK@G@KDGVKLAFCACKKAGBKR]@CAEOKEG@EDQNYBQEEKCGKAKFOHGFARBDCACIMAIBEHKHWDSDABCJ@AIFGVGFAIMOO@AHAFITCP@JHHBFDFJFLNNJHH@HADBDDFFJCP@JEPEDABMFM@UNKAECKBCPIJOAIFCRA^JJAVCDAAEEGCGDELGRODECIQCCKDKCGGIEEMCK@UACAAG]AAEBILU@CEIDGHBD@JGTAJAL@PFLFHCDE@C@AWEACFI@EEO@OBCHCFK@CAEAMAEEAYBCABOGCAEMEOBYMCGBOCCAEDIGKECK@CAOQMAWDMBIFIBMG_@WCIEEAAE@CTMRILADADG\\EJCF@DCFBFCTODKDCLIFG@EIBAA@ADEXU@CEKDAJCLUHCNBNCPSJGLAFCDGFCVC^_H@BCCCBCVGPAD@BELAJWDEFGFALBFDJNFDJ@PELKDKF@DDBGLI@ACC@EDIAEDCPA@IDGHCJBFBJJLDFBXNDBNBHAPBJMBAB@LHXNzjLDLAHBPDRJ^LVDNFP@B@@GCC@GAADGPCPAHD@FFDbHDFHHD@BCB@PDL@BADATAFBFHFBJGN@JBNBLDPBZLDBBF@PAJDFPJTDXBFDABIPE@Q@AVDHLFL@FDFNNRBBFAJETA@BEH@DDNXPFVRDFDDHEP@JHb@PBFHDlBRFFFJDj^DFDNBBFBX@FAAEDEHCL@FCBEDATFTGTALGDEHEZATGL@F@HDXFD@BEDEF@FBDILIDEACEMBG@AICEIKKEG@EJSNQJKDAtGHAH@HDDHNLBBJAJLJBBAAGDCDAPAZGES@IBGFENKFOAWFQ@MIKGCGEEQGEE@KFC@C@GCYYEG@GLM@KFGCOLGBIAMJMAEQWBCFC@GB@JFTDFGFEJEHAPBH@FC\\HFBPADEAGCCIACD]EGC@EBGCGIAEDICDSFKHEPGFE@CGEACDIFI@CGICGHUAgJCFENBFEEEAEEG@UDKLQB]CIEE@EAIQMBAJEDEDS@EACGESIIKYSEAWGGGEKINC@CE@EBCPG@CCCQKACFC@GSGACBCDEH@RJDADEH@DACCCCHOFQ@EAGGKKECSCCK@IGAE@K@GBEFADGIQBGACKIEI@EJEDEEKEKAGMKCKECAIIGEKIEGECCAEAKCEGEGACBAFFH@LDVEFG@KDIXCBE@IIG@E@EHKDKJKBI@ADE@GCK@SIE@EBKJIDOBQCCAIIGEWCAEACFGCEC@GHO@WSOSUICEBEIBIGKAECECKCACO@EAEAGIUIIICGEEGAMCSIEEKaCCE@IBEMGAQAEEIGCFGBGHOBC@ABAHDPEL@FHNFDBFKHKLSBEFIDABAFMBECC@ADGDCMGECCAEIGCIEAASCAI@ECGBCAE@GPBJMLGLEFKAGCGKGCGBUNKCE@ICGAGBIEECCBI@AECCBABCIE@GG@[EC@CHCBU@ECI@OC[QKCCBIHEBKC@@AHE@CH@DADKBKJMFU@MCM@AEEACD@DBD@JGLIDSTBP@FGHGPGH@HGJBHNJDDIBCCG@CCIB@DQF@FNL@BADOBEEQFG@E@EAIFAFGBI@EFCDKBKAEFAFEDYBABAJADGDAH@DFJADICE@EDEDI@YJE@KCOJK@G@MGAAFCGOKGIEAABCDENGAE@MC@@FGFCA@ADA@AOWBC@CGCCE[@CAAECCCKBIIMESKEKGE@@LA@CADKAKEAGBC@CCCKCCC@GCAA@EEA@G@AMGDK@ACEBAFA@CCCJGDGHGAAECAEC@CCFG@CIEGNEBQGAEEACFEHUFCCCCLIDGBABGAGYCIFEHC@GFC@CGBKAAKMKEEGOJGJMNCBIFGJCHAHGFADKJ@HBF@FDD@FAHEDWHGNCBYEKGSACDENOFGFIDIRMDIFMDGFKFGFCFEBGPFLCHDHAFBJ@D@DAFEB@BANDFCLEBGACBECGCACEAEGGAG@ICINeDAFBHEBI@E@MJGLE@I_A[IIAGCCEGAEAQK@EG@SCqDKICG@EAKI@IAAQDECAQDE@IEC@MK@AC@WAGBKC@EFEDUDIGAEBI@GICEGWEGBEDC@I@EBGACCB]AEC@GDEHC@@CDOACKICI@CK@CAHE@GI@GCCECACG]AACCQACKGAECOEACAGEAIMWGEC@IBC@AEJ_@CCGCAKACAGMKHO@GBC@OGMIGBEDI@ICACGBMCCEGAACEGAOCE@CAAPAJIRAPFJANkAIGBIAE@QHUFSNC@C@CCGWEEIA@CHIDG@GLOLIHBDABEAGFODEAAI@KKGAAEDAACBK@ECEECUAEAaDQFABALIFUFIEOAQAMMMAKDSJCDAHEBC@IAKBCAKQICOIC@ACGAM@SPEHCBGBGBCFKIAEBCNCLGFENS@IKK@CHMAMCMCGAGCICEKGCEEW@ICCCEUBEDGBCE@CDETEDC@SAABGEACGAMGMEEQO@CHMGWCSOMAOGUKKAIDIJIDGJGLCFEDG@KKMAIBEFCRBDA@CCAEC@CHGJCFCBGCEGCG@IFQDKBIDANFTADEBK@MEKGGMSMEAI@IDWNEBGFCLIHAAAMCCEAUF[@GAGKIBUFG@IG@IGYDEJG@CKGMQAE@EAACCG@CC@CNOBMIICCAEG@EE@AHMBCEI]SsMADC@CJCDMDOHC@QHAFI@MHOBKEGABKEMWMOEGHMAEACC@CHC@CYKAADCD@DCAWFOCEGGAE@OAUBGDGFAJ@RDDABCSASEGDGLGBDHCNCFIBQCCBCFENANAFCJORAF@FRJDFAVCJDL@FEN@FCH@BHJ@FAHBN@FIHOJEFKDAD@RDJAJBBFDAPCJEDGDELAHHBDD@JCFIBADCREHALIP@BJFFJADMJGLB^@DGLIHIRBFDF@HCHKHEBEAQHQ^QRCHIHITKRCNULEJ@JBFELBPCFGLAT@JDDDJ@HDNBHCXBTENIJ]XAF@DDFJNDFJfJNLJFH@bTjBHBNFX@LCN@FCHETCHHXGNERFPAtET[RGXAZDJBLEV@HDFNJHJJRFRJXHVT^BHBHBFHJNRNdFJFDF@H@HMBOFONQDGJGHGJCJBPHPDRHF@RH`Z\\^NBPCDAPUB@RDVCXHPLLL^NFFDF@PAdJRDJHFJVNNBJFDLFFD@JBJJVFHNJTFHHDLFFDH@HDJBPHH\\J\\CN@JAF@DEZET@LHBFC\\BHDF@FDDBFAHMRGDMLEN@JDFHFD@FCH@DBBFDDRNHJNLZRLHBFDDF@RHJLHTJLHLDFTHD@H@PEFBDHBFFHDHFD\\`NHVBDFDHLBHFJNBNHPFFRHNFTP@HRVV|@HIJALBHCJEZDFBJ@^BD@TNVVPJTRPHHHDZBHDDDFL@XADEBE@EAQMGIGAIAIBO@I@SPCLIJIj@FFT@LCFILGDG@UCECCIMGC@EBEFIB]`AFAFBLALDLBNFHTHNNBBDLFJ@JKFEHAB@NHJDBVCJBTVHFLFRDHDFNHFJHNHXPLLDNBDHFHDFFDLT^BD@RFJJHˆPTJDD@HBBXTLBLA~i^KFCFI@ECWBEDGLMJAJALDHFJVH`LLPFD@ZET@H@JHRbdRVFNNPXBBNARDTN`PHJDHBHCPIT]bELBNL^@PCNMbSVWfAHDfCHENEFYpc\\GLKNAFDDNBFDNHDDD`IH@DDJbPh^BF@JIZBdRT@JET@FHTNPHBRABALOHO@EG[DIDEPILCP@HBFDJNDDJ@nQFGBYBCBAFAJAL@JHJFVBPFR@`NJBzJFB^DJADAJINEDCDMBCLENANFNLBD@LDLJRHDHBPBP@VDTARHFAFENCTGJBZHL@^CNFDDFN@FCPBDHFF@HE\\kLKJAZFF@HAFCFC@CAQBCFCFANBLFHFT\\TL\\HbHZKJAPARCPMRK@CEACE@MGUBIAACAOB_DE@YGMQAMCEAGGGAEAOCCMAMBMHC@G@ACEKAKAGECGCC@IBWBQK","@@C@CHCB@BD@FENDR@@AGAIAIC"]],"encodeOffsets":[[[106793,29218],[105876,27375]]]},"properties":{"cp":[103.717216,27.336999],"name":"昭通市","childNum":2}},{"id":"530700","geometry":{"type":"Polygon","coordinates":["@@EaAGDCBODGDEHAB@FC@CDABAD@BEJA@CB@DEFABGHEVCJEDBBC@CJUPIJMDO@SBG@MDWDUBEHEFGHAT@`DVALCRKHI@AAAAAC@@ACAGGIECE@EBGHCJCLBHEBCCCSGCOIEKUHCRBJHDLHBHABGEgBGLCH@HCHMV]FIFI@IAEJCNYJMJEFMBMAWEK@EMQAAFKBMGeD@FFD@HFBFDDDJDBLBHARA@CDCFGJEHOJMDIKM@EBGT[@KBEHELCDAHUJMPIJQ@SHKLENBHAFC@CCE@CBCDCBCOQEKCIbWHMBO@IGQ@GbqBMICAADQDIHITGBKAGBCFCPCLCJAHBHHHBD@BDD@FBHHPAJBDBDBD@FELCFBRCFCD@BCDA\\@LDAAFE@GACAGBECC@CFG@ECC@GIWIGBAAEDA@GKSBC@CBAAEIECOGO@CNKJC@SISKECE@GDI@CCEDKGSII@CAQBG`QREXC\\MTKLEJ@LDFETKFGEaBIDEHGD@d@XDDG@CKQCIEWNQBCBMHGZCNGFAH@JDJBHHH@DGJGJMDATBJEPDF@JCTCBCBILSVMHKFKLGFG@CCGQWAKQUMGACRIAQYUOGCEBADCF@FBDAJMHEBIBCD@NHDABEAOFIASCEBAFCF@^FLCFBDF@H@FDDJHLDD@LKNERCBBBbIRCPIJCJDJFFTJJ@NGH@HCPKTIF@JDJADABG@KEKE@MFCAKS@GPM@CSKcMAAEQAAE@EEIAEECOBINIH@JBFMNGDECCGQEC@OACSS@KJMAIAEBEEUUKI@KFG@C@GCGAA@G@mHCCCK@IJi@ECEGE@EB@FEDCLBCOCCIABCFEVRHDBCBCGQD@DBBA@CBEFCF@VNFAJQCEEIAEBKLGXWFEBADKAIOOCK@IFINKFAL@D@DCDE@QBKAEOQEAUEKGOAEEAGASEKIEKAGBIFIDQ@ODUASCMEaUQGG@MDMAKCMG[C[IGEGCYDIBIBKC]IIA]HGHCBSBE@OKMQOIGAe@[EY@YQGG_QMEM@MAIIMCIIOUIGEKKMKIQGGA[MIEOGMICEQKIIGCMMOIKMQOGQISEO[_GMICEAWDQAM@OVKJOFUDIFCH@HJL@BCDGBGHUAMCUOMEaFGAACBMCMCCEAOCCA@CCCOI]ISASCBEEIMEKCGCAABIK@KGGBEABQAGMKSGKKAC@EJSDGAGGIDQDMBG@MDEFQFIDUJMDQIAODM@GDAGIKEDE@KLGDkICCEAKGS@C@AEQCEJBFCLCDDRCFICE@IFBDAB@DKBWJIDCAOWIEO@IDGCMJATILCHAJ@JDL@LBNEDEFEL@RJRIX@DFDNAFDDF@DMVGPMHIBWKKCSBOHKLGDADDTWfBNDHLJp^@DCFI@CDILBFHD@LCFSNKT@TIRET@JBNCHGJEFKAC@AF@DJRLLTFDADEFAFFHADD@HED@D@FPRDNLHHHFF@BEDMII@CBCFBJRNHHBJ@VLVL@PCJATBXCDDDVENQJOBAB@HCFEDE@IAKKIEGAEDKZHRCHEFGBEFCJ@FBF@JAHGFFJJHNBRED@DDTALB@NADOHILSFEDBHPVDPAJOFE@eEQBEDCD@FBFADEDCL@NsJI@UEC@CHALHHDJJJBFADEDG@@FHLITC@CAEEAGCMCEG@MFAJDNBJ@DHHBFABEAK@OHA@OEGBOAWP@DBbADC@EEaAKKG@MBGAIEI@CD@JELAFHPG`DFLJANCFSIGCKCG@QLIIOECCAKGECEGUS[Q]IKISEEMCCEMCGGS@EFEAGEGAADDNADIDW@A@AFIH@LAFGLGFQ@GBKHI@IYAYFQ@M@OCCCAQ@IKI@UGG@oZeJQJIHOBMBAF@FINcXADOHUHM@CA@IF]@ECCIAY@WFc@]CIBGHGJEFQBABCFEF[HWAOGSCQEYOEBC@GKACYAEBSJCNQR@VCN[X[LKDYBCAUZKLqPCJAJB\\S`CVMlO\\ER@LHJBHEFNJAFAFDHCDE@UEK@OFCDBFDDHCNCDAFBDDAFBJJJBHADQAIJEP@LGNBFFFAD@JDHBHEF[N_CGDU^ANMNIDCFCTERBNEVBFEHGBELIFMtKBUJ[\\CT@RKBEPAJ@NJbAPOHAF@FBBJBNALE@B@NADKFAFBlGJCBU@CDAFDRIJKF@D@HJRCDKFC@IDE@AD@DKFAD@JCBABBBJBHDDDFFNJZDDB@DKXMfO`APBPBFDHL@LDDJDLJNBJDFBJLNRP@DED@FCDIDEFAHBJMBGF@LCJ@DHXAPCHINAFIHAD@FHVJJFBBBGNDLINAF@FBHFF\\BZPREPBVFJDPBLDX`BBCP@DLVAFCJBHDB`HDBLJbNBDANF@LGDO@KEQBCPOHADBFE@ECWGMCO@EBGJI@MBMBCLCPKDE@GFGFANHNCDCDGAEACGEAA@KGKAELIPKHIFMAOBGLGdQFCLWX[AE]QACBGEW@EDIFEJENCHEBCCWBELCL@FADGACBCXMPGDEBOBEDCHAXABCBKHGNGFER_RKbCFAFGBODC\\GHCBCBOBQHKPIZGBAFIDGHGJMTI@MDKRkHGFCF@NBF@FC`UDE@EAWBEDEVQRIFGFMJMCK@@HGJEXUBM@MHEHENODG@GMAICAACCHMDGBKCKFG@MAGIMCI@ATQFIBOGKAEBGHIJAHBNPNDL@DJDDXFZVRDHDFHAPHHBD@FLRDBDBLADB@BBH@HEdFT@NDJFRPXFLDN@JAFMJCH@FFLPP@FEPARCJIDEHA`EPEFCFAJFvF^DLBFFDRHFDhJF@JFHPJHHJBJLRPNBDHNPXHFBJXTHDHBFDN^HBBHTRHTNJPBJDP@PFDB@HFH@ZABID@DDRCH@RAJGPKLINKNKPLRDJCFGHEbCHKRENU\\CHGHAPBDJDDHFRDNFLPRPHJJLPBLDFbPNRBDER@PAJAJ@JRDRBNFBFEPITBLDFDBL@FBBRDJN@FD@HBJBDPLDDCJC\\ABUHCFH\\VNBLBL@NDLLDDANWHEXADBD@@DLDNRBT@DJHAHDFPFF@JERCBNDJBHCLFFD@FFPLDLVVDNHJDJCDAJDNFNHBDDD@FHD@FDDP@FEDDDVDPCPE`CHCJEDEJGLGFJFDHBBGBKDGDWPIH@NHNAP]FALJFNHFZNDHHFRFLP\\PDFBF@JCJBJDBNTFNHNNLBNDDVALGH@JNDBFBTBFBDDBBBA@CAOTGDEBMDIPKDCAMGMACBEJERGLG@GCCEKKGCI"],"encodeOffsets":[[103124,28504]]},"properties":{"cp":[100.233026,26.872108],"name":"丽江市","childNum":1}},{"id":"530800","geometry":{"type":"Polygon","coordinates":["@@G@WI]mOIKFCDCBAFEDBBCDAFADBFAD@DFJ@FG@CDIBIDE@CDEAADGB@BC@MBMEODC@IJUL_LKBSEKKUKYIKGGEYGK@KDUJiHyCEE@GHMF[@YIKIMKAaBaJONMTeZMR@bBZGJGDKHEJAJMBMHK\\ILOJS@KGQScCQKOMSEQ@QBSBKCCGBIFKGSASCOU]OMCKDI\\_RYCMMGK@OBAKBmAEQ@GBIHmHCAEEMAAGECE@KLEBcMOAEBADAHJ`LRDXCDQEABDBBBCDG@ADEDGAGDG@CDAFWPOXFNAFALCHCL@JUVAHC@ABFJCRI^KPIV@JCFDLAFEF@FAHGJBLCDGEE@ABAHKR@HCDCJBFDDBJIJ@FDD@BGHADGIKFEAEBKCACCBCKCEAB@DABIBCGEBAFEBEEG@CCMEACCAADKIK@AEM@CCIDMACE[MOKcSO@mNK@cF‡QY@MDKHKLKHKDkE]A_EOBgHSHIJ›vAFCBCA@DACGDEGE@AABEBACGKAEE@AA@CBEAGFBDEDC@AAA@CB@HA@AIGKBIDCBEHG@AECMCGBWBMAI@]QQOSKEGQEQ@G@YVMDCNBFCVILCFORCLGFK@ECG@GDI@EHK@CDA@EBBCC@@CA@AF@ACA@DCA@DGBCBAABAB@@AA@BCC@@CB@@AB@@C@ABCC@DCKAAEGDCAEDE@AAIA@AGBBAAACFCECAADC@AA@BGCA@AAGB@AFAQ@CGA@@CC@CCCBC@ACBIKGEOGCAA@IAICCIMECUBIIICK@YJIBWGQ@CMAIDSIEKACAI@OEEBCAI@GACGKY@ILQBGCGGIIGMFCAACG@MDGF@DEB@DB@ABBBEFBDQ@EBICKBEDUCSDEDUGQAOAA@I@U@KCEGCACBEDKCGKGAECAEIA@EBCAGAESAKVOFI@GCCIEGIQCMCEECGAIGMAGKAEBEHKKIECC@CAXCLAFABE@IIeFECG@EFMKCACDOAOCGEEAE@EDE@MGECGDMAKGMKEMEGKGGIEKDULGFMBMJOBUFcR@DBDGBQVEBYAKFMBKDUGKBIDI@MIAWR[AGCEGAI@G@K@EEEOEGICeACACEGAIDI@MFSBQRMBEEG@AE@QAEG@GEAEBICGO@CCRWAAGES‹i}WQgUcDGKI{KUIECEAKAEUHSCWDQF[BoN]BSAKGAIDMPYAIGGaISBQDGLKTSJcHcLaTSDgEKCMGAQGQGMOBSFGJBLHbCJEFM@OAINmhKDCACAQAGC@CCC@AEBQ@EHCJC@A@@DC@CHIHG@ACBEIEE@ECEG@CCGABYfO@OEMEKIQGSBgdSX]FOIKMSKYG]AKCKESGQA_BUHGIKGcFS@gHI@CCADCBBBCBCHCAAFOGC@AAEAMIOBOVSHI@ICABA@OBCCC@EECBEDKLIHEABDBBCBCJIBCFGDADQFBDE@@BCB@BKACDCDCHMLABDBBB@FDBJCPDHCBCH@LBNDLH@DABGAEEC@A@CLICMHCD@@J@BBAFGJHDJNLHBRDADED@ANADHFDFHA@BBFADHPLBJ@HBFHBDFBFHFLI^DRFN@NEJBHFB@HFHDFJFFJDDFXFFFFFFHHVFBZCHMLKLUNGL@FDHLDHDPBH@FBLFHFPLHBJJNTBFAFHLPFH@TLJNLJLRXNBHFLTJFBFH@NCJCBUJCHKLAFBJ@NBDLLHRLPDBFLHHBFENBJYb@DFF@DCDGD@JCFBPE@AT@FEHBDADAH@FDBADBFKH@DG@@HCAAB@JCL@HEN@DEF@DCRGFIDGLAHIFGHCNFDH@FH@DBDABDF@BJCDDDADDDADBDBCDFB@DFCJDDCFBFB@AFHD@FFTCF@F@F@DT@FDHEL@FFPDVAHEDRH@FDHDFHDNCJBHEAFJPD@H@JHDHHDXBFBPAAHCDCFIF@BA@@DAFBD@FAD@LMR@HAF@JGLBHGPDDBF@FCDBJHJHDTCXMNKLELGhUtKPD^PNTDRG\\[hQDEBARKRQjANZ’@JC^QJIDG\\CXIRLPNFNBVFHDFHCPPPFFLFLHJFHFRLZLHAJGXEHIBG@IJABJDBTCHED@BBADA@BCA@GH@DCFBFADGFEHEBBJABID@LIFZVBDDFLJvnLdNA„WxI”]pcPDVRrJ˜”hBŒM|m€AvQ^Bp\\`^PlB@@\\ALG`OjFxB@x„MrLdljJBRXXvBrHPJPHbDXHNJfNT@JCL@PBFLDPH\\HF@HEDKXEJ@PNJTHTJFZHP@PAFCTULSDAL@FAHEPAbDLAFBB@JGD@DDBLHHDBLALBPTDHDBJBLJJDHJNDPDNHBFMLaNQF_RIJCJDNFP@NCLMVKHeLGFCJBJDFTN@\\ARE\\G\\HJFJDBBBDTKBOJ@F@FLNFLDBFCDIP@DBDFALDHDDDBD@DCFJDBF@LGD@BBJbJPADCD@DBRFB@DCPCTGBAJSDGPCN@DDF@^[nJZATMLMR@PCRVZPHPFN@PIdGXHXD€PRLRN^LpHN@\\DPDXCLAXENBFBVGdUXL^DXGX@RCJFVCTKZL€E`FPErFRFNDNLNhXNL@FAHADOLEJCNAR@DADGFOBMLSDGBALDNCLEL@DFL@JCH@HABIAGF@DDJ@DADMNALABQJAACGEBCHAPDFKLKDAD@FHF@BQBEDADAJEHMJMDEH@H@FJHCVGJEFEAGCGDCJDVBJFJAHNDDBFCDBFFJRJLNLHDNCJEDA@GBALJHJVHL@ZID@BDHBN@@CAK@GDEFCNCNOJ@\\F`ODAJLPLLF`\\LFNDFDPRBHHHBJB^BHAPFVHPGVCD@BDFDCHDJ@\\CNERCDAFKBCD@FFJAJSFID@JDH@RGJKNAT@ACBGDCF@JB`KHKAUDQLGHITELOLGHA@DBDHJPDJCHGRBRFBAPCT@FENCPHNPNHFLNHD@RQIGAEFKFABCHDJ@PCLDFFH@HGLS@EAAICCEASBEDCBCEG@MAGFGbUNKJOHKVqXiXQNYFQZQFM@KEIBGJODO@]DIJKDMHCRCDIB@NABAFIAMDGHG@CAGBENGLKLEjaNO^mTKRSHOF[JKN@nOTKPMJERQRSTOTEZAHIPIDKT]PYJEFIDC@EDIEGBETWb]@GAGDGCG@CFKB[JSBMJI^GHELCBC@AEMAIF_DENKLCHORSDGBIAEGGAEFMAGBCDIXOF@LBNCJC@YHKHMFICGAICC@CL@VDPENODIDC@GFEBGFE@IFCFINGFAFJF@DCHE@IDCBEVSF@GESAEIOGQOEGEKBMCCWUGCCECQUUEGCFAF@DE@CBCCGBCAAFBBCBACEB@AC@AAE@E@NG@CEBKAECEASIMKMEFEJGN@LMBE@EEEAGBGLKBMCIICAGOAECAEDQFI@IFCPEDGDFAW@CFKDGNBBDBNLDJCFBFCH@@FDJ@HBB@HFBBNBBBFHAHFBDLCBNDFBDAHXJFCDBDANGN@DBJJHDDDH@LEPON[HCDC@CFCDMFGBGCEBEGOMACDGDCCE@CCC@GCAGDGBAAOESEGBC@ELFLEFKNIBC@EFF@LBLHHPFDAAGDCBARIHIFAAIDGJ@DCDCAEDCN@DABCD[DEBALBJDCDAJ@FF@XNRABDDDJBJDNDBBH@DJHDJFF@LI@GRCFGH@@EGIOC@ECGKE@CHKKECIC@MHEAMDIMHK@MFBVDPABEACECAEHCBIHCBEJCJKDG@MF@LDF@LELCEOSGHMAABECGIG@EFCDBNEHI@OFGH@DFPDJADEBGBABAD@@AD@BEB@FEJWCIJKDGRKCIBCBCFCDEIEAEFCHIMEKAGE@ICCDCBCACAEAACAEBIFE@GDC@KE@EFE@GDC@G@EEEAELEBGPOHDFADBFBFFF@RBJCDIJB^MRCDC@CEQEI@GDAJ@`AHBHKAGBADCHAJKDAHDBALGJ@@B@MCCE@DKDE@CCE@CFCHADGN@DE@CEEACMIASGG@GEECAADGIC@GDA@ABE@CBA@ADA@ACECCI_A@GC@AGECHMDEBCAC@CDCDABCF@BC@EHABCAEAAACEEBOEIAKII@GCEBGFA@CDA@GD@DBFAPKL@PEHBLAD@JEBCHCH@F@PFLHJBBDFALDHEBEACBEHBPGFDDCBBBJDFJAFA@FBBCDBHGBCD@DHFBJJCHFLDLI@CDD@BFDLTFED@FBDA@CIM@GCCGA@CJEBC@CRBFAJAACMMDKHAHCNBTCJEDERKEKBGDEFADGBCJBFCH@R@NGCE@GCGKIEGECIAKKDKLUNGE]CEOKAA@EJI@EACCAOBC@CEA@CC@CCIECEGGEGKCCA@CFABOAGC[AQ@QHAB@LDHEBABBFCDBHA@ABA@BDA@BBAB@DEDAGKEE@CCOEUAS@MACBAGABABBBABCDAFCLQEG@IAIAICCCDA@EEEGQAMFMGMICCAEAKDEE@CLI@CHKAEDI@GFE@CGIMKAEHQ@GAGEEC@SHIEIMMKCGIKCCOCII@ATUFCBGHEL_NILOFCNAHCTYPCHEHID@@BD@JCDEJBFCFBNJNZDDLHLBTCPGFEHCDEHEBEPINCRFPAJCDIJK^OTaFELSJEFEFCXUJEBKAE@IAEBSDMBIBIHMFCBGLODKJGTEVCNCDClWTCJCFAFCTBLDFADCN@HEJCHGHCD@BFVNNBPEDCNMJGH@FCBADFF@JGFALFFFF@BDF@LYAEHEDG@MHGBKJGFAHCDEPQHAJB@IBGkccwKUDMHGOCigBEHOJSHcAIMBsXF"],"encodeOffsets":[[104636,22969]]},"properties":{"cp":[100.972344,22.777321],"name":"普洱市","childNum":1}},{"id":"530900","geometry":{"type":"Polygon","coordinates":["@@BGGKC]BGDCFAHDFBFEHIDSACGEBODENCNIFGBIBCFCRA@AGE@EBCLCLKCEBODGFADHBBTKBKNMBC@CCI@CHEFBD@BA@GDC@OEI@CFKDKCMBKHATCNKPAHEBC@CBQDMFIPKBCBG@EMKgWKMCMEMEQFqEOF_KLYDSEUDI@QHWCWK]VWHcAUAEFMBWDKCWCO@[GMKo]QMQKOWCWGcHOJM@OEOGUYDQ@ONQNKBSIY\\m@]CE@CDMHOTCBIHADSDO@CEAAQ@CDCBCIOIaAAC@KHE@CAEICDC@CACCCGBKCECAO@CJEDCAEKKM@E@EPILACSAACAEIGIH[F[BQ@[SMCEAIDIHEfKLGNUDK@MEOCMDIJI`QREbMNKAEMGOCMCGIICKIIACACGOSKAKBCAGGAKCCC@IHA@EAKBaCOBGFEBK@CBKTSVEDOBO@YGIEGSISOMI@WFCLGFE@[GOGKCAE@ODK@IMSIeGMCWGaIOGOAqWuQWIAkiKcNqwƒA@EwPiJk@[A@Ok_]o[]AuRB{n‹NgA—“qIUQOCod“^wJƒXMBKcumKICEACYUJE@KJCBAAIFAFGHEBCAEDE@CHGB@ADB@BCAAC@GFSDCAAIIBAPCHGFSDKHEBYKQKGEIEOKGAKIIKDOEGGCUEMAMEGICEJQDWH[aJWDQHQ@M@OEYAODOFIHKDM@]HYLmfILIHUJK@KABMCOIQKGSEmAMCIGS[IGWDGFCLEDGBECKAKBEJIF@JGL@BG@C@ACGAAAA@EGCAiDGCe@iEWJC[ECaLqZcTALF`Th@JEHIGOFSIKDYDMACAI@QHQBCDIDEAK@GCADCBMFGJQBEBCDCCI@EJKDECI@GDCAC@EEAICBK@IC@DABG@AFBDADBB@BBDABHDDFBHFHAFGD@HDBF@@BFBHHD@DDBJHJBHCFDJANDBBFNHDHHDHHAJAFCdEFDBLEDDARJLGDuhW@YOIBIJDHJDNLRXHHL@VKJF@NEXSh@ZHNDJATYPGNBRDRMHUVMTEDSCACIDIAECDECAGAOBGCGGE@AJILIVAZELOV@TBTHNJJ€v`HdTJFDLBZELQJOBeNELEhETCbOLMDMJELLPHRDPER]bERKVILOJO@SI_CGFAD@DEAGB@DEFOAYHOAGEGCG@EBGNAJGJEAGBSCFPDF^LJHHLJPELOP@FJTBREbQ`APHZHPNPDRAFIDOAGBQHAJPPPTZHPIPKVANLXNTXNVJXLJTD\\@TBNNNTJF`LXNNNFJHXjXFHJFBHHF@FCHKBADBHDD@DGNCROTGFBBHDbVFHLTFDJDR@^JN@PHNBTPXJ`DHDfHJFDFBJCLDDRAZEtTHBVCJ@JFLZDBTDTRtdTPJNBPXVHBNJ@PNJ\\FJJDJCzJNLJ`lPFBNJRNPJRbFX@PFTKHGBMJMTO@SDIFGF[R[JcAWBQLIJMR[AOUWAIJ‡GKREPDbK|KPFDJNJLFHCTELDJHFTVH@NCNBRFPRVN`NFXBbN\\A`ZHJFBNDHJNHBV@LJbPdLNDNFNRLPNJXPHNBPCfKJFBT@X@FEFCBIJ@H@BNHNBBNFRGBMACBAH@DLP@JIVCBOBED@DDDNHBHANEHEFC@E@QEGFKLADBDRFFDHNJJDAJCJAFBDFDBJbP\\LFVBR@P@DTEPElHBNCPB\\^fVNBX@XDBJ@NDNJRBVCJMhKLXBPLHZJTLJHJ^LD^HRHCBIFkbDVHRfBJDVjZPFHKJ_p@JFLJLPJNDRL^TJJFRJLJ@JCHBLFRTPNP@RCLBLDNPJT^HBCRSJEJ@DCFgFIAcBQJWBEFCZIJ@\\HJ^BNBDHFFHRAF@HAD@DDHJFLJDRANKD@F@DBHALBPIFBBBDBHCDABBBDDBH@FDFAT@BADCBONATBDCBELEBCGS@YEQKK@A@MFICGACKECKGIGAAEDKCGEC@CHGACCCBECEBGGIAGEGCK_WBKIKDO@C@I@UCKIQ@GCKQKAECGCWBSCEEASBMOCCKAMOEYN]AYBKHAHCPCRBJFJNARHHBL@^DFDBPAFBHH^RJLVNHHPB’DLFRB\\H^FNFNDdDL@HARQHEHANBLHH@DCBEBELSJKJAPHD@DAHOHKHCRABG"],"encodeOffsets":[[102819,25301]]},"properties":{"cp":[100.08697,23.886567],"name":"临沧市","childNum":1}},{"id":"532300","geometry":{"type":"Polygon","coordinates":["@@PHTA‚BFKBKLGNQDIBCDAH@R@LIBENID@LBDAJOPMPWDCXIJG`QBGEM@A^@HCBEAEMk@MBAHCbENIDEGUKQSCAA@I@AHCbK@C@CCAQA{PI@EA_QGQECDGMI@C@CTEDCBCGWDCF@L@RIDCBE@OBCZ]DAFB^RHB\\EH@fTH@HEL[BAL@V@LGLBHAPShsFSFBFHDBD@BAAGGK@CRAhQNB@AACOSCIAk@KFKNOJIRQJEPCP@@GCGFQACMOAEBGDGdFJBLFDD`f^lHJTLPFL@XIJI^[PCNDXJHAFADBTDF@BDDA`JLAJGFGdW^MRERApF@FFHDNFHFBT@FB@RDDHTLFNCDBFHBHJNNTDJLPTNBFFBVBFDbXPHLHHJ@ELKFG@EFG@QVOHKAQBCEE@CFAFCLENCPMLCNEDELGHEDMDEHALGF@FBLATKDC@KBEJKCAIAAADCBG@ECCEC@CBEEODKAEEIGE@ABGACECAEFIBMAIMYKOAEHOEC@SDCXGJIAKCCKCGCAC@SDC@CHILEAAO@OS@KHG@MFQAM@ELIZ@JAPKLELGLKDQGUEGAGHBAGBIHKACEASAEAGO@E@SBO@MAAMGAE@YFEFMRQ\\UJKIW@GB]KQKKEQ@EDCNBFEDID[BCHCT@DCDODEPMH@HBHCFOJMDANLVFF@FCBQCQIECADMCGDGCKBELINAFEEQBMCIBGFG\\MFKDQG[BQSBCC@CFMACGCGKCGCA@WBCICCAEGCEMACIAB@DABEACC@CBEJG@EECDGAC_SO@MGI@KBGFAPQJEJM@ECSaFO@IACSGAEBALGHIREAIEEAECSBGJKLMAmDGHEH@JB`NH@@ECM@QRQDG@GEU@EIEIM@MJGCAK@OFCBAAEIY]OeCQIUOKBCBANDDEBG@WAOJI@EEGCMGACCIQDOACCIBIAACACCEG@CAAC@CDEBOAEBI@MBEFIDE@YWIEEIOAQMYKUCM@GFABHT@JSPMDC@KCGBGHCFDN@HBLADU@CAAA@G@CCEQMCKGI@C@CFMFEFADCBUAIEMBALKFEBC@IDINGJA^JDDRDDGCCAEFIDAFAN@JCBKEKBEDCECCG@ACGAGCEQQ@EKQCM@IDEFC@CCGICQ@GDYBQLMAIBELCDMAEBCD@JHDAHIBMJKBKHIHAFCAIF@GEK@GDGAOAGIIKSGCKAECGCQKII@EJO@GKICIG@aBEAEIA@ODOHQDQ@MAKHE@ECCQFM@ODCHGBED@DE@CCAEK@EFAAEACC@EBEAFC@AAAGKABADC@ADIAAECEBMCG@IIKGGAECAG@AD@DCDMEAGECCACCKIBECI@EEA@EAEBEKACABEFEAEEGDGBEEWBAR@JC@KHEBEFAG@IFIAACBCHK@CCEECAEH@PDFAA@GIICAIE@@HABEA@OGGEOECCDIDIEYaBAD@FA@IAE@CNIF@J@BDC\\DHD@LGPE@AAEIIAE@AHGPBBC@MFI@KFIAA@CCAGCC@GCC@AACEACC@GBI@CFGDE@ECIBKMKECEXIKEH@AIB@BDBFH@NYBGAICEGCCC@EJMDAFDJMDMCIBEACFC@EFCAA@CBCB@BBBJDE@AA@BC@CFHL@FDHCBC@EHKEGHADCECEBC@CG@AB@DHDA@ECACC@@FDBA@CCA@AFBFFD@@CBAL@LALIJ@LJP@FFAJFDJBN@HA@ACECMIICC@EFOJKFA@CFCDGAEMG@EEEAGCCCEBMDCD@ZFLEFKBEAWDIAEFE@CGGOC@EGKGAI@A@CEBELCFEEIEAAA@ADA@@AKCEBEAECI@SEGAEEEEASKGAGKIEAEICE@MJE@CAGCIMMCAEAICCEBILEDUBICAA@EDI@AU@GCDIJCIEMFCDEHADKMEAKDCBADCBC@GEWIC@IFC@A@EOCACBAB@BHFBBBL@FEBEAIMGAC@IHHVCHGBMCA@@D@DDDNHDD@BCDCJDF`TDZ]@SLC@CACGAQGAEGDO@ACAE@KHKAE@CB@HDFD@ALGF@DGBGLAFGBGBEHE@CEE@AB@FEHG@EAA@ADBFABWBOHEHGFC@I@CBADBFFBBFEDMBADFFCFEDGAC@@FCFAFIHEBECIAIGCCEAOUAGGC@ECGECAKCGBIAEGCCKIIAAAEKGYa@EKOKYCM@GEEAEIEEBEAOACCIECEGAAFEBACCEIEEEIBECK@GGGCMBGBIPADGAIIBJCFGJGDAH@BLHCLKJBBJPALEH@HEDKBCB@DDFAJBNKLEV@LMRCHBREHCJ@ZGPHTYVKDMHSAIDCNKNIFDRIGMOGKGQ@GBELQBMCIAQCKACGAQ@EAIK@EDGACE@GB[CIQGGKASAWGE@KFCAECCGBEFI@AEAU@AAHO@AGCAIYBSFSPQTQRIFONSLmPM@ILE\\GPQTSL]nMPibKFKLMHAFBH@DGHCHBNEJABMBA@CJQDGDCNILCJ@^CPIPAHFJ@LENYRERMZWRWjUrGLIPMLaVEHBH@NFHADCDAFBTDFJDBB@FKTGHG@EEKCODI@GCADEBELBFJHQRC@MGEKMGMOOGMDEFS@ODABQEQAGHIDOCGIAC@CGBKHKPSFGJKHCRBVEJaNIAE@CDAHBDD@JGDBCRAJEFEL@HFBDJLBJFLED@@@ALGJDLUAGHAFA\\GJ@PCD@DHNDRDDHAFBBF@DRL@BBFEJCXFVCNIDSCEBGFCJHZGF@HC@EDAJI@GJLF@FEFN@FHPFVDNLNDFDZHCHID@FAHUZUJGH@PDBNBHDLBLRCLKDCHALEFDJDHIFADGHCFDJBJDHAHJF@B@HGFCFBJGJ@FBFHFBDBRFADBPZHHBF@BCD@HLZF@JCHAPFF@JEDIB@HBLEDDDHCFFP@BGFCFHJBDADGFLJNBDP@RCDGCEDCRER@DLFHFPMNCDGFCNARINEL@XBDATKLIDCXHTCJ@DBDBBFAHFHDHLCJ@BGDBFDB@BAC@AGPABCHDFBNABB@FJFAH@FBBBB@@CJGFQRQVEPBDH@PFDF@FCLIJ@DBDFHHBF@LENF@BCFAFLH@B@B@BHBLBJGTJ^@JPFCBBADEBCHGBMNLLJDLJ@BABIAMFFNDP@FEDC@GECHE@GDAD@FABUCIBLK@AE@CEC@@BDD@FCDA@CEMFGAIDEJ@JDDMBILKBDDADKFIDA@ADBD@PFJFB@BEJGFCHEDG@DHCHEB@BDBJCD@DFGJBFAJFLAD@BDBBFFFBDAFIJAHBHDLDHFD@JBH@JBHLDjDHEHCTDBLED@JFF@RADKNBHALAB@LCHDDAHBDAJGHADBBFFBDE\\GHGAEBSJC@G@OGOAABDDJPBLBFEFYJ@DCPKJ@BJJDHNHJDHLTRLLBHBJAHI@IAIDEAQCWGHVJFFHHJAFejETCHABS@CHBDABGCSDMLEPFDLBFDDFBLBDPFLFJJPRHD@DGF@BFHADCBUBGF@DPNLFVDTRDHBNHPBFCP@JHTDFHFEDKAABYhCBQGGACBK@SRGLEP@FHLJJJRHHHBHFLBJN@FAHGDBNAB]PI@CB@DAHAJFZAJBHAVBFDF@NAHBHJRAF@LBJCXKJIVVXDNJTHRRPLNPJNNHDJJRLDFNJPHJF\\NHBRHLJLNFLJHPVJJNDJJNBN@NF`RHHZRZ@\\F`@L@FBLJNRNJHBTADAHG^GJB^JLDJAJAZCHDHF\\J\\DNHLDNBNCH@RHbVNFVDTBPCR@JCNGPBJFFLBTBHFFPBLHVFFDRR@HAH@RCFGDK@EBMLEJ@JDLRR@HCLAB"],"encodeOffsets":[[103894,27132]]},"properties":{"cp":[101.546046,25.041988],"name":"楚雄彝族自治州","childNum":1}},{"id":"532500","geometry":{"type":"MultiPolygon","coordinates":[["@@AAKKGEC@IGETD@DFBJ","@@@FDDFBFANGJMLIDCF@FDDDBFBBJABABCCA@CLADA@CBCTINKBA@ACC@CF@L@PCBC@ETMN@DBF@DELIF@JIF@FCRO@CFGFCLETEF@FBLBDCEE@CNADADEBAVDTCR@BABACC[GGI@C@CHCNEDA@CAEWUSCM@EC@ABGXELI@GF@bLJFPLDPDBPEHIDJRDLLHTDDBDAHBDAHDHH@R@TBLNFDNDFDFLPFDHHHbVNLLPBH@FCJKBGD@FJLFPTLFHBLON@DHTFDLZFDFJHJDRLNDLLNHPJFJ@FC@ED@FBJF@FFHNP\\@PEH@`ZF@BABCEWCKOK@OA@ING@CGEEEQGM@CH@PGPMNITGPADBAFDDJB@PBNRXRP@AAC@CJA@EDCJDLJBAD@HBAGFCDGDAHAJCVgDAN@RJB@ACKM@CDANDJCHED@\\YRGLAJBJHNBJATILK@MAAGACC@E^SPCHDFVDJJHJBRGFEBE@GCGAGFCLAAG@EJADEBEACAEICKCM[CGAGDI@MZFBKDIJMFCBEBGBAHJHAJIXc@G@CFGFAFDF@DA@MFQEGHAIEACBMCAEBG@OKIAEIGBCC@EBEAEDIPGHK@GE@EDC@EMI@IAIGIMCCG@SHQDGCSMMCOOEKIGEK]]ACBGEGEEGBGAUMCCAIAAUEO@CCCIEIAEKKAICE@EECCKIIBGAEQKQCECCC@EDOAGCABM@EDE@AEGKE@C@GUKYGAGFK@EGQBMEOKKIC[B[CGCMAIAgBKDEHE@AACWCKEEI@OFK@_OYIIESYEOHO@ACEYMGAGCCAMIMMCCBGKGEGEM@GGI@IBCACBCFEBEDE@MDEEQJEFIDADGVOHGDEJG@EBCNEBGFEBEJGHCDEDIBCBGIG@EEEC@ACHBbKXULGVUD@PJHBDCNQ@I[QFIDCNGJGBGGOBCJECAYMI@AKGEUAKAGCCEFIBM@GS]CUCACDC@GEAGBCJ@LBBAIM@QAGGQ@KBSCQCICESQHIJILFBCGOJGBMFKACEE@CJEBE@CGK@EDADGK@@ODGXOAIFQEIQUCQWWGKGUEGQIAIECKASGQACCAADGHKBIA[BIDExaBABKFGJIHCXALDJFNJRTLDD@NILEDBN\\@JFHRLTFFAHGFKFAV@DCCASAEM_KAEDCVIFCBIEIAKBCF@RFNAHBNDLFFALOR@PCHFF@@AS[CIDCFC\\DDEBGCSEGGCCEVKLKHK@KCMUIEEACPUDGFiOY@EDEDOHKHHFJDDFDF@PKDGRIJEHAL@JET@JEHIHED@DGDAJ@HABIFCBADBBAAC@C@EFEFE@CFAAABE@EJI@CAABCAAFCDA@CD@BKF@BEAEBCEE@EEA@EUKA@CCIGAGDECCDEEGDCACAA@EAEAKBGJIBMNKBELMAIDCBINGBEAEJC@ECAAABIAC@ICCCIDI@aDGJGDGOY@EHG@CGKIEAEBK@I@ELI@EDGBEHG@ADA@ETWCM@C@EIQAMBGCKDCACAC@OCCK@KEIIMYQGGOCCCE@EDCBCHAAEDIDQGMFO@IDECCBGAGFMEUBIEICQKKEAK@KFG@CAEEFIPGFG@GKaBC@GDIBKFIFSHKBGAGECIKIGAEC@DIAKN[NKRGVAHBBFANBFDFJFRDPAFAROF@BBFDJ@FDJ@NJPXHH@DAVBJAD@BBHJDFBDADIHPFFHDLZCVBBFLPP@DADGEED@FFDFH@FCBECCAG@CRCFBDJH@JDHJFFBJADCFO@ERAD@DCN@LHQFDDRHJ@FRPVHP@HJPJ@JHFBBABBBHFVFBNAJBBDFBDAAWDCJCFWDINGF@FDFBDAFDRPB[AICAAE@GLGJ@FBPRFBHD\\^DBF@HBLKFCJ@THHFHBD@TMLEDC@IHWBCCMKQIVG@IJC@ECEGOJOIEGUKE@EDC@KEM@GCSICHCBOKC@G@GDCCGGGAGEICIGGAG@EFCHKBE@CAGAIKMIGKKOEUGIEEICCGYKCGMSYYCEEWCKCSKMACDGVOKUAUCM@MEK@S@CEI@KACGSBKCEECCAAWAAEAEC@CPOBCAAIADC@GFG@ACEBGAAGAGK@AHCBEBIAGCCEC_AOKGKCAG@EJABKOUPKXGDK@GDCFCNCDCBKKGBADDHAH]ZOTEBEBEGCAC@KHGRINEF[NILEJILULADEFK\\GLGH[bYNADCNMLENGBOCGBIPMFCFADBJCFIHyvGDKBEBKHADCNEHOFGDCFCVCHIFMDIHEAAFA@CIC@FIA@GBGFMII@DWCAC@MOBMGCAGECIECIGGCEOKAC@GE@CCKUGMCG@[HORQBCAIKa@ECCAA_IESGMEQU]EAC@[HMHBH@DCD[NIHCHKLITQLQVAF@HD\\ADWTMHKN@LEZ@\\BDNHHHBD@F@HCBCFOFWHEJCLADKFKBYDCBENURiNE@WBWHIBEMBoEAEIGWCEKEEKMMMUAMDOAKFIA@EECICKDSCGeSSAKCQOMGCCEKMCQ@OBQFMICCCI@OCAG@CAAES]BECC@EAC@EC@CIDMFMPSVSAEaSOMC@IDKEIBCAKS]SSGaGMAGEIYIKBCDABCAECILGFG@YCKCCKAG@EBEDE@OI[@KECBGDIJKFEJED_DEFDROL]AKAMNE@GCQFQCGDCDGXBH@DIDG@EDAFCTADGFIDMJADDJFFADIHQLCDHRGFKHADDJDDDFBHEJUJEPCDEBSBGBEDALUJMDQE[@MBGDMRFN@DGH_BIBGHABI\\CBKAO@MDGLIBGFKDAD@NEJ_NE@QEUEQIGAEJWNMPMH]ZEHGFI@QMIECEBSEIEAOAEAKfINMJED@NDDADGDEAEBOTULMJKREBIACDCBU@ICAA@KECGBOAQKAEGKAG@QHQGGGCKI@KAIEEEMCESKOEMKC@OHMBOKAEBEFKDMHIDADEFKLIHEF@JCDC@CCCUAEAEGsCEICEAYBICCC@GFIBEBADCDABKYICAICWAOCEBQRCFGDEBIHALGH@NCHGFBFKZE@ACE@EEKEEBIHE@CEABEDG@IHMNCDOFMAUMAEC@GDGHIDGFM@CDEBKCSAEDEBIDSDkXCDMDUDSFIHCLKPAHEDGNAJAJCNATBF@JBFALIFWVEDEFIFKTEFSb]PILCJIDOBQEMDOJAFGFCFGDEFOHSDKAKGCCMYMIEAEDIACFIDC@@AC@GJGFODSZGDMBEDKPMJK`GFAHEDSV@BJJPDDDJLDHNLJNJFTGD@FFBH@HGRBFNLHJ@DEF@HCJBFGL@DKJ@DFFLCFBDBJDHNENBNHRFF@FCBDDJDJBJBH@RFDKBEDCBAAABABABHDANBT@VBPFDDF@LFBHFC@CBAAAB@ACB@BAB@AGDCAEBAFACG@KBARGR@\\BHDPBBADEB@DDHLHFFHFDDJ@DDDB@DFD@PADBBD@FIJ@FBBPLDFF^MHKVCLLLJBFDFHLJDH@HDFMHQ@G@EDIAADCHEBCFAHFLQLCFIFSDMAGDGBCLNNBDIBEBQA@DADIF@DHBDD@HJN@DCBEAC@EFKSEC@ACC@DKJKCGEIDAIGE@CDCHAAGDCAA@EEBIBCEAIAACDECOHGAAFBDAFGFKCEBACIAKGOEE@G@GDADIFC@KBGAOFK@OLEBEAAHCB@DEBAHDF@HJJBLFJAPFFBDBBBFADGB@FADE@ADEDAFBDADCFGNFDBHD@@H`BDJFDBDB@BCB@DAF@JED@JJBCB@HH@HHHBTDDJFBDFF@DCFM@CHGBED@DDF@DCFCLF@DDBDAB@H@AG@BVDDLAFDFJAHBDP@DBDDHBFLJFBELEBDB@BDBAB@N@LIHCFDPEF@HFL@JEHEBA@GFEJGNC\\@LPFDH@FCFEDCN@CMBCDAJCPAJCPG@@NLHFX@LCLQHGJ@VBRLFFTABDHDDFHBHJ@FBDHDDDAJCDBDADFLDB@F@DB@AFFHBF@F@FLNDJHHCFBDHD@DDBBDDB@DADFFB@@DHHD@DHF@NEFCDSFCLCJ@FFHXN@DBNAPDXCNDFADCJ@PKNCL@TEF@LDH@BALPCJDHJTCFHJFJ@NPPPHHLJDDD@RKJJR@HIR@JEDODCDILMJAHEH@DSJ@FDFAH@JDFBLCFKJ@DMF@BADOLAF@FDLCFALAD@FCFDJC@CAEDC@AHCBEACBCF@DBD@BMDMLCD@FCBKBABEF@LKJE@EB@JMFINAFEBAFQDSDM@ICG@GCKCMDABO@C@@FCDMHAD@JCJ@HDJNRDTBFLFBFXHHJHDMDC@CDFLDF@DAFKH@FABIFC@C@@DFHOFCDDDFABB@BCBE@ADC@KFAHIFABDH@DKDCDFJD@HEB@HJBDADFBADEBCAAACH@FHF@FFF@DHBDDD@DBBNADEA@DF@FFNHF@BED@DDD@FHFBF@D@DDJ@FBBDAF@BP@FFFBBDABFFLDBGC@@ANCNHJ@DB@DDFLBDCBGHAFEDBF@VPDJD@BF@HDF@HA@C@ADEAGBIECB@DDDAFDNIJFLCZIHMDEDCLILCJGHELCBANKFJ^B@^D\\HXHTEF@FDBBFBX@TBTHDFNDBBDHBDBF@DCFKDMAC@MCMBKVAFCJAHLBFDBDED@BDDHFVFBADCPBNHH@NGJ@JCFBNJH@NUZ@DCEC@ABATINAXQ@AOO@ADCZKH@TLJBD@LGHAD@JFN@FHTPTAFCCIFKJAHKFSFAFGFCNFTBDBDHLBHFHCHEP@BABGDEDAHBVL@DDBFAHCD@TRNFL@JCFGDCBEACCCYCAC@AHCJAR@VCFEBC@IFCBE@EMEIODA@CHAHEFADMBEGSCCAGMSLCFGAEBEHE@AECEOBAP@DAFCDE@AIK@CD@F@JNVPD@AK@AD@HBJFFBHJ@HAFID@DFPDDFHRLPVDBNFRCDBBBBHANBDLDHNEHHFLNIAADHTDFJBFCZFNGPAAJJFFBRCDFbRHFJNPALCKMAYDAH@FAHKBC@ECC@AFCBSBADGDELEJDPBVJAFGJCL@FHFND`ED@FD@DCB@BHH@FBFHB@F@RFBJHRDFJFFDDPHN@DDVJF@DAHKRSZCFCLKLEDGBAHAJBRAFSAC@CH@JDJHDLHDR@BBADGDI@AA_H@DKDAFBDDBLNNN@DGHFFHDFLRHRJ\\LBFCPDBFHLfDDHD@DDVLLTNHDLABD@DDFPJSFCDAHDBLBBBBXBBAF@DHJDEF@BBAHPPBF@BIF@FFNAFKNMJKAEDCD@L@LJdJDHHAbCFIBSBEDIPAJBFABGAIGE@CDBPANSJ@FBDBBCJBDBLBFFFDFC\\BFFDBB@LDJAFCDIFMAAHGDWAC@IRCD@VPLL@JFL@LFBLFJHJN\\@HCDCNBFAFDJFD@HBD@FNNNFJAHGDDLXJFJ@HAJKDOHGHBBDGHBDD@HEDBFNH@DCHCFBHLJFDABC@K@CPAJFD@DQDATARELBFDBD@DCDKDCBBFDBBDABEAABBLHFHFDFLDNJFJ@FCNALIXID@BBDNFDFAVBLFB`GHD@PAD@DFJADEFKBGDAFDJDBPD@HAD"]],"encodeOffsets":[[[105527,24614],[105760,25244]]]},"properties":{"cp":[103.384182,23.366775],"name":"红河哈尼族彝族自治州","childNum":2}},{"id":"532600","geometry":{"type":"Polygon","coordinates":["@@BAAM@EJKDMAGECHMDUFMHATJJ@PCXBBA@EBCJADSHMAAMECAQ_BCRAPG\\ELGPKJCfiJILEJINCNBLFFHFLBLCbCLCTI\\KpAXFFBHHFFRFFJ@NF`QHAH@BFAbFDTDHAHEDINIFCRA^@^B\\FfGfO`CPEXCJCRMPQJCRA`HjBNFNHHHLRLFTHpFVABC@GBEB@DCBBBCBB@ADA@BB@B@DAFDBA@AHAPID@BCHAF@F@NGLCBA@MK[AIBIHKJGJAlJNAZQZSdSPSBUMQSIOSAGDEFCBG@CAASBC@IM@CBAL@DAX[DCAE@AEC@EHAZBDAJGFU@ILYFGDADABBHFVBDC@ACGDGBADFD@FC@CE[AKAAA@AMAAGAAA@UCCKCK@EECCCBARCDG@EGIFCAABC@@EAAEFEBAKGMAEBCD@F@BC@ECCACDGAGHINGDELaJEVSTIDCDKJI^GDAHKJEHDBDHALARDJPJD@B@HCBCBE@GFAHQJ@PL@JCD@DFDJHLDBHCF@H@TJH@RU@EHI@EDADDBADBJEDC@IHCN@F@JMHAJBFADIFGNEF@DBD@DAL_FINK`GZCH@JEX@VMLABAFCJ@LCHFHJR@BD@PIPADFJDF@RNR@FDF@LAJ@NDPHLHFJJ@DGN@FBDDBF@NCJGH@RLTDR@JCL@DHHBBFHBXCFCHBFGFALGAMBIDGCODAH@@QBQFQJWEUDQBADGJMFAFBDHFBJ@FANDJH@BHHLHDJFLLHHBJA^ERGN@lXHFP@dGVMFKCIOOECCECODENIF@PHFBLANFD@NETFHJBHJRAPDBHAFBFEFEPCH@HIJBJGDANFFHHVADBLDH@DEF@PEbDLNTRPJBR@jUH@LCNDJDDFTDXJHBJAB@AAQCAEDELIDKHIN@DBDDH@BA@CLAFGHAHENCDIDO@QAEBGAKBGHMXMFG@EFCH@HFJANOBIG]@GCAIBGMNGHBH@JMDAHIBGFARUJCFEFGHSJkJAFIPOBKFCEE@EPOLEdELCFEDGAKIEK@IBQCXePO@UCC[MMB[EUOGGGM@IJm@MBSDMT]FK@]ISEa@cKaMaawAIFUDGVKJIBICEKEYIGISiMKM@MGYkCMGIICeEQE[SWcUOOBIL@FHPJHDJ@FAHUR[FYDUJOJIJUAYQG@GFEFEVEJGHKFKByCOEeQSOCIAeASCGGEwAMCMCMEEEAIaima_YGCIBQHCDQDKOODSDSAMCAANEB@JBJALEFEJCBCDADBD@LI@C@IBC\\EHEDGAAGEEGIAKDE@CCAEBEFCPBFCPODADCHK@CMGE@IFIKC@KFCF@HHLAFIFCHEBG@IAE@GA@KGECCIBCAIEEGIGIDA@ACEE@A@CFEACQB[CCGCAEKagGOE[EG[K]EGGAG@KJ_RQFG@CDGJEIEACBCEE@GSBGBGNIDG@OHKHGTAROREPMPGHGBOJIHKZ@JALCHILKHOBEECKIEMCKDIJWdK@[RCJ[`EJALAFBVCFCHUNKJEPCBEBCCOOEAC@GKEMGGGMY[GEeAGIF_GSIUMOC_CIEII@aFODcRQB¹MAOAKRQNG@OAaYSCgkWMiGEKASCCoDKAGCEEEEAMCICaIQE@I@CFAJGBIAKDEDOZgIMEGIAKBSEOCWEIIA[BaIMEEEGIEDCLIDMAIMBUFeNGDG@gJIBECO@KLIFQPoLSLMXMFYBOEUOMOMaEeUMG[EMCIEKOO]G_QI_CGGBQFQBQCEWCUDU@mKK@KHILKHeDKDYBBCCABCF@BED@CCBACC@AAABCCBCDA@BCACGIEHCCE@E@ACC@CBDHAFHBADH@ABBBAB@FABGJAFBBABBDKH_@KEMSOI]GSIMKCUGOOKSECEAMEEYIMI]WOI…YUYI[GKU@MEEIKIMAMDe\\@RGLEBCDGDGFIDK@MCK@GBSNQHKAGBAFBJAFW\\@JAHCFDD@DDF@FFLDPDJDDAHDDCHBDHL@DBFBALRBJ@JGV@JCDKFSNC@GAGESGI@EDKLGAE@CAIGQUGCEAOQEAI@KH@HBFDBBJA\\QQEACBEAECE@CBIFCJEXIDCDBT@DCBEAACIAMBEAEUAGAAABEAIGI@IO@GGOOUEQI@QGCCREKGM@CDC@QB@FEPCDIBEAIECG@IIGACDEDQH@DBFDDA@EEGEC@EFCHFBC@COOEKAADUKYGCEEGOCJCBEAICAG@ABCAIBU@CGGOWMII@ECI@ECAAE@QPEBOBQCIECEAEBMAEGAUBQHMLM\\BLCJD@BFJHJLFDBHAHGLETEJALCJ@HADLb@HEHOHEJFFDBH@LEL@FBLLDRFJAJFVENBHAHDDCF@JEPHNCRCJBFGBADCD@FDFDDHPRHNZJJLFL@DD@PBDBDCDDLAHBNJR@F@DBFBHCDOT@FCB@BGHAFCH@FKJ@F@JALBFJFHL@DGH@FPZCHIHCH@bCJDJDD@JBDAJBBDB@FIDBFAFMHAJCDBJKNAFMLANIJAHBLBF@FBBBDCDFHCFDDCFBHJHDDB@VL@FFB@FDDBBADBHAB@BEBAJC@@DCBEDBBADBB@DIJ@FAFBBEB@DEFEF@F@DBDABCAABEDAJGBI@CBCHC@GFGJIFS@IFK@GBIFQJCHOLKCCCEIEEAAABGLANCF@FPZEjCHOVBDFFVJDN@LGLKLULDFHDFHDTAHCF[CEDCDDJT\\@BE@GEODQ@KPEBKEUEMBQEE@ADBLFJAJEDUJCDBF`LFNTBDBABWBGDCJGHEBIAICQKEG@IM[CACBUNC@KCQSMIIEKCWBGDMPCNABwbCFAJB\\AJGLCHBBDDDBN@THLBFDBJRJFHHVHLXXDRRVFJERBJWPCH@PL@CHCB@FHL@DAFIF@DFFBDELANIHHPADKEIJGJTRDFDJDRAT@LHRBH@RJNABKAI@ADBHHFD@DCDBDVT^@HANEJDFHDLBVBHFBLJ@ZNDBIFADHPAHIHMHCDEJ\\R@JMRCDGAOIC@UVKHWVaLGABDD@FF@FJHAHADCJCFGDIHAFEFAHMFAD@FIHCFGHUPCHCBEJIFFRCF@NCFAFEFADBDAD@JHJ@HFNFHLHAHDDNNNJDBHDHBZNDF@BGPFPTZJFZJ`PL@PEJ@FFDLDXBBF@FGLChAJBNBHD^F^CJHHJFNANHP@HELBHZHVL@H@DLFFH@BCF@FANDBBHCP@FDDFDRDRLBFAHJJDLFD@FDFBJLLBFFJDJDDP@VFBBBJDDVNHBHAFFFHAHBD^^DJLJFLPPNDXPHBFCH@TGH@DDJNJHJBJ@NCVIHAHMLEJQFAJ@JBNHZLVHH@hTZFLFHHFAHCBKJ@`L^FFADGFCFEPOVgPGHKHIFEDE@GQWSM@IAKFIFCD@FJLDBGV@D@PKJHFBBCDBBFFHHBJ@JCPKLMRGF@NPJBNCDBNLbDHD@RRJPBJCVDX@RFV@H@LJ@PKNELBDH@FD@HAL`JJHF@HDNDLHRBDGB@ZHR@ZDJCHCNAHCF@BHGPAFBJDBFAPCJ@J@LBDDDFFRHJ"],"encodeOffsets":[[107077,25060]]},"properties":{"cp":[104.24401,23.36951],"name":"文山壮族苗族自治州","childNum":1}},{"id":"532800","geometry":{"type":"Polygon","coordinates":["@@VDLCLGLKLGNCZ@ˆRdEL@nMP@dTPL\\NDFNBJCDDN@BFL@LJBCDBBDNFDDH@FFFABEFADHJABA@CBADFDLDABDLDFAFBLEHJBCHG@ACC@EJIAICCAEDIDC@GLQBGBAF@HFDCAKHIBG@EFEBECKDE@IJULOJ]DQEIBAD@BGVU@IDKDGBKBEEMPWXOBEDCH@HCHBFCBCH@DCAACABARFDCCWKQI_BGBCV@dNFALKF@FDBHNBFFDBnGJGHAR@AKWUCQGQG]MM]IYCQ@UHOEGSYm@MXSPUH[NULIJKP]BQ@OJMBIGGgEIIAKRiJ_FMLSPKFMT_DWLQDMMK@E@SCQMOIEBGXANEJENCJGZIPUHCJDbNRAJEDK@GGgBYHGHKLIRGPAHCHIBMAWBMJGTKdCFCDIAICIUaEQB_CQWgAIBYHG`SHa@SBGAsNWDORATFTBHE@YNGPEDIEOGSKKEMIGEIMGQA]FSLSFOECK@IPKLC@GGUAKBIDKHKLCHIDKCMKMYMGGOKAGFMDOFuBaDO@GUQCKAeCSM[D_J[VuLM^GXDJCN@DAZkJGXONBLABK@KIMBOHUBMAGGAS@SPGGI@MBQ]AOI[_qQI_A{DQDGJCJBRAH_TQbKDM@mIOI_UGAGEKBOJGP@LJTPVFXBLGFqR[FUHgHcEgIUAQCSQQEWE…ASB]AMGQIOK]SOIcKO@SEKKSGEDGJKFk`STCHEDMDIDGFGH@JL\\BPdhH\\APIJoPKFUNi^E^GJOLe~OfHJJBjA\\DHFJNBTEJLRJ`XFF@DIBKDGJEbJ^GP@RWBcEuLK@IHCHFTNRVDJ@HBBFBPADMXER@LFJCPGJG@CD@TDN@FGDKAODQV@FAFC@GAEDABHbANCR@HERANCNBRFNPPADCBIEEBEAOFCCUBACCAEE@GE@ACE@GEE@CGECMEACCCCECBA@AACEC@@ACACC@GAAICCEEEC@ECG@CCAECACE@KGCA@ABC@I@ACE@EEGBICIBIGEAEBECC@ADC@EAGDCEMDMACAACC@AEE@EEC@CCIBCA@FMA@A@CFECCEBCFCBK@ECKCCBCFCAAECA@AIEAAAA@CE@C@@CABAA@CAB@CAA@AECBCCABCC@@AC@CKC@CIAA@AGGBACA@AA@AADAAACAGBMCGE@AC@CEIEACEGCAMAIKS{KSIGeKWKQUIOQcOIOC_@OAOM]aMIQCSDSGSGeWUEaQSCUB_TSRKD_EeQS@UPOXMfO`OLCREJGFGJK@oYSGMBIFE@GAGBC@UBCACDIGEGBAGAACCA@AEEAAAECAAGECMIEKAEQA@AEA@GCBCEACGACBAAEDCBA@CFE@EIE@ACAABCE@BCC@AAA@AACB@CCBAAABC@@CADCBCEEBAGABECAB@BGDG@G@CB@HE@BDDDAFIFAFSJAF@HIHAFCDCFBBMHG@CAOHKCAKCCBECC@GCI@CAGIGg^UJKBKJERAJ@FDH@JCLCHADBHDH@HBHALITQNANBHFLNHJHLDFDBDDF@RHNDFLDDHJLPBRCFDBF@FEJCJKNABBDMDAHEFM@BLODCD@BDF@BE@CAA@CB@BBBABICEBCHEBECI@@ICAIFCHCDE@ECEMEGEAS@ICcWGMEA_JCFJZ@DC@IFOEA@C@GFMFG@SJCLIHAH@LAHO\\DJGNCP@HQVCLBRCF@HSTCJALELFNAJDH@HCHBJALBNJJFBJHHRBHEL@VAJJBVHLNBJCP@HFFJXDDAHDHNTBHCDGNAJKNSNGNEB@DBDKFENAJCFANHHNHFP@BDABF@JBFNHLVJ|HLdChVXRj~TŒHFBBQXDDP@DHAJBFHFH@BF@RBFH@FFNARQTANEJ@JCHBDFDBfBJDFHFPFFL@H@J@HBDFBHQ\\BXNJJ@JCLAVHLCNALEZBFARUHAAC@CdQVEPANINAHEVKLCJFHHHLNFLFHNBLCNDHHF@NCF@FBFFFDHBPCPBDLDEN@FDHEFJf@JAFEBKBWDDBD@FDLJGLAFBFHLNBJHHBFDDFDNJRFHDJHDJ@PELUTBBFBHAD@FJBBFFDHBHLLDFCDADBFHLDV@J@B@PBRBVHFCTCVDFCLAJDFAR@ACFEAABAA@@CFA@CHENCH@BDDBNEJHHJDHAHKR@JLZDHHBJ@DBFAPFJ@DBLBJFCTBJDNR@XHJAZIL@JDJJVAFDJNDDBJ@JBBHDFPLHAJBDD@DADDD@@DB@DHR@EB@BHABBB@HD@ABBD@BCDBDFDEBBABHA@BJBBBF@FCDBHCBFLBCDD@AD@B@DA@@BA@@DD@ADB@@BA@ABBBDAHA@CDB@CDB@BBEB@@DD@ADFAB@DCL@FGJ@HCH@FDL@HEDKPQDEJKDUAEDMNCZUH@R@RFFHTLRP^RJ@NBXAHANDFD@BGHAFCDAJHLBJB@@GDAB@BBD@FCACHEFBDAB@@BFFLBDHABAFBBF@FHHCBD@CDBDABEœuJITGhGPA`F^B"],"encodeOffsets":[[103594,23092]]},"properties":{"cp":[100.797941,22.001724],"name":"西双版纳傣族自治州","childNum":1}},{"id":"532900","geometry":{"type":"Polygon","coordinates":["@@J@JFHBNAH@LLbBFFD@BCAa@CXOPBHAPFB@PGL@FBBAAEGG@CAICMBINEH@DFDNBHFFDBD@JSGK@EH@FCBCAEIICIGGBKDGD@VFJ@tI@MDKFCBCAE@EDCFCRAlFLAFE@GCOOUAGFCTEJKPGBC@MKASBCCC@QFMAIGEIHEBG@IAE@EDIFEHAFEDGGQLYFCHBJFLLJBJADEBIBAPARIFMCUCCWDSAIBODK@KU@UAIGGQMAIDEDAJ@NJFC@AEEGGKGCMOQ@E@CFC@GCCGBEEEBCFCBSEKKGMAG@CDANBFEHIDGAM@IFSJQ@SLSTMDE@KGCAEJKDCJ@DE@Co]KICGAMXe@GCG@G^SHCNAF@LDXLJANGHONU@CCECCOBEC@EJUIQ@IBOJIFCAM@KCK@IBIDGJKBOBELGHDJCP@JFPXDBJCXILA@CBAACJEF@JDDECQDCDKAEFIRDBFD@T@LHFBDDlJHCLKF@FCJLBHHCN@PCH@BBAFALINCVEJERCF@NAHCNCRHJBHCHIT@FBDLLTHNLBHARFBHALHL@AJBBHDLDNFFJAFTDTB^JPJDD@DDBPDFBDDDNAPDBFBbENFVPNDVBHGHADC@AIK@GDGJEVCPELIPUN@RBXCFBJDHNHJJUJGFUAM@KBEIQAGBG@MCEAEBUAGBIE[BGBGBEL@^OBAAMHCBE@CIQKAGEGAGGIQIIGK@EFOHKTQL@DAHBRHDAZgBALBFCGECEGS@IDOAEGOAMCGSQUCKEOM@CHEVADABCEG@AHE@CGCOQIIKEOEACAKCEECKAECFONKTCHDBAACDGT@BADGFSfiBEGIEGIEGUXHRDFBJCJBJ@BGAIAGKKSQGKICMGCGII@ALIDO@CZIFEAEAKIOCCBAPBPHH@D@TIFAHBHGF[ACEEAABCHGBIACBGCCDG@KBABKAGLMBC@QEE@IFCAKSCGDGFiCKCAG@IAG@IECCGCKAGBGJIBEACEEAECA@ABCEKBIAEHICEC@IDCA@AFADGCGH@FCDGHEFI@AEAEI@OACBCB@JCLEBCCCLAJKNACC@IFIJCHBNEDFB@DC@ECC@AD@DFF@@BKLJAVDBA@EBCHCF@DGHFD@FC@ECOEMNEJBBA@AKIICKKNMHADGFABCAAEDIO]@SIIHKAGA@A@A@AKGBEDE@AMEKFE@GAEGAC@CJIDK@ECEOEG@ACFORURQHEDI@@AAAA@EBGIE@EAAMBEAGCADOBBHD@ABA@ECCAAHI@KDCGEGBGAECACAI@SDWGCDKJSLCBWAK@MFQJMBEDCHMDONGEKE@CFQDQFCHDDC@QCOMAKIHEBCACGIDEHE@AEODECGCCKFGAA@CJIFE@OEGBIDE@KY@GDC@AAEGGOYCAEBAQACGEAE@EHIAIDEHE@G@AIEBGCGAICIDEHGBCJECGCIFEBKDGLCDKKQKAGCMACA@OHGVIVYBG@EJCDGYGECMCMKUCOEEGM@FE@EICAAHIJ@BIFCD@@GHEGYDIHEFATDJCDMEUDWFIAE@AQK@CAEEAGBCCCQGM@CDC@OHIB[BEHGVBCKHIBI@AOFAAGCKACIEA@GFKFEBIDK@EAAC@GHW@MBILQHG@ICC@EJITIBEEC@ADELCBQDMF[DI@GCCDCE@ADCHUGOEUBOAGA]AIGGAGOQECMCKE_[KEOKIICA_R[EI@MPMDEDCF@HBL@DM@GAACC@[JK@SGGIKIAB@HCBQHEBGCSQGIEMEECAEDCAMCCJQBGDGLGPCBC@OGIBILKTAFAFCDG@KGMAGBGFQRGBK@cCMCME]E[GQAKE›CEAGGUMIK]QGGEAOBCACE@]AKGGBQAECEGEKCK@ODGDG@ADBdM^FZNPLBDDNPTAFBDFATDXDHBFRLDL@HJRDL@V@J@DCPJLAL`XDLFHBHHJ@DADDFAFDDBDGH@DFDDHCLBFHBHJDLLFBDDHEJ@N@BLLFR@ZHTADKFCHCBQAMBAPCDABS@EBECG@CAACAACBGDCAAAEAOJKAGBCAE@C@MLQBICEKGICCC@GBE@OBA@EGGEACAMEYCCIAQEE@]JCBCHKbAPD\\EJEhCDI@IFQTADXFT@DBHDTPVHJDBJGNAPCDMHGL@HTR@DCDKDSLKCEAOFO@EASIGGABBPEJ@NADMHAB@TAFKJCNABODGDIFCJ@XEJEFQH@DHL@DCRA@OKOCIEIAKEK@OBC@QKCCABCAYQBSHSCEGEEIOMIMEE@IGICIEE@CFI@CE[SBMCKAk@GACC@CCACDBDABE@ACCAIDE@EDI@CECBCCG@AC@IG@AA@CJICG@CCAAAEAEAGEKCIBEES@CBIAIHOPAFEBGAG@GFCFSEGLg`EHMDSLkJWB[PUFABGNCHCDGAKEKAEE_AAGG@MTGDELOHCFIFCDIDEHKFIXEDEJEDKNSREJOHKNSLIRIFEHCBGJGRGHGVGLBJERKLIFC@]@MLKNINERKLEHGVIRGHSVC@ABEJ@JEHBFBBD@LEF@DBBHCJCBCAAD@LARANCFCJEDBJD@H@HBFEFCFDDCJ@RMNCHCHBFCN@FJ@HCLC`DNRRBJEJGBCDIZIFQ^BDCJ@FJN@FG@MCI@ODEJABOCGBEBGLMJEJIBSHKHICKBGCW@QGCGAKCCOIEBE@GGC@AAEGAAACCC@HCBKBAJGDUAOCCA@IDEBCHODAAEQGKAIEEIICGIG@CEO@UIO@MEE@QbEFEDMRHJEL@HPNFDBDCF@RCFQLCFKVCPGDE@ECCC@CeAKBWGCBGF@NALBDF@BDGNAJBBHCBBDVADGBEDHTJJBF@NCF@BCA@ECAQBEBG@QBMHCAO@SHEAIAAAGBS@ACKBAEICAAA@ECGAGBM@SJCD@BDDBF@XCJEDGBAD@BB^CFKBAJ@J@JFDDLBLEPALVNHRUDKDADAHCJADGBAD@HBNJPD@h@HBTHDAFG@EAQDGDCVCHCHEDAJBDHFAFGTIDCLQNBLILCTERCZJJ@JBFHBPBBREN@LADBI`MHMLEFETIJGBBBLJHH@PAHCFAHBJDBHBJCNILFH@VCHEACKGACBIL_FID@ZJ\\HR@bCLBHED@DD@DO`MlGNEXMZMhOZAZG^ENYpKVCDELGHCBGEcMIAQHCBKACAGA@HBJCLCjEVDHJFDD@HAD@JADBNEJEBCD@BAJBPGR@HBLBDF@BDBLBFCJFHBD@BGHAFJZDBJDDLPLFD@JCJBDHBPPB@FAFFDBZETE€@BC@EEWMBC@CABCFARAFGFDJ@RADHXHHE\\OR@NEFERCJMJEHAH@DBHLBHUHQ@SPILADDJAFSZAF^JJPRRDBJBHFDNDFVHFJHDVBFHLFBDDNBDLANCH@ZVPA\\CFJHFV@BFBLRFFJBF@BIFYHGDCH@FF`R\\JDBRFHBBDANFHCLADMB@F@HLDHDDdPFLRHALFBTBFGD@\\BDCLAN@NLCJHDJBPJDLFDBJHFNBZVDN@FBBRRDJHFNBALPDFPFLFRILAH@LCHGHSJAB@HJHDLAPGNHPCbBJETILINBPAJ@Bn\\bLHBLFXNnRTRJ@NJRGNBF@BBNRDH@TFJCXDJDFbTTARC\\K\\WDM@URQDMTIFAZBBDFJDBHAZPRFTDPHXB\\GFEDEBARAFEHIHGJA^Dd@XEZ@JBDD@FE^@JDBN@VGPGBCdWJM@EBENAPAJGRIfIpYH@VHJ@JLR@DBDD@^EN@NBPDLFNB@J@JGHAR@HEHKBE@KJGBEB@X@JCBCCMBCHBHFFBFET@HHNDDFNDFFJTJLR^T\\HVDFHFBLDDPFJJRKH@LDHDRHBBBADQKICEH_EMAEHM@K"],"encodeOffsets":[[102651,27280]]},"properties":{"cp":[100.225668,25.589449],"name":"大理白族自治州","childNum":1}},{"id":"533100","geometry":{"type":"Polygon","coordinates":["@@ANFPALBLCJCTQN@LEJFV@FCDFF@XCHFXHRBLDFAFBFCHBLANCD@HGRBFHBHFBABGDCLCJBFFHTFDF@DDDJFDBHFDJNJL@LDLLPBNLLDDFDBHHHADCB@BBLHDAHBNJLBLAFN\\BJJNAJBFNPFNHJBL@NDFDBHA`OFALDDEHADCBELUHEFILIR]TIH@PFFAJDP@D@NLJRHJDHB@DCJBDHLNVPJPFJFDFJLDBFCNALFJLLVHB@BGZClJVLBN@LBHJJL@LDFOFGFAN@@A@GCIDELI@WDGFGTGTFJ@ZKHMAGHKFBFADGLGZKNGAMGO@CAAAKBKFCDKOU@ABCAIC@@GIAIMAGECAAFEAGFECEHMJEBIAGJADEX@FEFKHKj]HKDADBTLHDPET_FK@GAAKCQUESAOCOEKECEG]oCM@EDCBKGcAQDCRIPO@EKBACF[FIHEFAHED@HNRJFHFDLBZ@`VNNFDHBLE@CECCOLADFHBLGBEBM@AC@IDGLGAEDCC@AFBBAHEBCHE@ACE@EFAEGDKFGJEHABBBBAHB@XMBC@ACEFEB@FHD@P@PCNRBBLA@CAK@AFAPFDFHAJFPEXBFALKDEAGGIACDGJCNF\\XD@DAD@FFNDJEJ@DBBDCJDDVDZAXEFKDO@SBKAMBEFIDMJOLOJGACECAAFI@AGM@GBIACG@ID@FCDQCKDW@MHO@GCIKQKGIEKKGKCS@ICKBICI@SOAA@EBCJKHYHER@BABC@MHM@GGMMW@EDEHAFCHS@SDAOGM@KO@CAAGBIAAKMG@EDEAICCJAJJVKL@@IDABCCGLABIJ@HEFACAAEFIHG@CEADCJCVOAIFACEFAAEJG@CI@CA@GEQ@AJHHIBACAAADMF@FJRHF@DDD@TINATLRBDBFADFLHPDHHFAFDFFJHNBHCHBJAdPHAJBJENCB@DIDALBN@LMHBFCFBFADDNFPGDCFSHKAASEIGAA@IDEPEFABCAGJ@@CAA@EDCJEJIBQBCDAFBFCFCF@BCACGIMEMGGMCMCEIEEGEAGBCEBERWAGBGDCACEAECAE@AHENEHGBEAG@ALEJGBIEIHGAGBCLIH@@CAEBGICAACOGODGFAHECIBEEKOEASQaAGBODEBO@CEE@IDELMLKFAJeBIHI@EKKYKKGKCMGAE@GCUBCHCAOK]@MCABALABAF@BEHGJBHCDCKSMKaK[DKHUBGASGMIOKSKKCMAICABAFAF@DADIDE@QHILE@GFMFGRAPCDEBQCG@YC_BIEODGAKAKD[DSCM@EAM@MCE@cCYEKCE@SAWCEEEMBIE@EDAFE@KEGBE@EDG@EBMAWBIEOBE@GBOJE@MDMCSDOCQFQBOFE@MGC@@EC@CAGGMABESF]BGBABC@@@@AJICASBWGG@WCIBOCQBUIUCAABGCAC@C@C@CEKA@DA@ADC@ACA@EE@DCAEB@AC@ABAAAA@ACAK@CAKCKGEAWOAEG@CEEAGCEBKCKSECCEECIAQAcKWK]FK@cKGGKOKGEEBGFCBEBEPE@GAEQCQ@_NE@GEKOG@CHEBCCFQACECE@CBCDCNCDMAAEAADCNE@EEEMGAKCCE@CBBFJR@DCDCBGACOCAODAMEECCEAICUECCGKBMEGHIGIUDE@EC@CBISBGGMAEKGE@IACG@ADEBG@ICCC@EDGHBNBFGBEGIEAWDSPDJCFA@ICAECI@QACM@IKIAAJ@NCFCCEKGGACAIDGACCAC@@BAJCH@LIJDVMBCNM@E@KTSBMFGDORODIFCDCBGEC@GDEHOJGBGCWPEAABBFALDH@FDHJHLDDHRDDDRFBFFBH\\FHPFJ@PJRFHATND@JDHA@FILBFAH@DDDNEB@BBARAFHRCHBFDBHGF@DHHD@FFHEDBBJBBHLBJJH@DDDCB@DDBHJH@DPJ@LBBLANFF@@HLLRFJFF@@DCHBFFRHF@HDJ@DGH@FN@BBA@IBBBND@BCD@DLBJD@@BBADBFCD@BGFAFGFBDGBABKDGAACEfHt`fXJFHNH@BCFEJIDAD@FC@GFALEAEBGH@DGAEBG@CDBDKFE@QCEBCAG@EEEBCBIAIDIDM@EAGDAVELADBDETBNFLNFCFN@DAPMDBDDHDVBHHFJFFDABDBJ@HCTQFELK@KDIPILAF@DEFBDJDBDCBCDALENBNBD@DCB@FBBKJCH¹[G@KHC@KGCEA@SJEBECEBKEGBQCIBICIAKGAHHHABE@ADBFJN@HFFHNJLDPDDFTBFA\\DHCPHJ@NDT@RFRAN@PFRBJAJLTADCFADBJFFADCX@JDJCL@FBFJFBD@DCFGB@PBLCJ@TELBHHTCJBJADCBCHABK@IDGH@JABVXHBDFBNLLTBJAJ@FBHJJBL@PDD@DBBFLHXJLDFDD@BAD@NRLTHHD@ABLLHLFBDAB@RHNN@HBBFGLI^EH@BC@GDBDAHFJBPENAJDFEVJDDFJNFTNBDABFNEFKBABAFBLGDCNGBKHEBGAGGC@EDMNIFEDIREHMH@T"],"encodeOffsets":[[100076,25519]]},"properties":{"cp":[98.578363,24.436694],"name":"德宏傣族景颇族自治州","childNum":1}},{"id":"533300","geometry":{"type":"Polygon","coordinates":["@@PKBKEIBGFMBGDAHCDCDADELEBE@GBIEOEEBKBCBCNAR]HGRANEAMJSHKJIBKDILG@GCAGGEABELCDCBGAMBMAOGSE[HGNABAFKHGBC@CEGDEBMCYPS@CMWNOHCVDJA\\A@FFHDHDDVHZT@HGJADDFLFBDBBH@FBH@D@FCFBROFCDAJBLFHFFPRRBLDBVLTDZJPEJARFH@BARGDCFCDBXKF@@ANAHAHHDTBBBFHFDHTVJ@HDJLdA^PDACYEGIIEGHIJWBMPABAAMDgNCBADMJ@LBDABIAMLW@Q`BHEBEBGHKDQ@AA@IHG@GEBIBAJCR@DC@GDEFAV@BCBEFIHI@SBCJAIU@GBKDG@KBADOCGC[CMBaEIAIBEFEEICYFKCO@ABEFEBMBMJIHADAAKDIIKAIBADAHKHCFGDGDCLCD@HDPRFDFBJADCDC@EEUAW\\]BGCMFQAEDEHCFGDK@KDGAGIOMI_GUKCEBIJWRKPUDARBVWRIJIHKJKHCDMHEDC@KDCH@DC@AMMCIOQAQKEGGEICQKGAI@CDANCFE@CCSF@NKBGDADGDQFKCCIICSMUCKFGF@FEFIHIBGHGAQ@CFK@MDKCQBKGKEOKU@GBGJKHCH@@CBMDGHI@IAKBQIQBADAZDJLB@LGD@HDDAFEFING^LD@NCHDBAB@DKLMH]BSCcCAE@OEGGCE@OBCHEBECIEGF_EYKSUIGE@CBIFECGIECMFMNADET@BA@IGK@C@EBMIM@C@OBKAI@EFGAKISIEAEBGHOX[@A@CEEAEDCLCJGNER@VJH@ACKI@KCG@CIDK@IDCAG]JIDYDAF@FBD@LHBABEDCJCTARIF@VHDDD@\\CFFRDFDFJHFNJ\\UJETBPHTDHG@EDIHDPBPAFCDBJCD@DAJADCF@DAVEFBFABFFADBDBHDFBJHJDDFDBBHHLFDPBZ\\@H@FILMfMVBNDB^DLEP@B@JIH@DCFQPKLWLQBKHOJYDCPMPWDECKLI@CEGRMDGACECCE@EFITODIFG@AEOAEDGHBLH\\NHD^LLFEBQFIDIHKTDDTDPdFFPMDMFELLZLHAVMfFXBHIJeLGNMBMV]HC`D\\MFEAGCG@IBCEEAEHM@KFOJIRBBCAGIIAIBECCEACBMDGDCCAEDCTEH@VFHABACGBEBEMIFEAGGI@KFQP[NkDUT_AUDSBErOLKVY]QCECKDUEI@SGOKKE@MAQHMII@SQmQWMKEGAaKm[@ABIAOJMJKFSAIDaGOHMBOCKIG@GBATIHGDG@KBGJKEQEKEOOCBKMAGECIQQAA@ECMYUMAGEAIECCKOIIAGCDIMKM@KBCD[AC@EHSAEABKQGEKcOCCCGGKE@A@CNKBGDMECBAAEGAQICQ[E_@EDGHCZGJE@AAEEIQEAKAEU@GEEI[DOBYUG@MDKBACCMACKEEGUAGCEIUGCECMGEIACAQQIO]IBETYBECIBCJKTOR@VGAGGKCAG@GBIFINQDEFMFQ@[PGFWGCGQBI@ECEHQBEBADDBPAD@DX@FCD}@SFYFCAEEEBA@OOICDK@IECOKCKICGIEQBEHG@CGIDIAEAKACE@ACAK@GHQAOBI@ADCFAFIAMBC@IBC@GCCIECGFUDiDKAI@GHBDBLBDARGJBdNHFDAHGFKDCLUZoFMH]BYPYNgNYH[FINkRaCCEAGFKAaDQ@[GYIC@EJK`AJBDLHBDGFUDG@KEMJIDGACAAIBGDEBG@OGGKIAAHAJIFSFENKNGJ_CAKBM@QFAAAOEGIAI@YIQDSFKDKJMAKRCDSJEHEBCGIACBGFGDUDCDCHBVCFCDE@OEGAg@C@IOAM@GBCHABCDIBGBCLCVCGQUMBKFOAKCKEC@SBILADEA]BEHAFCDE@WAIEGIACDGBE@IEDOBEFGLCPKBEAKGIKK@EHK@IKSK@AAAO@EDG@AKDIAGDG@S@[HaDKAWOIAIBIBSDED@VA@G@C@INEL@FP|L\\BHADADMLADDRCP@FR\\DRAFQPCHADGDIF@HBBNN@DANCJBFEFYL@BDPCH@DP`MFMBIHIHMdGF@DDFNF@FJFFVBFBFCFMLCNCJIDI@CPDHBFCRELBPCFKNGHCBET@RKRCBOLKRIJMBKDCTEDKBOC]AAZAJGLDHCLBFEF@D@FD@BDCDEDCNCFBXANBL@DQb@BGCQ@DH@HHDBHCJ@LINIb@DNJFN@FCLFBHC\\URJBDHFNDFJD@JBbGJCJIDG@GHMBIEKCEECCK@GFKDCF@FDFHDDJBFBNLFLFDHBHABHRJRPANCHADIDCDAFBHBFDDFBRBHFHLFVBPAFMNEHAHBJCLOTCPGFGJMDOOIFYHBLN`@LGP@HDJNR@FEFCTFAp`DFDHFHDFLDJLLLCRCFALDL@FHHLDFFBPAPJHCL@HBDFDDHADOLCHLVAXLTAXLTBHCPIJAH@FHHBJ@RAHDPCfBFHJFDNDNXHVDPET@DHJ@FIRILG^KVBHJHEPBFHHBNEBS@WJAPCPHVBHJNANJLA^FL@^@LFN@JGVGHGREHUXEJEPFNFDFHHFNHFFFHBJCN@NAHCVARBHMLCFDTADCJ@JIHCN@JJXDRGPABIB@HRPDFfJDR@LFL@DADAFBHADKFQNELMJE@MGGAOFGJEB@JFZCJEH@H@HBDFFALGR@HBFHHGN@PGR@TCJ@HEJONCJBFF@@RFFBBJ@FHTBLD@LKJFFHPDBFADFCFQFGHADDL@N@DHDJBHNJLETFJDPDJBLADDL@DQN@B@NHHABCBG@SDEDEJKDABKfHD@DATCNBVCDGBEFAFGBCF@NHFCF@DAHDFDBJDLADF@V@BOLAJKHAFGJRdAFGFDHFDTBDBEVGPBVNN@BENCBMCMDGHGJKVIHIBIAKIAC@OGIECA@GHcPE@OAC@IHIAGEAEDGA@MCEBABEHBNFRKPADAJQ\\CNELCPCHEHEDIACC@GUEAACKBKAC@AQAOLWAABBJCDK@SFIAGBKAMHKNGTABQJIJA@G@MEAEAG@CHKAQJKBAASKKACCEHKAMEMFMBQ@GASBEEI@IACGAO@MCQIEQEECMGI[QGAIBIBMHIBKEECI@UPQFCDBJBDAJADILEJCX@HFJ@XBJOZCTCJ@F@LHN@DEFCDS@CLAXCHKLMCEACBBNCLEDADCDOFEFQJGDABBLEPGHMDABDHDDDFCD@FNFBHL@PHCPABQJSDMVAHDHALFLBJHR@BADAFBRADOAIBWRmXGNBHADELBBLJEJFDD@BB@JDF`@D@FFARJJIN@NM\\@LKN@TQBYESB[VEFG`@P@FGLBNPJ@NCNHHDJAJEJATCH\\bBHDTJVBJAFBVEFIHGJDNGLObRNDJ@DHAHBFLDBD@HCD@HFBHAJILBPAfBDLLJFV@THF@DABC@ELCHBV\\LBRN\\HLBHDBHAHGLKDBLEFAJIFGH@NGF@PG^ILkZEFEJAHBRBJDHDDNCVQDABB@JDRFPLBJJHDNALBRDDBFFJVH@FCHBBC"],"encodeOffsets":[[100653,29072]]},"properties":{"cp":[98.854304,25.850949],"name":"怒江傈僳族自治州","childNum":1}},{"id":"533400","geometry":{"type":"Polygon","coordinates":["@@EIBKBAJIBCBGMSBGAGBKAKCCCBCACIDCLEDEBMACGCCIDIHE@ICGBIAOJO@ACIBKEcDGF]@kJIHQ@QI]DQ@MHI@EEMAQHEHIEICGCQJ]AOCI@KGOGEKEDM@GAGKSCUEMBEDCAUBI@CEKFIF[P_E[@GDCFOJGLOJQ@IEIACFO@EGKGGBEBEVSFI@ECK@GLKDEEUBGBCDA\\GBCBEIIAGBCNCDAHGBIOOAA@EDADAVCHEBAAEEIEIAIKMBM@AF@DG@AGI@CDEDMFG@GDKAE@EDEHEFEFU@GEEAOIUBE@cFUIKUEGECEFGDAHGDKCMDENGNUFGPIDECO@CDAH@LEDKFCNCH@DA@WLQ@ODGVIVSlIJIHOAUCIEACCAKBADCHAHBJFFABCCILKDEBKAQBCLGNCBCAGBCH@HHFAFODAHAJEFEDC@KPKDIBCFALDH@DANOHCLK@A@KDEPIFD@HGJEF@HILALEBADBHABBDEZBPNhBRVj@FJFDBDAD@BD@PATCHAHAFEFKDMZGLFDVJDLAT@TCFBFFFRJDHBZDJTNHL@FAPILIBS@EHOZAVTJVFDDOJCTCBCPEJGHOHEFBV@JBDHBBDELIJPNDD@HCRLJF@JCDBHHJDZ@BAFGDALDL@LCBDARBBFJET@DDDNLPNXJFFBFAR@FBDPFF@FAPIL@JBJHBDLFDFELFTAV@DDHBF@LCFCFQJ@DLJFDDFLHFNFTJFDHFAHEB@~XFFDD@DEFDBPDHFBDADMTFRABGPFTDHXTBDBFATBFBDRCH@NFXC^@DADCDANDJDDD@DHNFNFHLDNBDLFDBC@QBIBQDMBGES@EDGB[Cc@KFKJOJGDIEQAG@E`MLMDIhARCRDBA@EDCLADCNMLILOJCDCNOJC@I@AECGKBCNABAIGGK@CV@JDLHHBXCDC@E@EAEHIAKDCLGL@LEJ@FAH@HGPBDABGXKHIDEPADAJKAQDGH@FDBCBEBE@YBEJGPBJEFKDM@O@EKKBAFGDEBEAGFM@IFINMVCRIHANMB@JDHAJKRBJBD@BKFOHGLIEIU]@AJC@CWqBKBABALDF@NEhEFAJGNAVIHDJCFCJ@FG@IDEVCNKDGDAJDFAJAFEGGGqEAUAICCGBILMFCRAFAJQVMFG@ACCKGOQOCACLQ@AAESSIEGAaASEU@SCGG@CBEKGCMGCCDM@EJKDMJC@WWG@IDOBEGDKBCSYAGBMEEDEAABAFCBEFA@CD@BCH@FCFEBE@E@A@AB@AALQ@CFCFMBA@IDGBABEJOAEBC@AB@BIDAAAFIAEDADEBEDCACDIJGHMFCF@LED@DAF@FCPCDCHAJIT_FEHEJADC@ELKDELIBCJIFCD@JMLCDAFG@CDA@IHI@CIGSUEKQMAM@GDAJDJ@F@JKNCDGJCLKFAH@DBLA\\OZ@FANGPHLBXIVJFAJIJADC@CCIIKHEAIHKAGECEAYUEIAKDIJIVGBC@QEWHODO@KKOCICACK@MAKAKUMG[DEVGBAD[DICCOKACAI@GECM@CIAQEAK@CACEAKJSFOAEMEQAQC@IBIBI@OFQACMQaOCEAKKOIIOGOQEKCMEQCGICACBOHGDGV[FMLQDGFaHGDECIKQLOLMJMLKHOBI@QDGCQ@CJCBA@YEG@GCAOEO@ICOAMIGSSQAGGAM]ECGAGCWSAIGEOWGMACOMKQAIGIIGGOIEE@gIECQGECAECKE]EuBIDEFEFOB_FGJCDIBQFO@EOOEK@EDGNIBE@ICMEKOWEQCI@MESFc@GAG@ACAKBCACAKQ@EACGGBOEGGCQCYUWECCCIK@MCOOEAIBGJAHBFHLAPEJSR@BDJJNBH@NEHDLALCHGNDDBBJDNB@HCHMPGFGF@NANWVIFGH@@DLINENEHQJURCFAFBX@FCF_VEDE@MAE@EDGHQlCL@NSJINGHCHEJABYHOJGLARAPADGD[HCDAPEHEBaDQLQ`EFMHGHALADWBGBCDAFAPCFOHWNADBDCHEBK@KDAFDXADGFMDIFEFCJ@FFXAHBD^RBFW\\KXEDcRKHAHBPENGJOLKJBFHL@LBBHFBDBFCHCDMDMGEBEH@HCFOLKDADAN@NIJAH@FDPHNDX@FEFCAGBOPADFR@LCPKHE@BMACaMKICA_GCAAGDIBEKU@CDOAAW_KCOAICUEOAQFYO[AEEAG@EBEJMCKHMAAEAIIGU@EBCJGBEJMDGBOGW@CDI@KHENAAIBGFEJCDC@EFC@CQOKMAICEAIIMCKCIKCK@CGAEAOBOP_NeLW@CCAYCMIEECCGCIAAABADA@IBCLE@CBCF@JCD@LEDCIQ@G@CLEJICQBEDCV@DAHIAkBELEBC@M@AKFMBIAAA@EBEPGBK@CIiDUDILAD]@GDCXWVILANsJEFKHAFGAEFUAMEHI@sGUNGBYKKKEFCNKLA@C@CCOcSCCCLSJGJCREFAKE]KGC[MKGGACHBFFP@BEHCJSPEJ@FDFFDBDCHQNFH@DKJDLCFOXONCDIZGPALKRKXOLERCDG@EFEDO@KF]CCAAMNUNeJK@E@GY[OAECGKAGCACEICIGEAGCCACACBAAACQBODCBE@CDIBCBC@GDEAEDMBOAEACACJ@FGHSCOGSAIF[VMIGEEIECQCEE[DSIMAQJUBIDCDAFABKGC@EAE@CBCZIJH^DBJCL@JC@DDH@LLJBDG@UIQ@MFKJIBCD@DDFDB@D@BSXMXBJJFDHFTBDEH@FBJAL@P@DJNAN@F@DHL@JABS@CFMBEN@DDJJFDHEFAJ@DHFVJLTFZE`FHDJAFGFAD@PDFHHPFF@DBDdAZGXKNCLA@ABGCMDC@]KMHEJEFCBGCC@KHA@IKYCCBABJRARBL@JGJCHAN@DG@GDILAH@HLVFPHLALDRCL@NEL@DBRGHAHGJEJEFE@EHDLNVDTJJDDELCRCHCBAHMLE@DT@DEFMDCB@DBJLHDRFJHHLFBRPRDJNN@BCDG@CD@LCDGFCNGDILGLIJQJUXQASXQLENETDFVL`HNJJPBHCH@LCLEHGDCFBFERDNAH[^BXFV@FCDCDIBEAECOQGCC@KDCDCHEHGDGLCBABBJJLCJBLCBGBIJANANEFAF@BDPELDZFJEFAFBJFJAbDND\\DHCPAB@LCHAL@HJVKB@XGJGREBQ@EBCF@HCDQ@IDABAJHFH@JGB@@BCRGLAHAFGF_A@RKXBNAJCBKAI@CNABMDChBNABOBANIXGJFHJJFHDZCBDFAJDD\\HAHDLCRBHERJXDH@BKR@FDLFVHJJFJDXFLFNbEFMLIJGRBJCHGHSNATIDQB@BDHDH@LAFYhEFOF@DHHBDYjGTBLSAOHUHKBU@CBEJIV@LDHHHDPLNBD@FADAFBLJJSHCD@BFDFLCJKLCJCH@BHJBBADKLALGJLHBH@FADCDCHADGFENCLDNOJKP@DDJCN@DV@TCFBZHFDFJDP\\HPJNFNLNVDDAB@F@HFDCJBJ@DCDIBADBNFP@DCDCDGBAJABGBEDANCJBDDB@HCBICA@CLAJDLBFHFBB@PJJHDABSNGNCHAL@LELAHAD@FCLBFBBLFHNBHCBK@AD@DLPFFBFEBKACBCDGPEBIACF@DBBHHAJ@BEBQDAHDFLD@JNBHAJDN@FDBANAJGD@HAH@NCFBFEPAJANDBFJDBLJHTFJLRBFDRXTDDAHK\\AFK@EAAEA@ABCHCJG@EHGJEDKBIRS@IGUAIBCFCPG@AECACAgFKJEFKICAC@G@OHIBEQOB@NCDCBC@KCIBGAOJILEFCAMBCXINDJLPDNA\\EHIH@LDHADBHHJBBBDRCNPPF@HEHAP@FFFDH@JINDDB@JGR@DELLJDHBJCFKNUEGA_RMFGDMFAB@LCPGPLLDH@RDPDLETBFHPBFATBFNNZAJBDDBHHLHR^XLBFBFHHFRFJ@HDFJFN@TGVIR@LIXCDGRGJQHCDI\\CDE@GDAPERCb@VBFRHFD@fDJL@^EHETCHEJIFADBFTBDNLFBTBbDV@LLNBFDDHR@"],"encodeOffsets":[[101493,29923]]},"properties":{"cp":[99.706463,27.826853],"name":"迪庆藏族自治州","childNum":1}}],"UTF8Encoding":true}); }));
180159/adminDashboard
public/vendors/echarts/map/js/province/yunnan.js
JavaScript
mit
62,868
/** * selectize.bootstrap3.css (v0.10.0) - Bootstrap 3 Theme * Copyright (c) 2013 Brian Reavis & contributors * * 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. * * @author Brian Reavis <brian@thirdroute.com> */ .selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder { visibility: visible !important; background: #f2f2f2 !important; background: rgba(0, 0, 0, 0.06) !important; border: 0 none !important; -webkit-box-shadow: inset 0 0 12px 4px #ffffff; box-shadow: inset 0 0 12px 4px #ffffff; } .selectize-control.plugin-drag_drop .ui-sortable-placeholder::after { content: '!'; visibility: hidden; } .selectize-control.plugin-drag_drop .ui-sortable-helper { -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); } .selectize-dropdown-header { position: relative; padding: 3px 12px; border-bottom: 1px solid #d0d0d0; background: #f8f8f8; -webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0; } .selectize-dropdown-header-close { position: absolute; right: 12px; top: 50%; color: #333333; opacity: 0.4; margin-top: -12px; line-height: 20px; font-size: 20px !important; } .selectize-dropdown-header-close:hover { color: #000000; } .selectize-dropdown.plugin-optgroup_columns .optgroup { border-right: 1px solid #f2f2f2; border-top: 0 none; float: left; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .selectize-dropdown.plugin-optgroup_columns .optgroup:last-child { border-right: 0 none; } .selectize-dropdown.plugin-optgroup_columns .optgroup:before { display: none; } .selectize-dropdown.plugin-optgroup_columns .optgroup-header { border-top: 0 none; } .selectize-control.plugin-remove_button [data-value] { position: relative; padding-right: 24px !important; } .selectize-control.plugin-remove_button [data-value] .remove { z-index: 1; /* fixes ie bug (see #392) */ position: absolute; top: 0; right: 0; bottom: 0; width: 17px; text-align: center; font-weight: bold; font-size: 12px; color: inherit; text-decoration: none; vertical-align: middle; display: inline-block; padding: 1px 0 0 0; border-left: 1px solid rgba(0, 0, 0, 0); -webkit-border-radius: 0 2px 2px 0; -moz-border-radius: 0 2px 2px 0; border-radius: 0 2px 2px 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .selectize-control.plugin-remove_button [data-value] .remove:hover { background: rgba(0, 0, 0, 0.05); } .selectize-control.plugin-remove_button [data-value].active .remove { border-left-color: rgba(0, 0, 0, 0); } .selectize-control.plugin-remove_button .disabled [data-value] .remove:hover { background: none; } .selectize-control.plugin-remove_button .disabled [data-value] .remove { border-left-color: rgba(77, 77, 77, 0); } .selectize-control { position: relative; } .selectize-dropdown, .selectize-input, .selectize-input input { color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; -webkit-font-smoothing: inherit; } .selectize-input, .selectize-control.single .selectize-input.input-active { background: #ffffff; cursor: text; display: inline-block; } .selectize-input { border: 1px solid #cccccc; padding: 6px 12px; display: inline-block; width: 100%; overflow: hidden; position: relative; z-index: 1; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -webkit-box-shadow: none; box-shadow: none; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .selectize-control.multi .selectize-input.has-items { padding: 5px 12px 2px; } .selectize-input.full { background-color: #ffffff; } .selectize-input.disabled, .selectize-input.disabled * { cursor: default !important; } .selectize-input.focus { -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); } .selectize-input.dropdown-active { -webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0; } .selectize-input > * { vertical-align: baseline; display: -moz-inline-stack; display: inline-block; zoom: 1; *display: inline; } .selectize-control.multi .selectize-input > div { cursor: pointer; margin: 0 3px 3px 0; padding: 1px 3px; background: #efefef; color: #333333; border: 0 solid rgba(0, 0, 0, 0); } .selectize-control.multi .selectize-input > div.active { background: #428bca; color: #ffffff; border: 0 solid rgba(0, 0, 0, 0); } .selectize-control.multi .selectize-input.disabled > div, .selectize-control.multi .selectize-input.disabled > div.active { color: #808080; background: #ffffff; border: 0 solid rgba(77, 77, 77, 0); } .selectize-input > input { padding: 0 !important; min-height: 0 !important; max-height: none !important; max-width: 100% !important; margin: 0 !important; text-indent: 0 !important; border: 0 none !important; background: none !important; line-height: inherit !important; -webkit-user-select: auto !important; -webkit-box-shadow: none !important; box-shadow: none !important; } .selectize-input > input::-ms-clear { display: none; } .selectize-input > input:focus { outline: none !important; } .selectize-input::after { content: ' '; display: block; clear: left; } .selectize-input.dropdown-active::before { content: ' '; display: block; position: absolute; background: #ffffff; height: 1px; bottom: 0; left: 0; right: 0; } .selectize-dropdown { position: absolute; z-index: 10; border: 1px solid #cccccc; background: #ffffff; margin: -1px 0 0 0; border-top: 0 none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); -webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px; } .selectize-dropdown [data-selectable] { cursor: pointer; overflow: hidden; } .selectize-dropdown [data-selectable] .highlight { background: rgba(255, 237, 40, 0.4); -webkit-border-radius: 1px; -moz-border-radius: 1px; border-radius: 1px; } .selectize-dropdown [data-selectable], .selectize-dropdown .optgroup-header { padding: 3px 12px; } .selectize-dropdown .optgroup:first-child .optgroup-header { border-top: 0 none; } .selectize-dropdown .optgroup-header { color: #999999; background: #ffffff; cursor: default; } .selectize-dropdown .active { background-color: #f5f5f5; color: #262626; } .selectize-dropdown .active.create { color: #262626; } .selectize-dropdown .create { color: rgba(51, 51, 51, 0.5); } .selectize-dropdown-content { overflow-y: auto; overflow-x: hidden; max-height: 200px; } .selectize-control.single .selectize-input, .selectize-control.single .selectize-input input { cursor: pointer; } .selectize-control.single .selectize-input.input-active, .selectize-control.single .selectize-input.input-active input { cursor: text; } .selectize-control.single .selectize-input:after { content: ' '; display: block; position: absolute; top: 50%; right: 17px; margin-top: -3px; width: 0; height: 0; border-style: solid; border-width: 5px 5px 0 5px; border-color: #333333 transparent transparent transparent; } .selectize-control.single .selectize-input.dropdown-active:after { margin-top: -4px; border-width: 0 5px 5px 5px; border-color: transparent transparent #333333 transparent; } .selectize-control.rtl.single .selectize-input:after { left: 17px; right: auto; } .selectize-control.rtl .selectize-input > input { margin: 0 4px 0 -2px !important; } .selectize-control .selectize-input.disabled { opacity: 0.5; background-color: #ffffff; } .selectize-dropdown, .selectize-dropdown.form-control { height: auto; padding: 0; margin: 2px 0 0 0; z-index: 1000; background: #ffffff; border: 1px solid #cccccc; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); } .selectize-dropdown .optgroup-header { font-size: 12px; line-height: 1.42857143; } .selectize-dropdown .optgroup:first-child:before { display: none; } .selectize-dropdown .optgroup:before { content: ' '; display: block; height: 1px; margin: 9px 0; overflow: hidden; background-color: #e5e5e5; margin-left: -12px; margin-right: -12px; } .selectize-dropdown-content { padding: 5px 0; } .selectize-dropdown-header { padding: 6px 12px; } .selectize-input { min-height: 34px; } .selectize-input.dropdown-active { -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .selectize-input.dropdown-active::before { display: none; } .selectize-input.focus { border-color: #66afe9; outline: 0; -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6); box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6); } .selectize-control.multi .selectize-input.has-items { padding-left: 9px; padding-right: 9px; } .selectize-control.multi .selectize-input > div { -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .form-control.selectize-control { padding: 0; height: auto; border: none; background: none; -webkit-box-shadow: none; box-shadow: none; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; }
amwmedia/cdnjs
ajax/libs/selectize.js/0.10.0/css/selectize.bootstrap3.css
CSS
mit
10,217
// Generated by CoffeeScript 1.4.0 /* Sticky Elements Shortcut for jQuery Waypoints - v2.0.0 Copyright (c) 2011-2012 Caleb Troughton Dual licensed under the MIT license and GPL license. https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt */ (function() { var $, defaults, wrap; $ = window.jQuery; defaults = { wrapper: '<div class="sticky-wrapper" />', stuckClass: 'stuck' }; wrap = function($elements, options) { $elements.wrap(options.wrapper); $elements.each(function() { var $this; $this = $(this); $this.parent().height($this.height()); return true; }); return $elements.parent(); }; $.waypoints('extendFn', 'sticky', function(options) { var $wrap; options = $.extend({}, $.fn.waypoint.defaults, defaults, options); $wrap = wrap(this, options); options.handler = function(direction) { var $sticky, shouldBeStuck; $sticky = $(this).children(':first'); shouldBeStuck = direction === 'down' || direction === 'right'; return $sticky.toggleClass(options.stuckClass, shouldBeStuck); }; $wrap.waypoint(options); return this; }); }).call(this);
joeyparrish/cdnjs
ajax/libs/waypoints/2.0.0/shortcuts/sticky-elements/waypoints-sticky.js
JavaScript
mit
1,190
/***************************************************************************/ /* */ /* cff.c */ /* */ /* FreeType OpenType driver component (body only). */ /* */ /* Copyright 1996-2001, 2002 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #define FT_MAKE_OPTION_SINGLE_OBJECT #include <ft2build.h> #include "cffpic.c" #include "cffdrivr.c" #include "cffparse.c" #include "cffload.c" #include "cffobjs.c" #include "cffgload.c" #include "cffcmap.c" /* END */
diwu/CCB-X-Reader
ccb/libs/cocos2dx/platform/third_party/marmalade/freetype/src/cff/cff.c
C
mit
1,470
(function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['exports', 'echarts'], factory); } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { // CommonJS factory(exports, require('echarts')); } else { // Browser globals factory({}, root.echarts); } }(this, function (exports, echarts) { var log = function (msg) { if (typeof console !== 'undefined') { console && console.error && console.error(msg); } } if (!echarts) { log('ECharts is not Loaded'); return; } if (!echarts.registerMap) { log('ECharts Map is not loaded') return; } echarts.registerMap('宁夏', {"type":"FeatureCollection","features":[{"id":"640100","geometry":{"type":"Polygon","coordinates":["@@[ŅUco•YkIGĩË@ENOBEZEH@BCVGHCRQ^aRK„Yv[ZIVAhGPCRIvMfQRAZSVUbQVGŽKPC@CFGUKGQCMBSH[НJSEGmUQBLYgSeHECWBUJgBGV[DAPHHBrDDAG]DG@[FBCV[VP’GA[GYMYWu{‰sUoOWECCE_FgF‹DMAk¹FÅ`KY}WkMEGCJOTGJSLONW^OJja^[\\EFcTUJaDaZYLS^GJaRg^BLM@CDKAIBSBUH@H@BUJCHGF@DGLBDFB@BIFFFBDI@BFE@@BJTCD@BJBADHBzB\\FD@FCTBBBXVHRID@xIBaBA`EBw@MLADBFJDTV@B]TIP@FABQJUKA@M`GDCD@BH@BDADIB@JEFDD@DQLKFEDKVCPIJMHSFAFCFBD@HHXHHTJFH@LS^CJBHiHABGHSFDPCBKCOBIDMJIDOAEAAAMOGIGBArED]JFF@DAD[FAAEGC@WDADJJADGH@DNDADMD@DNFBDADIAAAWUICCCCKAEWUEAkRMBEHAG@GGOsLEGU{AA@@s`HRVjbzGL™`aJEFGJGDGLJLXFTHNBDQZ]\\K`GJIHAPIJCLBFFLV^@DGXENBVDNGJBFJHT@PL@DINCPKNCRJJ@NPPAJENBLXPJJBV@TCPIT@PFNBBVFBBDHBHADKHABAJCJOLARELAH@NDHJLNJJFFDBFCNBFFFNJV\\BBAJQ\\@FBDTLHJJDBBDL@JCNCFCDADFRFHBDKJGHAL@HDBVDFFPFLLR@BBAHBDLNDFFHVPNFFHDLTFXRHLDLLHBHN@jKZ@NAFAXUJ@PITIRI\\C^ADCBMDILGFEDANCxAJALEV@BKLCJ@`PPFJIHQBCH@VDFAZMJGLA@MDAH@JBPLXBDAEI@EBEHGJAVBHHXENEfDRFBGKSAKnEAK@iHE^GF@JFNEP@FKMODQBEhNLPZ@NC^O€ALGLKXEjEr@@[EOKIbChM`GHGAgPK"],"encodeOffsets":[[109223,39528]]},"properties":{"cp":[106.278179,38.46637],"name":"银川市","childNum":1}},{"id":"640200","geometry":{"type":"Polygon","coordinates":["@@J{AQWËIO¥‘ue“‡_]gkEKCCQWEKWYcqŸ{MU‘ěYZOLBhGH_HgNaDLJFP@\\q@iFWFKLKHB]PMDY@KOgMAFCRNPELO@MFIEE@]HGF@jBLmFBLLTAHQEeCMFWFGGUAIBGHAH@DFJABYAOKKAG@APKBIHYNEBUCG@ADGRIJOE_OI@KDALU@KFIBwBQFQRCFANAD{FQJSJOJI@WVEBMBY@iLM@@@GB[CKLOVCNANHNNLZRFBZRRZNN\\NLBPATLDJ@JJTFFLBHNLNDJBLABGHGFEHFHJH@@IFFN@RJZLNDVJLPLHJL^JNFJLR\\bVP\\FNIHMRORERAHAzENGJALFNHZHPHDDBJLTDLCPKVAR@JDfCLAVGVC`BFHJLHJ@ND\\ANDJA^LfH\\FLAVDNBJBPCV@`CPEbCRGBA\\GjGHBJHBF@LJF@LBDDBALFBDFCFR@NPJBFFPFDDBDHDFFDHLNHDJHJRRXDFJHzSPKJCjEV@LBXRpTVCLBTLNDD@DIDELAV@TALIFIP[@CIO@ELQPO@GIW@SH_COUaCM@IJGFKAICK@MLKXKXQHYHa^uLkJQXUVMlMFCDAFAFBHAF@VGFBHIHABEBIDCPBLKDCJB"],"encodeOffsets":[[109535,39993]]},"properties":{"cp":[106.376173,39.01333],"name":"石嘴山市","childNum":1}},{"id":"640300","geometry":{"type":"Polygon","coordinates":["@@HCPDTCNDFF@LDJLLJLDBHAHIhETADBLFD@DCRODGXQ^GFIJOPK`IbEVK`AN@lQHCFKPUPKLEDOBC^UPOVaFCLAZAVCJEHG@EJEBAo…KYBCNK~ORR`Ff@HERS°ÜkVMJCLID]SqG]KSggK@KDGNEDEJC@KCGDBLEBGCIG@ABCJELBF@@A@EM@YMg@{GoMIKG]DYCWCMGOMMYQOCI@mII@EBUNIBgCEKJ[zIJAA[CCgHEAomCCQK@CDGGEGCOGeBCCGA[HhsXEtNHIBGEICOCECSESEKIGESIK[UkYGC]IMMCG@SBmAQQ‹ESSg@MBCDWAIIOAKFI@GHWL[FKLILEBCJCBEDB@EDC@AFABCAAHEACDEBB@EDABKDAACBEACBA@C@CAAE@SFGBOGUCEC@C@EJGXM^URIFEJB@EFCBCE@FCD@BABIDA@GFAACDA@EFAACDAACDEBEACDCEABEB@@AGEFCCEBAAABCEADCGCBCAEBCKG@CCCEKECC@AC@CG@BGIMKRIFADCAEFADCFEF@@CBBBABAAGFEACEHEBM@@KACEHAHDD@@AGCBKHGJE@AMFGAKDgNEAIKME@DCFA@@DC@GJCBADGBADC@CDCD@BGFCFGBADKFEFGDORUGK@UCE@KCI@KCCAGCAAEAECGACBQE@COKEACFGDGLE@IFG@IAGCCCC@SHEFGAQPGBCDIQ@ABIDCBGDGAQC@ADGFE@QFICIJQFIGDAHCBGJC@AGCIDM@UFKBODAD@HINWTKDEDGDADKDABM@SJKCAA@GKECA@CZMB@DBNADMDCUA@K@CHCBEAAE@K@CAGEACBGGAIHKLUPWCG@]XGFCCIJEBIJCFEFGDS@UNADCDEBCA@BGDCAE@@@DAEAD@DCFE@AEEC@CL@AEA@CCMEABECC@CJQDE@CKKCGIGGIDENGEIASA@KHGJCJDFCFIBKACFBHACCAMJ@NDJABIAQAKDQGGDGHGNAAKKISECGACFALAHEDCBUESIGTK@GFOFEBCAACDGEFA@GCCCBAHIFM@EJMFQFGDAFMLANQHS@EAEBC@CDEBOFGACBGNI@KHEHCBCKOECQJE@IADE@C@AHIAECEEODKGMBKFKMB[GCDEAEBOBSJCDACGG@K@EDEBMDGGAGCGCGAIDGLCFBBH@FCHDUVBDCBCDGBGFQPGPGFC@ACAIFG@GNOHMFEECAECIBELGFBHIPCDDNALIFINANCHKFEBIECCEFK@CCBIFAABC@CFGHEACDABEHLHBBHNFD@JEDELG@AAAGBECAAFEBCHE@ECAKFDE@AEAGECBAAJE\\K@ACAFGAC@GAE@GGENAJBACBCBCPIBEC@AC@CDCAEE@ECEFA@AABIE@CA@CFC@GAGEE@CEB@EAADACCDCAA@A@CBG@ECC@KCEAGK@AAJOCKD@@GFEDADEJABCBAAAEAKFECA@a^@@ACCAAIKNCHG@IL@FCBG@EKAAEBMDC@@A@EEEDICCG@YJA@AIAAG@EAABCAAIEBIHAC@GIEGEKAEEJK@AD@DCBEBCLWC@KDAC@AGACFA@CDAACBECEB[KAC@GBIHOCOHKDK@CG@@AC_SC]MKBEAEFSDEACBEBKRCBAA@I@ASGACEDI@MISDMBE@ICHG@CACEEO@QCyQ]KUBEBMTCHOBKAOGABCNUJIDCC@C@GMKC@EDQFIB]EEACG@M@UBGC@IJUBYCWOEA]RCVGNLZAJgjYLAZW\\A`y|SlHd[VU\\cXD`E\\qd[CMJOEIF@H\\XILBX_TCTKHI@AJJB@HiZAREBK@CA@I@A]QGAECEBCFEBC@IELQ^[@IIIKEDGIMOQIEKECCBKACCCSCCA@GGE[GECCO@OCOIEEACBCN@NCJKJODKAOEKGM@OAOBGJC@WQECA@ILBBDHGPCNAZ@JDHJBJD@HEXBH\\^ABGLQJOND@HEDBJAHCFETCAHBFLJJDJ@BJDFBBF@HFRJDDJDHHPDLJDD@FDDALBDADDHBBB@NHD@FDF@MNÔ]rED}@MJspIF]H[NOXKbAJFFBH@RCFEB@PADCDmAGAkPWBIA[@IBKHCLMJSDHDT@LBDBBDFB^ARDf`LFLJZZfTJLFDB@HGBCGAAA@ADCBIHCHGHUFK@OGEACAGEGACLEBEDC^WJI@IZBX@LDL@FD`BNDNJADE@CHBDBDFADBDDADKHECCBAFBFADB@DCD@@BABOJDHF@@BEFMHCAGHBDABDDGDBLED@DCB@BCD@HAHQZGH@BjNNBZHLLLBJFDNBBŌUPHPRDJBF@HGHKHKLWLU@aRWDIDoZKHADDFDRDBDBhG^@DBAHSb@BPPNFpJD@LGDCB@FDL@DBFJAZžLB@ABEBBDEABDE@FFE@@DEB@DGFABA@BDIECDE@ABC@AFPDJAR@NHHALEH@HFLBLNBLDJBFDBNLNFFRFDF@FCL@FFBDFDVFLADBBBIJGFMTOHYBMHEJDBDAB@@BsrILEN@DDPJHZAHHCNAJBHFH@JALEDSFIJCB_@KDEDEBW@OCM@SHILEDEB@CBK@EAIIOKGGMKMEMAMAAAAkBABFHRN@DKRCLMH@DDDBD@JCDJPFXBb@fVTFFCXABMEUAcHW@QUGD_HGBICQDUBQDG@UKWIM@Y@qHGCUCKCS@OAaIUIEIgEgAFHHX@€LrHDNDL@JAREdCNGL@tPTFNJhJNHRHXVN`DPFJFJXXLLDHFTC\\EREJCNAjBNBFXlX\\P`PVBF@HCHCDMXUXS\\_`YdQpG\\BPAJDPDrFRAHBPLXDHPNHJRLLDXJZNRNBLTfŽIB@HKHCHIFEbIš_HKayUiGQt_X~FHtKHP@HBHFGNAlQFBXVBFDLDDJDXVBBJBBCACME@CNCBCMC@CHGBCIIBCXCD@FHBB\\EBC@CEE^IFCBqHAHJNPBBFBPBJCNIJCPALDDACOTEHGBAjGAGDIT]@KEGSIGGGW@GACDEBETENGJIDOLUFCLERK@CCCFE@IJABCACG@@ADCHCN_B@VLRIBA@EJO^S@ASUICAEBCNKx@FAB_bAJA@wJCGQWUAASAEDC@[EyAGABCIA@ADCIS@AF@AEJ@ACEEJE@AEAACHK@CHEDGVI@A@GVGTAJALBDCN@AKh]bQHIT]ZKbYbCVIdSFE\\[b]ŽiPIX]PMTKHIPSDIFHlN~XLZÆ_ºEBlCNEŒEhF`DDXFpPtV|ŠXvNZHZB\\‘HUOU\\ADEŽ@\\CHH^CBqCGAOGCBU\\AHIhAVDXGFTfZhŽKRAnVFHIT‰°G\\ATDNHRVLEH@DQZIVER@bM‚QÄUL@DLFBJALBRGJAN@DDPNDHLHFAJGTGB@HJF@"],"encodeOffsets":[[109666,39051]]},"properties":{"cp":[106.199409,37.986165],"name":"吴忠市","childNum":1}},{"id":"640400","geometry":{"type":"MultiPolygon","coordinates":[["@@AKGACBBDABD@BDDDD@","@@AGBAC@EJBH","@@@@A@OLBLAL@BD@FGLG@AEIBG","@@FCBCCIFG@CCGAKGIKCKKAC@CEK@AHAHEDG@GGCCICDE@ALKBAIBKAC@IGGBAHCXFHCLQB@FHFCJABCCEACBELEDEAECAI@MHODCBCCBUACC@CECAB@AA@DEBKEBAAA@HIDANIBKAGDI@CCAINIDCNKPIFCHCCGDAAOCAABKNOLSBGFEH@FIHADGDADIFBDHLBHCLKTGJKBADBDHBBHCD@DBHFFJAFDD@FELBFCHDH@DJEF@PEDBBCHFF@@IDI@AD@DABCDCBEDJF@@DBDCH@JDF@DFFD@B@DGBAB]DEFBBFF@FKD@LGD@HCD@BLDTHHB@HEEAAC@GDMAIDGLCDBBRD@LGHDDHNBBB@AHAADABHDHGFSNQBG@ID@BEDAJB@CDCLGBFDDTINJ@AFIFC@DFAJMRIBABABBDCDB@BD@DED@DCBRBDD@PKBPHBBAJCFGBEDABCHCDABHDDADLDDDDCFB@CJGFXHDJQD[AB@CD@DEDBFC@@ADBDBDF@HADBAC@CJIFIBQFEFCDED@DDDAFE@CJMF@DDJBBA@CHGFKHCFACIEGDECIACFGD@BDDGBAFBCK@CDFDG@JBJDBHLFB@AAMAG@AESHEHDHPHHDAHGIE@GAABMABA@A@AAE@PMP@DU@B@FDC@FDABC@GCGDC@IDAEAGB@@DB@BM@DGAEBBBAAEMCCACC@GACBCFABBJ@CEE@@C@@AK@WECQC@GAEAM@GFCDCRAFENBAGCABOCGGGQEGKAAEDA@AKIEEK@]ACC@EDAF@JDD@FCDEDACEBGCA@BHADA@CCCDABAAHUBKFGFCJCDBTCFPDDFBHAH@FFHKBGDC@CGQGFEACEMGMDCDGDGI@CAAEBBO@IG@IHIDE@MESSA@CDIAEDA@BCECDCDI@EYK@CFGJCLATCB@BHBBHEDE@EDEAEEDCBCFE@GG@CF@BCJ[@ABBABBJD@DCAOBCTU@CJGDEDATJBADCJSEE@CBARABE@CCCICA@EFCBKAGBEDGAAEDCFBD@BSDAHBBAEABAHBBA@KECHKGB@ABKAEEAMNCAACCOBE@AWBA@DJ@HCDQJE@C@EE@CBGCSB[CKAAIBMJGBMCMBCKCBCJEDK@EAAC@ELQAAEDEEFC@EEKKKIEIBEFALABECCAED@DC@AAA@CHGAAAA@EFIE@B@JCBEAMIC@AFE@AABICWDEKGAADEJDD@DKAEGAIDE@IEEFAEA@ABAFA@GDYTiVIJAJA@CCE@ABHHABEBICAIEG@AFK@AKF@GEBEGI@CBGNAA@GCAG@CBCDOFQXCX@HCBC@EECK@ICAAB@PADE@AHABGBCC@E@EFEAEGGC@KDO@EHK@GHCBS@KDKAMBCBK@ACBI@QCAG^K@IEK@GBSAECBC@AKEDC@ECA[EMCU]EEIMEAE@MG@YBGFG@ACC@CBCLDB@BQFGBETGCIGEAGDELGJIBCAI@OBAFCDCJ]AGDCJEBCA@EAKDMHG@A@IWEQCIACFKCKDABEMEMO@AFMLADCCG@EVIFEBKDGAUJCNDH@LDD@BECSESJAIIAGBGHGR]BOHEBA@ACCKSEUBAFADICG@KJIBECEBAPMAAG@KKIBACCQEGFOAAIGIMECEECCQEK@@CCAQKACEAADE@CAAAKEEKGECKGEC@IHC@GGWCKGULI@ECAEDKLQBKACIEACKIK@CBEFANABGDUAGDKREDGBADDN@HMJGLIAIBCDAFEDIFGF@FBDBHOTITMBK@OJAHCPGHIHAHDHLHBH@FKHG\\@FANCRS@QFC@CCOAM@KBEDCHEXC@@CCACAAD@PADIDECCOEMQG[[SKK@DGAECEAKEGBCAEC@CDE@ECACHMAEI@CBCHANGN@FFFBDABMD@FFH@FABY@KXDFBHMRDJ@HEJ@F@BGBADD@BAHF@BCDE@GHDJBFCRCNAB@JDDLBHAH@BBH@DJBBLDDB@FADGHCDQBICEGBGCOCCC@ABCVCBAA@EAAE@CBEBCAA@@CYCSCSAEBAD@JKJADBBH@DFATCDG@CACEC@OLGDQBIDC@EBUA]JU@[FQBMFGFCDC@KCM@GCBGAIUBIHGSAOCMCCGCGYIOEAC@KJAdALFJADAD@NANCDSIADFHFF@DG@CJADFJEHAJELMIMCEECBOREHMH@BEF@DB@J@DD@DGFDBABGFODI@GBKJBHCBIACFBDHBJ@DD@HHNADGDCACEAGGEQF@FFPAFEDG@IAEEE@KNABE@CB@BADFPHH@BAHBDDBBD@DEJGDMBIJYEABBP@DAJJHHDJCDBBFHHDNFHJJF@BCAGAAFKBUBEH@LCFBHLLJFJDBBDFPAFEFKCEFC@GEAICAEBMPEBK@CBEHI@EAGGWHAB@PABI@C@AC@KAAC@EBADAJAFABG@@AIAIEEBCEG@CCMAECACG@@CEAOGaEMECC@CBCACSBICMDI@@CFMDG@GCKGCEGC@CFCPNVBJCJILEBWDQKC@KJE@WGKGC@GHE@IACFCBSBGFAFG`ADABGDEAKII@@PDJDXAFSLMCEBIPCtALCBEAIIA@ABANADC@IAYUEIKWEEEBCDIRBDVX@BKEE@CBBFDF@DEVGNAD^TLMHABBBDBLCLGHKHMHICGBKDMLCEKAQHORKZAHFFFDF@FADBENAZCFQNAFBDDDBFFFF^ANDNCjFFD@AB@BH@@PBDEFBFBBABDDAFDDBHFAFBDANFDAJ@ELCB@DFLJJFABHLJH@DBDCDLDEBD@RBDJ@FFLIDBT\\HFFBLVJ@DABBB@FIBHH@FBBCDABDJHH@DABCFEDBDCDBDABDB@FEDBHABBBDFAPfBB@FENPCBJDLNPCFQLGF@LKFBFENGPBFAFNABFjVRPVN‚XNJLDNBDED@BCVCFI@O@CJGLEJIFIAIFAFCLEDGFAHK`WLKNI\\EH@LDTZPJXDXAPADBFHHDJ@TIJOLWYUKEGIDEL@LHHDJ@JCPBPFH@JCFKBMBCJEDBRNVXRHPLJ^LRRVRLCPALBJBJDDr@tEX@JC^Q^MZCR@E^AbMlQ`UlIPBHFHNDDBBHCLBFHH\\C`GHJBJJJ\\@fLFAJEVIDBBHBFJ@DALO^OH@NLLDJB^@bN`HPFZDFDFPFHpffTFBF@\\CJBDFBJNjBBJGFANBJHF@NCHBBBAVBNDNHRPX@BA@KKEAC@@RCXGHBJJDLFPBLNDPVADDDJHHLFF@LFH@dKR@PHDDAFNCHELBJFB@RSXUHAJFHGFDDAF@FCBMLMH@BDF@CFFPBBB@PS\\E","@@R@DECGIMAMFIEGFIAKCACJI@EB@F@FKNAFEBGCGGMAAA@EOK@EFI@CMIC@ABBHAFOJAADGAOACQAKCEAACBCKCCACAABELABC@EGO@AC@IA@A@IFQBCCGGE@EAMCCCO@KGCDANELA\\BJBFLH`DB@FGH@DBJBTPJ@PBFFL@NFHHJBFCRHDDBBF@FBJ@D@FBFFDBLCNDLJHBNCFDFB"]],"encodeOffsets":[[[109061,36594],[108620,36306],[108619,36271],[109075,37357],[108594,36341]]]},"properties":{"cp":[106.285241,36.004561],"name":"固原市","childNum":5}},{"id":"640500","geometry":{"type":"Polygon","coordinates":["@@CCOGG@I@[JGBG@KEE@KEGGCICCUBCOIKAAOAKEICAE@EFABCDW@QD@FBLLB@@AOWGQCMAMBUAAGAMDE@IGMAEBIHAAMiAICEIA[DE@EAeSoeEGEOECYCOE_GaM]@IAKCMKG@]PKPCBI@AEAGCAUJIFEBeK[@IIAIGI_H[DGGAEDKAGCAMCEGAGJOVkR_NkBaF]Q@YD]N]RIDW@sFq@CCAIAIBKDOQKQUKQI]OKQGUWQMCAIFADANELIDG@OEOAIDI@GCKGK@CFHJLFZVKXIPSJI@GCEGCAOBWBWCOISYKCG@[FMJKL_XGLEBCHKFEDEBBJEJIJKFIH@D@PEJUDADC@CFMAKCMIWUMQOiUAEMBGJ@LEAABBJ@FEHEBADIFKDGFEZBHHHHPENGJ@HDDJJL@DDFR@LGNIJOJCFCFAPABQFU@EFMD@PABEBCDADDFG@ADC@EDAFCDBBABEBAF@DELB@X@FD@DFHINWBA@In@LFX@HCBIFGFAFED]G@IAAABIJAFBFLX@JBFCDELBLDFAJCNGPYVIJMHCHQNINC@OEECIKCAC@EDMBGAKECHEAA@CFAFEACBEFA@EAEVQDHNTJF@JHH@DBELDLAFIHGPBBHFAFONUCKXE@@B@V@BO@CBAFE@CDGACBADFFAHFJBTFJEJa`M\\@JAHBDFJFDRdTJJCP@BDAJ@DBB^@^EFB@JHJ@DBBNCP@NCRMH@RBTRHVHBHD@FI^@LCN@JCLIAOHQNKFIJCF@LGDCB@FBBF@BHeTBBBHAL@HADGB]VWVEEC@ADFFIFEEE@OOCDALGEEDUJGCGDAEEAECBEC@BC@AYLFLGBBDHCBHC\\IZTEEF@BDB@HADBJGDBDGDCRBFEHIDCDE^@ZODUAOBS@ODGBMB_LGFOFOBQJOJKEG@MMEKAAK@EDCDaNF^SHYAEHAACGA@YCEAGBUR@~ANEHEDaF]TCFHR@DAFINEDIHMDBBAB@BDBCFDD@HBDGAEH@FGNCHIB@DIHYLAB@LADIHADBfEFBDADOJ_LKLABMBO@IJCACCKCEAAFCBAFGLUJSOOAMEEKICIIMECGWMW@YGKBGEIDI@IAIJA@AAACICUBECGAMBIFCNKHGJGDShAD@PHTLPDHADFDJBHAFF@JKLBHHFPBZQH@H@JLNFBXLJNFH@N@\\VDBPCDDBHFHAXG@UIMBIFSFODIDM\\AHBFHHDFDJBTBDPJBFQH[BGDCDSDGBQEQ@GDE@KNEBqB_FUGKAGCGHCBGBEDADSDGICAI@EGOGOAMDgEMBQJGVOTC@KCsKIEQEIIUCGIKCiD…KYAUP@N`\\hNJ@PIJ@bLPPNHjA`HFdR~VAFHĤHâHþRîNJBv`†XŽ@lLĈNbN¢xjdDDRFJ@VD~\\nLVLNLbPTD^B`JbDbPhNR@L@^F`BZF`APDHBXC\\CfQpEHBhApBh@¨H^@JDLJhBhFFJVJbJPBT@LDVDHDrGZ@N@XJVLH@RCVARCJDHA`GHCRVX@dGVBNFBADWEEUS@eAaEWIODC@IACCC@CNGDKLQ@CQMEGBAlABBBBBNFNLNHNLHJPBJ@FAL@DFAFCJKTGN@PDX@FAFCLC`@DAJITEFCBK@IEGAGBIDMGGYBIGCO@CFMJKtq@AA@CBCAFINGZAPGNSHEJIAACAKBUEECACEEK@EDE@ECEQMEMKCAAECIAKKMKAGEG@KFGBMGQ@IBOCBED@BAF@DCJFACB@BAHE@CFA@CF@EEF@ACFBACFABAA@KBYEICAK@ECA@CDKHC@oIMEOO@ATaBGCA]@gHCACACQCEBCTMhSJCXCbQV@XKDCTOHG@GEOOQOGŋVAACMIEKAKKYGMAiM@AHGRYBG@GDC@ADA@CFCAKHCCCBAACHGDBNGFE@AE@CGPIBA@AC@CDA@BCAEBEDAFDLGBCCCCAEBCEDIF@BCMIMC_AECK@KCW@YA@JIJ]XCDAFKFBDFHBHBDHF@PELGVGHGDAJCD@BBBHBADGHA@ECIKeSYYKIKEe_QC]BEAACCAKAS@GCTCNIDKLGJA\\@JBXAlOHBnBDCBC@OFADE@QAGEEBILaPW\\M^GJEtoNI~@FC^qžÓNME@ECC@MGA@AACGBCACBKCC@ECCKIOCGGICCCQIGEE@AACEAII@ICKIAEBGSDEFGDIBCAGFC@PMRIHKBA[]AGFW@GICIACG@IBYDMHOCGAAJKB@FDXRD@HIPAPBN@LHPFLBPCLIDI@MDMDAFBJFDP@PDPFD\\HHF@HDBTDDDBDALDDLFJFPRJNCHLFJJ@J]\\KRJFD@FADEFAFDLBPNJD@B@JDBL@FABQjY@GIABIJ@LGDS`SAWJK[W@GJEPFNI\\DrcF[C_dWV[\\UGcTkz{B_X[BYZKhiBIKYHMDU^QFBXPZDVAJID@AH@V@NDHFB^FJAREFCD@NL@H@DDDJCVIDMBAPHLBPADGNSFAVA^LzRRDP@FFBD@DGHJDF@NATCNJJ@FCBDTH@B@JDBNSFAFABCBO@ECC@EA@@KDEDCL@FEFABCBEHC@CNEM@QEM@@ABAJCHIAECAAIO@EEKFQASFCBADSPWJ@ADCACAGEIDGEGEDIJC@INKFEHC@CBA@BEEA@ETY@QXGNFN@JCJM@EJCJEDICAAEIE@A"],"encodeOffsets":[[108966,37393]]},"properties":{"cp":[105.189568,37.514951],"name":"中卫市","childNum":1}}],"UTF8Encoding":true}); }));
How2Compute/SmartHome
hub/static/vendors/echarts/map/js/province/ningxia.js
JavaScript
mit
12,942
;(function(window, document) { 'use strict'; /** * @module Ink_1 */ /** * global object * * @class Ink */ // skip redefinition of Ink core if ('Ink' in window) { return; } // internal data /* * NOTE: * invoke Ink.setPath('Ink', '/Ink/'); before requiring local modules */ var paths = {}; var modules = {}; var modulesLoadOrder = []; var modulesRequested = {}; var pendingRMs = []; var modulesWaitingForDeps = {}; var apply = Function.prototype.apply; // auxiliary fns var isEmptyObject = function(o) { /*jshint unused:false */ if (typeof o !== 'object') { return false; } for (var k in o) { if (o.hasOwnProperty(k)) { return false; } } return true; }; window.Ink = { _checkPendingRequireModules: function() { var I, F, o, dep, mod, cb, pRMs = []; for (I = 0, F = pendingRMs.length; I < F; ++I) { o = pendingRMs[I]; if (!o) { continue; } for (dep in o.left) { if (o.left.hasOwnProperty(dep)) { mod = modules[dep]; if (mod) { o.args[o.left[dep] ] = mod; delete o.left[dep]; --o.remaining; } } } if (o.remaining > 0) { pRMs.push(o); } else { cb = o.cb; if (!cb) { continue; } delete o.cb; // to make sure I won't call this more than once! cb.apply(false, o.args); } } pendingRMs = pRMs; if (pendingRMs.length > 0) { setTimeout( function() { Ink._checkPendingRequireModules(); }, 0 ); } }, /** * Get the path of a certain module by looking up the paths given in setPath (and ultimately the default Ink path) * * @method getPath * @param modName Name of the module you want the path of. * @param noLib Exclude the 'lib.js' filename */ getPath: function(key, noLib) { var split = key.split(/[._]/g); var curKey; var i; var root; var path; // Look for Ink.Dom.Element.1, Ink.Dom.Element, Ink.Dom, Ink in this order. for (i = split.length; i >= 0; i -= 1) { curKey = split.slice(0, i + 1).join('.'); // See comment in setPath if (paths[curKey]) { root = curKey; break; } } path = paths[root || 'Ink']; if (!/\/$/.test(path)) { path += '/'; } if (i < split.length) { path += split.slice(i + 1).join('/') + '/'; } if (!noLib) { path += 'lib.js'; } return path; }, /** * Sets the URL path for a namespace. Use this to customize where * requireModules (and createModule) will load dependencies from. * * @method setPath * * @param key * @param rootURI * * @example * Ink.setPath('Ink', 'http://my-cdn/Ink/'); * Ink.setPath('Lol', 'http://my-cdn/Lol/'); * * // Loads from http://my-cdn/Ink/Dom/Whatever/lib.js * Ink.requireModules(['Ink.Dom.Whatever'], function () { ... }); * // Loads from http://my-cdn/Lol/Whatever/lib.js * Ink.requireModules(['Lol.Whatever'], function () { ... }); */ setPath: function(key, rootURI) { // Replacing version separator with dot because the difference // between a submodule and a version doesn't matter here. // It would also overcomplicate the implementation of getPath paths[key.replace(/_/, '.')] = rootURI; }, /** * Loads a script by creating a `<script>` tag in the `<head>` of the document. * * Reports errors by listening to 'error' and 'readystatechange' events. * * @method loadScript * @param {String} uri can be an http URI or an Ink module name, which gets resolved. * @param {String} [contentType='text/javascript'] the `type` attribute of the new script tag. */ loadScript: function(uri, contentType) { /*jshint evil:true */ if (uri.indexOf('/') === -1) { uri = this.getPath(uri); } var scriptEl = document.createElement('script'); scriptEl.setAttribute('type', contentType || 'text/javascript'); scriptEl.setAttribute('src', uri); scriptEl.onerror = scriptEl.onreadystatechange = function (err) { err = err || window.event; if (err.type === 'readystatechange' && scriptEl.readyState !== 'loaded') { // if not readyState == 'loaded' it's not an error. return; } Ink.error(['Failed to load script ', uri, '. (', err || 'unspecified error', ')'].join('')); }; // CHECK ON ALL BROWSERS /*if (document.readyState !== 'complete' && !document.body) { document.write( scriptEl.outerHTML ); } else {*/ var aHead = document.getElementsByTagName('head'); if(aHead.length > 0) { aHead[0].appendChild(scriptEl); } //} }, _loadLater: function (dep) { setTimeout(function () { if (modules[dep] || modulesRequested[dep] || modulesWaitingForDeps[dep]) { return; } modulesRequested[dep] = true; Ink.loadScript(dep); }, 0); }, /** * defines a namespace. * * @method namespace * @param {String} ns * @param {Boolean} [returnParentAndKey] * @return {Array|Object} if returnParentAndKey, returns [parent, lastPart], otherwise return the namespace directly */ namespace: function(ns, returnParentAndKey) { if (!ns || !ns.length) { return null; } var levels = ns.split('.'); var nsobj = window; var parent; for (var i = 0, f = levels.length; i < f; ++i) { nsobj[ levels[i] ] = nsobj[ levels[i] ] || {}; parent = nsobj; nsobj = nsobj[ levels[i] ]; } if (returnParentAndKey) { return [ parent, levels[i-1] ]; } return nsobj; }, /** * synchronous. assumes module is loaded already! * * @method getModule * @param {String} mod * @param {Number} [version] * @return {Object|Function} module object / function */ getModule: function(mod, version) { var key = version ? [mod, '_', version].join('') : mod; return modules[key]; }, /** * must be the wrapper around each Ink lib module for require resolution * * @method createModule * @param {String} mod module name. parts are split with dots * @param {Number} version * @param {Array} deps array of module names which are dependencies for the module being created * @param {Function} modFn its arguments are the resolved dependecies, once all of them are fetched. the body of this function should return the module. */ createModule: function(mod, ver, deps, modFn) { // define if (typeof mod !== 'string') { throw new Error('module name must be a string!'); } // validate version correctness if (!(typeof ver === 'number' || (typeof ver === 'string' && ver.length > 0))) { throw new Error('version number missing!'); } var modAll = [mod, '_', ver].join(''); modulesWaitingForDeps[modAll] = true; var cb = function() { //console.log(['createModule(', mod, ', ', ver, ', [', deps.join(', '), '], ', !!modFn, ')'].join('')); // make sure module in not loaded twice if (modules[modAll]) { //console.warn(['Ink.createModule ', modAll, ': module has been defined already.'].join('')); return; } // delete related pending tasks delete modulesRequested[modAll]; delete modulesRequested[mod]; // run module's supplied factory var args = Array.prototype.slice.call(arguments); var moduleContent = modFn.apply(window, args); modulesLoadOrder.push(modAll); // console.log('** loaded module ' + modAll + '**'); // set version if (typeof moduleContent === 'object') { // Dom.Css Dom.Event moduleContent._version = ver; } else if (typeof moduleContent === 'function') { moduleContent.prototype._version = ver; // if constructor moduleContent._version = ver; // if regular function } // add to global namespace... var isInkModule = mod.indexOf('Ink.') === 0; var t; if (isInkModule) { t = Ink.namespace(mod, true); // for mod 'Ink.Dom.Css', t[0] gets 'Ink.Dom' object and t[1] 'Css' } // versioned modules[ modAll ] = moduleContent; // in modules delete modulesWaitingForDeps[ modAll ]; if (isInkModule) { t[0][ t[1] + '_' + ver ] = moduleContent; // in namespace } // unversioned modules[ mod ] = moduleContent; // in modules if (isInkModule) { if (isEmptyObject( t[0][ t[1] ] )) { t[0][ t[1] ] = moduleContent; // in namespace } // else { // console.warn(['Ink.createModule ', modAll, ': module has been defined already with a different version!'].join('')); // } } if (this) { // there may be pending requires expecting this module, check... Ink._checkPendingRequireModules(); } }; this.requireModules(deps, cb); }, /** * use this to get depencies, even if they're not loaded yet * * @method requireModules * @param {Array} deps array of module names which are dependencies for the require function body * @param {Function} cbFn its arguments are the resolved dependecies, once all of them are fetched */ requireModules: function(deps, cbFn) { // require //console.log(['requireModules([', deps.join(', '), '], ', !!cbFn, ')'].join('')); var i, f, o, dep, mod; f = deps.length; o = { args: new Array(f), left: {}, remaining: f, cb: cbFn }; if (!(typeof deps === 'object' && deps.length !== undefined)) { throw new Error('Dependency list should be an array!'); } if (typeof cbFn !== 'function') { throw new Error('Callback should be a function!'); } for (i = 0; i < f; ++i) { if (Ink._moduleRenames[deps[i]]) { Ink.warn(deps[i] + ' was renamed to ' + Ink._moduleRenames[deps[i]]); dep = Ink._moduleRenames[deps[i]]; } else { dep = deps[i]; } mod = modules[dep]; if (mod) { o.args[i] = mod; --o.remaining; continue; } else if (!modulesRequested[dep]) { Ink._loadLater(dep); } o.left[dep] = i; } if (o.remaining > 0) { pendingRMs.push(o); } else { cbFn.apply(true, o.args); } }, _moduleRenames: { 'Ink.UI.Aux_1': 'Ink.UI.Common_1' }, /** * list or module names, ordered by loaded time * * @method getModulesLoadOrder * @return {Array} returns the order in which modules were resolved and correctly loaded */ getModulesLoadOrder: function() { return modulesLoadOrder.slice(); }, /** * returns the markup you should have to bundle your JS resources yourself * * @return {String} scripts markup */ getModuleScripts: function() { var mlo = this.getModulesLoadOrder(); mlo.unshift('Ink_1'); mlo = mlo.map(function(m) { return ['<scr', 'ipt type="text/javascript" src="', Ink.getModuleURL(m), '"></scr', 'ipt>'].join(''); }); return mlo.join('\n'); }, /** * Creates an Ink.Ext module * * Does exactly the same as createModule but creates the module in the Ink.Ext namespace * * @method createExt * @param {String} moduleName Extension name * @param {String} version Extension version * @param {Array} dependencies Extension dependencies * @param {Function} modFn Function returning the extension */ createExt: function (moduleName, version, dependencies, modFn) { return Ink.createModule('Ink.Ext.' + moduleName, version, dependencies, modFn); }, /** * Function.prototype.bind alternative. * Additional arguments will be sent to the original function as prefix arguments. * Set "context" to `false` to preserve the original context of the function and just bind the arguments. * * @method bind * @param {Function} fn * @param {Object} context * @return {Function} */ bind: function(fn, context) { var args = Array.prototype.slice.call(arguments, 2); return function() { var innerArgs = Array.prototype.slice.call(arguments); var finalArgs = args.concat(innerArgs); return fn.apply(context === false ? this : context, finalArgs); }; }, /** * Function.prototype.bind alternative for binding class methods * * @method bindMethod * @param {Object} object * @param {String} methodName * @return {Function} * * @example * // Build a function which calls Ink.Dom.Element.remove on an element. * var removeMyElem = Ink.bindMethod(Ink.Dom.Element, 'remove', someElement); * * removeMyElem(); // no arguments, nor Ink.Dom.Element, needed * @example * // (comparison with using Ink.bind to the same effect). * // The following two calls are equivalent * * Ink.bind(this.remove, this, myElem); * Ink.bindMethod(this, 'remove', myElem); */ bindMethod: function (object, methodName) { return Ink.bind.apply(Ink, [object[methodName], object].concat([].slice.call(arguments, 2))); }, /** * Function.prototype.bind alternative for event handlers. * Same as bind but keeps first argument of the call the original event. * Additional arguments will be sent to the original function as prefix arguments. * Set "context" to `false` to preserve the original context of the function and just bind the arguments. * * @method bindEvent * @param {Function} fn * @param {Object} context * @return {Function} */ bindEvent: function(fn, context) { var args = Array.prototype.slice.call(arguments, 2); return function(event) { var finalArgs = args.slice(); finalArgs.unshift(event || window.event); return fn.apply(context === false ? this : context, finalArgs); }; }, /** * alias to document.getElementById * * @method i * @param {String} id */ i: function(id) { if(!id) { throw new Error('Ink.i => id or element must be passed'); } if(typeof(id) === 'string') { return document.getElementById(id); } return id; }, /** * alias to sizzle or querySelector * * @method s * @param {String} rule * @param {DOMElement} [from] * @return {DOMElement} */ s: function(rule, from) { if(typeof(Ink.Dom) === 'undefined' || typeof(Ink.Dom.Selector) === 'undefined') { throw new Error('This method requires Ink.Dom.Selector'); } return Ink.Dom.Selector.select(rule, (from || document))[0] || null; }, /** * alias to sizzle or querySelectorAll * * @method ss * @param {String} rule * @param {DOMElement} [from] * @return {Array} array of DOMElements */ ss: function(rule, from) { if(typeof(Ink.Dom) === 'undefined' || typeof(Ink.Dom.Selector) === 'undefined') { throw new Error('This method requires Ink.Dom.Selector'); } return Ink.Dom.Selector.select(rule, (from || document)); }, /** * Enriches the destination object with values from source object whenever the key is missing in destination. * * More than one object can be passed as source, in which case the rightmost objects have precedence. * * @method extendObj * @param {Object} destination * @param {Object...} sources * @return destination object, enriched with defaults from the sources */ extendObj: function(destination, source) { if (arguments.length > 2) { source = Ink.extendObj.apply(this, [].slice.call(arguments, 1)); } if (source) { for (var property in source) { if(Object.prototype.hasOwnProperty.call(source, property)) { destination[property] = source[property]; } } } return destination; }, /** * Calls console.log if available. * * @method log * @param args... **/ log: function () { // IE does not have console.log.apply in IE10 emulated mode var console = window.console; if (console && console.log) { apply.call(console.log, console, arguments); } }, /** * Calls console.warn if available. * * @method warn * @param args... **/ warn: function () { // IE does not have console.log.apply in IE10 emulated mode var console = window.console; if (console && console.warn) { apply.call(console.warn, console, arguments); } }, /** * Calls console.error if available. * * @method error * @param args... **/ error: function () { // IE does not have console.log.apply in IE10 emulated mode var console = window.console; if (console && console.error) { apply.call(console.error, console, arguments); } } }; Ink.setPath('Ink', ('INK_PATH' in window) ? window.INK_PATH : window.location.protocol + '//js.ink.sapo.pt/Ink/'); // TODO for debug - to detect pending stuff /* var failCount = {}; // fail count per module name var maxFails = 3; // times var checkDelta = 0.5; //seconds var tmpTmr = setInterval(function() { var mk = Object.keys(modulesRequested); var l = mk.length; if (l > 0) { // console.log('** waiting for modules: ' + mk.join(', ') + ' **'); for (var i = 0, f = mk.length, k, v; i < f; ++i) { k = mk[i]; v = failCount[k]; failCount[k] = (v === undefined) ? 1 : ++v; if (v >= maxFails) { console.error('** Loading of module ' + k + ' failed! **'); delete modulesRequested[k]; } } } else { // console.log('** Module loads complete. **'); clearInterval(tmpTmr); } }, checkDelta*1000); */ }(window, document)); /** * @author inkdev AT sapo.pt */ Ink.createModule('Ink.Net.Ajax', '1', [], function() { 'use strict'; /** * @module Ink.Net.Ajax_1 */ /** * Creates a new cross browser XMLHttpRequest object * * @class Ink.Net.Ajax * @constructor * * @param {String} url request url * @param {Object} options request options * @param {Boolean} [options.asynchronous] if the request should be asynchronous. true by default. * @param {Boolean} [options.cors] set this to true if you're doing a cross-origin request * @param {String} [options.method] HTTP request method. POST by default. * @param {Object|String} [options.parameters] Request parameters which should be sent with the request * @param {Number} [options.timeout] Request timeout * @param {Number} [options.delay] Artificial delay. If request is completed in time lower than this, then wait a bit before calling the callbacks * @param {String} [options.postBody] POST request body. If not specified, it's filled with the contents from parameters * @param {String} [options.contentType] Content-type header to be sent. Defaults to 'application/x-www-form-urlencoded' * @param {Object} [options.requestHeaders] key-value pairs for additional request headers * @param {Function} [options.onComplete] Callback executed after the request is completed, no matter what happens during the request. * @param {Function} [options.onSuccess] Callback executed if the request is successful (requests with 2xx status codes) * @param {Function} [options.onFailure] Callback executed if the request fails (requests with status codes different from 2xx) * @param {Function} [options.onException] Callback executed if an exception occurs. Receives the exception as a parameter. * @param {Function} [options.onCreate] Callback executed after object initialization but before the request is made * @param {Function} [options.onInit] Callback executed before any initialization * @param {Function} [options.onTimeout] Callback executed if the request times out * @param {Boolean|String} [options.evalJS] If the request Content-type header is application/json, evaluates the response and populates responseJSON. Use 'force' if you want to force the response evaluation, no matter what Content-type it's using. Defaults to true. * @param {Boolean} [options.sanitizeJSON] Sanitize the content of responseText before evaluation * @param {String} [options.xhrProxy] URI for proxy service hosted on the same server as the web app, that can fetch documents from other domains. * The service must pipe all input and output untouched (some input sanitization is allowed, like clearing cookies). * e.g., requesting http://example.org/doc can become /proxy/http%3A%2F%2Fexample.org%2Fdoc The proxy service will * be used for cross-domain requests, if set, else a network error is returned as exception. * * @example * new Ajax('test.json', { * method: 'get', * onSuccess: function (ajx, responseJSON) { * // Do stuff with responseJSON or ajx.responseText * console.log(responseJSON.something.length); * }, * onFailure: function (ajx, errorResponse) { * // Deal with it * alert(ajx.status); // The HTTP response code * } * }); */ var Ajax = function(url, options){ // start of AjaxMock patch - uncomment to enable it /*var AM = SAPO.Communication.AjaxMock; if (AM && !options.inMock) { if (AM.autoRecordThisUrl && AM.autoRecordThisUrl(url)) { return new AM.Record(url, options); } if (AM.mockThisUrl && AM.mockThisUrl(url)) { return new AM.Play(url, options, true); } }*/ // end of AjaxMock patch this.init(url, options); }; /** * Options for all requests. These can then be * overriden for individual ones. */ Ajax.globalOptions = { parameters: {}, requestHeaders: {} }; // IE10 does not need XDomainRequest var xMLHttpRequestWithCredentials = 'XMLHttpRequest' in window && 'withCredentials' in (new XMLHttpRequest()); Ajax.prototype = { init: function(url, userOptions) { if (!url) { throw new Error("WRONG_ARGUMENTS_ERR"); } var options = Ink.extendObj({ asynchronous: true, method: 'POST', parameters: null, timeout: 0, delay: 0, postBody: '', contentType: 'application/x-www-form-urlencoded', requestHeaders: null, onComplete: null, onSuccess: null, onFailure: null, onException: null, onHeaders: null, onCreate: null, onInit: null, onTimeout: null, sanitizeJSON: false, evalJS: true, xhrProxy: '', cors: false, debug: false, useCredentials: false, signRequest: false }, Ajax.globalOptions); if (userOptions && typeof userOptions === 'object') { options = Ink.extendObj(options, userOptions); if (typeof userOptions.parameters === 'object') { options.parameters = Ink.extendObj(Ink.extendObj({}, Ajax.globalOptions.parameters), userOptions.parameters); } else if (userOptions.parameters !== null) { var globalParameters = this.paramsObjToStr(Ajax.globalOptions.parameters); if (globalParameters) { options.parameters = userOptions.parameters + '&' + globalParameters; } } options.requestHeaders = Ink.extendObj({}, Ajax.globalOptions.requestHeaders); options.requestHeaders = Ink.extendObj(options.requestHeaders, userOptions.requestHeaders); } this.options = options; this.safeCall('onInit'); this.url = url; var urlLocation = this._locationFromURL(url); this.isHTTP = this._locationIsHTTP(urlLocation); this.isCrossDomain = this._locationIsCrossDomain(urlLocation, location); this.requestHasBody = options.method.search(/^get|head$/i) < 0; if(this.options.cors) { this.isCrossDomain = false; } this.transport = this.getTransport(); this.request(); }, /** * Returns a location object from an URL * * @method _locationFromUrl * @param url * @private **/ _locationFromURL: function (url) { var urlLocation = document.createElementNS ? document.createElementNS('http://www.w3.org/1999/xhtml', 'a') : document.createElement('a'); urlLocation.href = url; return urlLocation; }, /** * Checks whether a location is HTTP or HTTPS * * @method locationIsHttp * @param urlLocation * @private */ _locationIsHTTP: function (urlLocation) { return urlLocation.protocol.match(/^https?:/i) ? true : false; }, /** * Checks whether a location is cross-domain from another * * @method _locationIsCrossDomain * @param urlLocation {Location} * @param otherLocation {Location} */ _locationIsCrossDomain: function (urlLocation, location) { location = location || window.location; if (!Ajax.prototype._locationIsHTTP(urlLocation) || location.protocol === 'widget:' || typeof window.widget === 'object') { return false; } else { return location.protocol !== urlLocation.protocol || location.host.split(':')[0] !== urlLocation.host.split(':')[0]; } }, /** * Creates the appropriate XMLHttpRequest object * * @method getTransport * @return {Object} XMLHttpRequest object */ getTransport: function() { /*global XDomainRequest:false, ActiveXObject:false */ if (!xMLHttpRequestWithCredentials && this.options.cors && 'XDomainRequest' in window) { this.usingXDomainReq = true; return new XDomainRequest(); } else if (typeof XMLHttpRequest !== 'undefined') { return new XMLHttpRequest(); } else if (typeof ActiveXObject !== 'undefined') { try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { return new ActiveXObject('Microsoft.XMLHTTP'); } } else { return null; } }, /** * Set the necessary headers for an ajax request * * @method setHeaders * @param {String} url - url for the request */ setHeaders: function() { if (this.transport) { try { var headers = { "Accept": "text/javascript,text/xml,application/xml,application/xhtml+xml,text/html,application/json;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1", "Accept-Language": navigator.language, "X-Requested-With": "XMLHttpRequest", "X-Ink-Version": "2" }; if (this.options.cors) { if (!this.options.signRequest) { delete headers['X-Requested-With']; } delete headers['X-Ink-Version']; } if (this.options.requestHeaders && typeof this.options.requestHeaders === 'object') { for(var headerReqName in this.options.requestHeaders) { if (this.options.requestHeaders.hasOwnProperty(headerReqName)) { headers[headerReqName] = this.options.requestHeaders[headerReqName]; } } } if (this.transport.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) { headers.Connection = 'close'; } for (var headerName in headers) { if(headers.hasOwnProperty(headerName)) { this.transport.setRequestHeader(headerName, headers[headerName]); } } } catch(e) {} } }, /** * Converts an object with parameters to a querystring * * @method paramsObjToStr * @param {Object|String} optParams parameters object * @return {String} querystring */ paramsObjToStr: function(optParams) { var k, m, p, a, params = []; if (typeof optParams === 'object') { for (p in optParams){ if (optParams.hasOwnProperty(p)) { a = optParams[p]; if (Object.prototype.toString.call(a) === '[object Array]' && !isNaN(a.length)) { for (k = 0, m = a.length; k < m; k++) { params = params.concat([ encodeURIComponent(p), '[]', '=', encodeURIComponent(a[k]), '&' ]); } } else { params = params.concat([ encodeURIComponent(p), '=', encodeURIComponent(a), '&' ]); } } } if (params.length > 0) { params.pop(); } } else { return optParams; } return params.join(''); }, /** * set the url parameters for a GET request * * @method setParams */ setParams: function() { var params = null, optParams = this.options.parameters; if(typeof optParams === "object"){ params = this.paramsObjToStr(optParams); } else { params = '' + optParams; } if(params){ if(this.url.indexOf('?') > -1) { this.url = this.url.split('#')[0] + '&' + params; } else { this.url = this.url.split('#')[0] + '?' + params; } } }, /** * Retrieves HTTP header from response * * @method getHeader * @param {String} name header name * @return {String} header content */ getHeader: function(name) { if (this.usingXDomainReq && name === 'Content-Type') { return this.transport.contentType; } try{ return this.transport.getResponseHeader(name); } catch(e) { return null; } }, /** * Returns all http headers from the response * * @method getAllHeaders * @return {String} the headers, each separated by a newline */ getAllHeaders: function() { try { return this.transport.getAllResponseHeaders(); } catch(e) { return null; } }, /** * Setup the response object * * @method getResponse * @return {Object} the response object */ getResponse: function(){ // setup our own stuff var t = this.transport, r = { headerJSON: null, responseJSON: null, getHeader: this.getHeader, getAllHeaders: this.getAllHeaders, request: this, transport: t, timeTaken: new Date() - this.startTime, requestedUrl: this.url }; // setup things expected from the native object r.readyState = t.readyState; try { r.responseText = t.responseText; } catch(e) {} try { r.responseXML = t.responseXML; } catch(e) {} try { r.status = t.status; } catch(e) { r.status = 0; } try { r.statusText = t.statusText; } catch(e) { r.statusText = ''; } return r; }, /** * Aborts the request if still running. No callbacks are called * * @method abort */ abort: function(){ if (this.transport) { clearTimeout(this.delayTimeout); clearTimeout(this.stoTimeout); try { this.transport.abort(); } catch(ex) {} this.finish(); } }, /** * Executes the state changing phase of an ajax request * * @method runStateChange */ runStateChange: function() { var rs = this.transport.readyState; if (rs === 3) { if (this.isHTTP) { this.safeCall('onHeaders'); } } else if (rs === 4 || this.usingXDomainReq) { if (this.options.asynchronous && this.options.delay && (this.startTime + this.options.delay > new Date().getTime())) { this.delayTimeout = setTimeout(Ink.bind(this.runStateChange, this), this.options.delay + this.startTime - new Date().getTime()); return; } var responseJSON, responseContent = this.transport.responseText, response = this.getResponse(), curStatus = this.transport.status; if (this.isHTTP && !this.options.asynchronous) { this.safeCall('onHeaders'); } clearTimeout(this.stoTimeout); if (curStatus === 0) { // Status 0 indicates network error for http requests. // For http less requests, 0 is always returned. if (this.isHTTP) { this.safeCall('onException', this.makeError(18, 'NETWORK_ERR')); } else { curStatus = responseContent ? 200 : 404; } } else if (curStatus === 304) { curStatus = 200; } var isSuccess = this.usingXDomainReq || 200 <= curStatus && curStatus < 300; var headerContentType = this.getHeader('Content-Type') || ''; if (this.options.evalJS && (headerContentType.indexOf("application/json") >= 0 || this.options.evalJS === 'force')){ try { responseJSON = this.evalJSON(responseContent, this.sanitizeJSON); if(responseJSON){ responseContent = response.responseJSON = responseJSON; } } catch(e){ if (isSuccess) { // If the request failed, then this is perhaps an error page // so don't notify error. this.safeCall('onException', e); } } } if (this.usingXDomainReq && headerContentType.indexOf('xml') !== -1 && 'DOMParser' in window) { // http://msdn.microsoft.com/en-us/library/ie/ff975278(v=vs.85).aspx var mimeType; switch (headerContentType) { case 'application/xml': case 'application/xhtml+xml': case 'image/svg+xml': mimeType = headerContentType; break; default: mimeType = 'text/xml'; } var xmlDoc = (new DOMParser()).parseFromString( this.transport.responseText, mimeType); this.transport.responseXML = xmlDoc; response.responseXML = xmlDoc; } if (this.transport.responseXML !== null && response.responseJSON === null && this.transport.responseXML.xml !== ""){ responseContent = this.transport.responseXML; } if (curStatus || this.usingXDomainReq) { if (isSuccess) { this.safeCall('onSuccess', response, responseContent); } else { this.safeCall('onFailure', response, responseContent); } this.safeCall('on'+curStatus, response, responseContent); } this.finish(response, responseContent); } }, /** * Last step after XHR is complete. Call onComplete and cleanup object * * @method finish * @param {} response * @param {} responseContent */ finish: function(response, responseContent){ if (response) { this.safeCall('onComplete', response, responseContent); } clearTimeout(this.stoTimeout); if (this.transport) { // IE6 sometimes barfs on this one try{ this.transport.onreadystatechange = null; } catch(e){} if (typeof this.transport.destroy === 'function') { // Stuff for Samsung. this.transport.destroy(); } // Let XHR be collected. this.transport = null; } }, /** * Safely calls a callback function. * Verifies that the callback is well defined and traps errors * * @method safeCall * @param {Function} listener */ safeCall: function(listener, first/*, second*/) { function rethrow(exception){ setTimeout(function() { // Rethrow exception so it'll land in // the error console, firebug, whatever. if (exception.message) { exception.message += '\n'+(exception.stacktrace || exception.stack || ''); } throw exception; }, 1); } if (typeof this.options[listener] === 'function') { //SAPO.safeCall(this, this.options[listener], first, second); //return object[listener].apply(object, [].slice.call(arguments, 2)); try { this.options[listener].apply(this, [].slice.call(arguments, 1)); } catch(ex) { rethrow(ex); } } else if (first && window.Error && (first instanceof Error)) { rethrow(first); } }, /** * Sets new request header for the subsequent http request * * @method setRequestHeader * @param {String} name * @param {String} value */ setRequestHeader: function(name, value){ if (!this.options.requestHeaders) { this.options.requestHeaders = {}; } this.options.requestHeaders[name] = value; }, /** * Execute the request * * @method request */ request: function() { if(this.transport) { var params = null; if(this.requestHasBody) { if(this.options.postBody !== null && this.options.postBody !== '') { params = this.options.postBody; this.setParams(); } else if (this.options.parameters !== null && this.options.parameters !== ''){ params = this.options.parameters; } if (typeof params === "object" && !params.nodeType) { params = this.paramsObjToStr(params); } else if (typeof params !== "object" && params !== null){ params = '' + params; } if(this.options.contentType) { this.setRequestHeader('Content-Type', this.options.contentType); } } else { this.setParams(); } var url = this.url; var method = this.options.method; var crossDomain = this.isCrossDomain; if (crossDomain && this.options.xhrProxy) { this.setRequestHeader('X-Url', url); url = this.options.xhrProxy + encodeURIComponent(url); crossDomain = false; } try { this.transport.open(method, url, this.options.asynchronous); } catch(e) { this.safeCall('onException', e); return this.finish(this.getResponse(), null); } this.setHeaders(); this.safeCall('onCreate'); if(this.options.timeout && !isNaN(this.options.timeout)) { this.stoTimeout = setTimeout(Ink.bind(function() { if(this.options.onTimeout) { this.safeCall('onTimeout'); this.abort(); } }, this), (this.options.timeout * 1000)); } if(this.options.useCredentials && !this.usingXDomainReq) { this.transport.withCredentials = true; } if(this.options.asynchronous && !this.usingXDomainReq) { this.transport.onreadystatechange = Ink.bind(this.runStateChange, this); } else if (this.usingXDomainReq) { this.transport.onload = Ink.bind(this.runStateChange, this); } try { if (crossDomain) { // Need explicit handling because Mozila aborts // the script and Chrome fails silently.per the spec throw this.makeError(18, 'NETWORK_ERR'); } else { this.startTime = new Date().getTime(); this.transport.send(params); } } catch(e) { this.safeCall('onException', e); return this.finish(this.getResponse(), null); } if(!this.options.asynchronous) { this.runStateChange(); } } }, /** * Returns new exception object that can be thrown * * @method makeError * @param code * @param message * @returns {Object} */ makeError: function(code, message){ if (typeof Error !== 'function') { return {code: code, message: message}; } var e = new Error(message); e.code = code; return e; }, /** * Checks if a given string is valid JSON * * @method isJSON * @param {String} str String to be evaluated * @return {Boolean} True if the string is valid JSON */ isJSON: function(str) { if (typeof str !== "string" || !str){ return false; } str = str.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); }, /** * Evaluates a given string as JSON * * @method evalJSON * @param {String} str String to be evaluated * @param {Boolean} sanitize whether to sanitize the content or not * @return {Object} Json content as an object */ evalJSON: function(strJSON, sanitize) { if (strJSON && (!sanitize || this.isJSON(strJSON))) { try { if (typeof JSON !== "undefined" && typeof JSON.parse !== 'undefined'){ return JSON.parse(strJSON); } /*jshint evil:true */ return eval('(' + strJSON + ')'); } catch(e) { throw new Error('ERROR: Bad JSON string...'); } } return null; } }; /** * Loads content from a given url through a XMLHttpRequest. * * Shortcut function for simple AJAX use cases. * * Works with JSON, XML and plain text. * * @method load * @param {String} url request url * @param {Function} callback callback to be executed if the request is successful * @return {Object} XMLHttpRequest object * * @example * Ajax.load('some/text/file', function (responseText) { * doSomething(responseText); * }); * Ajax.load('some/xml/file', function (responseXML) { * doSomething(responseXML); * }); * Ajax.load('some/json/file', function (responseJSON) { * doSomething(responseJSON); * }); * */ Ajax.load = function(url, callback){ return new Ajax(url, { method: 'GET', onSuccess: function(response){ callback(response.responseJSON || response.responseText, response); } }); }; /** * Loads content from a given url through a XMLHttpRequest. * Shortcut function for simple AJAX use cases. * * @method ping * @param {String} url request url * @param {Function} callback callback to be executed if the request is successful * @return {Object} XMLHttpRequest object */ Ajax.ping = function(url, callback){ return new Ajax(url, { method: 'HEAD', onSuccess: function(response){ if (typeof callback === 'function'){ callback(response); } } }); }; return Ajax; }); /** * @author inkdev AT sapo.pt */ Ink.createModule('Ink.Net.JsonP', '1', [], function() { 'use strict'; /** * @module Ink.Net.JsonP_1 */ /** * This class takes care of the nitty-gritty details of doing jsonp requests: Storing * a callback in a globally accessible manner, waiting for the timeout or completion * of the request, and passing extra GET parameters to the server, is not so complicated * but it's boring and repetitive to code and tricky to get right. * * @class Ink.Net.JsonP * @constructor * @param {String} uri * @param {Object} options * @param {Function} options.onSuccess success callback * @param {Function} [options.onFailure] failure callback * @param {Object} [options.failureObj] object to be passed as argument to failure callback * @param {Number} [options.timeout] timeout for request fail, in seconds. defaults to 10 * @param {Object} [options.params] object with the parameters and respective values to unfold * @param {String} [options.callbackParam] parameter to use as callback. defaults to 'jsoncallback' * @param {String} [options.internalCallback] *Advanced*: name of the callback function stored in the Ink.Net.JsonP object. * * @example * Ink.requireModules(['Ink.Net.JsonP_1'], function (JsonP) { * var jsonp = new JsonP('http://path.to.jsonp/endpoint', { * // When the JSONP response arrives, this callback is called: * onSuccess: function (gameData) { * game.startGame(gameData); * }, * // after options.timeout seconds, this callback gets called: * onFailure: function () { * game.error('Could not load game data!'); * }, * timeout: 5 * }); * }); */ var JsonP = function(uri, options) { this.init(uri, options); }; JsonP.prototype = { init: function(uri, options) { this.options = Ink.extendObj( { onSuccess: undefined, onFailure: undefined, failureObj: {}, timeout: 10, params: {}, callbackParam: 'jsoncallback', internalCallback: '_cb', randVar: false }, options || {}); if(this.options.randVar !== false) { this.randVar = this.options.randVar; } else { this.randVar = parseInt(Math.random() * 100000, 10); } this.options.internalCallback += this.randVar; this.uri = uri; // prevent SAPO legacy onComplete - make it onSuccess if(typeof(this.options.onComplete) === 'function') { this.options.onSuccess = this.options.onComplete; } if (typeof this.uri !== 'string') { throw 'Please define an URI'; } if (typeof this.options.onSuccess !== 'function') { throw 'please define a callback function on option onSuccess!'; } Ink.Net.JsonP[this.options.internalCallback] = Ink.bind(function() { window.clearTimeout(this.timeout); delete window.Ink.Net.JsonP[this.options.internalCallback]; this._removeScriptTag(); this.options.onSuccess(arguments[0]); }, this); this._addScriptTag(); }, _addParamsToGet: function(uri, params) { var hasQuestionMark = uri.indexOf('?') !== -1; var sep, pKey, pValue, parts = [uri]; for (pKey in params) { if (params.hasOwnProperty(pKey)) { if (!hasQuestionMark) { sep = '?'; hasQuestionMark = true; } else { sep = '&'; } pValue = params[pKey]; if (typeof pValue !== 'number' && !pValue) { pValue = ''; } parts = parts.concat([sep, pKey, '=', encodeURIComponent(pValue)]); } } return parts.join(''); }, _getScriptContainer: function() { var headEls = document.getElementsByTagName('head'); if (headEls.length === 0) { var scriptEls = document.getElementsByTagName('script'); return scriptEls[0]; } return headEls[0]; }, _addScriptTag: function() { // enrich options will callback and random seed this.options.params[this.options.callbackParam] = 'Ink.Net.JsonP.' + this.options.internalCallback; this.options.params.rnd_seed = this.randVar; this.uri = this._addParamsToGet(this.uri, this.options.params); // create script tag var scriptEl = document.createElement('script'); scriptEl.type = 'text/javascript'; scriptEl.src = this.uri; var scriptCtn = this._getScriptContainer(); scriptCtn.appendChild(scriptEl); this.timeout = setTimeout(Ink.bind(this._requestFailed, this), (this.options.timeout * 1000)); }, _requestFailed : function () { delete Ink.Net.JsonP[this.options.internalCallback]; this._removeScriptTag(); if(typeof this.options.onFailure === 'function'){ this.options.onFailure(this.options.failureObj); } }, _removeScriptTag: function() { var scriptEl; var scriptEls = document.getElementsByTagName('script'); var scriptUri; for (var i = 0, f = scriptEls.length; i < f; ++i) { scriptEl = scriptEls[i]; scriptUri = scriptEl.getAttribute('src') || scriptEl.src; if (scriptUri !== null && scriptUri === this.uri) { scriptEl.parentNode.removeChild(scriptEl); return; } } } }; return JsonP; }); /** * @module Ink.Dom.Browser_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.Dom.Browser', '1', [], function() { 'use strict'; /** * @class Ink.Dom.Browser * @version 1 * @static * @example * <input type="text" id="dPicker" /> * <script> * Ink.requireModules(['Ink.Dom.Browser_1'],function( InkBrowser ){ * if( InkBrowser.CHROME ){ * console.log( 'This is a CHROME browser.' ); * } * }); * </script> */ var Browser = { /** * True if the browser is Internet Explorer * * @property IE * @type {Boolean} * @public * @static */ IE: false, /** * True if the browser is Gecko based * * @property GECKO * @type {Boolean} * @public * @static */ GECKO: false, /** * True if the browser is Opera * * @property OPERA * @type {Boolean} * @public * @static */ OPERA: false, /** * True if the browser is Safari * * @property SAFARI * @type {Boolean} * @public * @static */ SAFARI: false, /** * True if the browser is Konqueror * * @property KONQUEROR * @type {Boolean} * @public * @static */ KONQUEROR: false, /** * True if browser is Chrome * * @property CHROME * @type {Boolean} * @public * @static */ CHROME: false, /** * The specific browser model. False if it is unavailable. * * @property model * @type {Boolean|String} * @public * @static */ model: false, /** * The browser version. False if it is unavailable. * * @property version * @type {Boolean|String} * @public * @static */ version: false, /** * The user agent string. False if it is unavailable. * * @property userAgent * @type {Boolean|String} * @public * @static */ userAgent: false, /** * Initialization function for the Browser object. * * Is called automatically when this module is loaded, and calls setDimensions, setBrowser and setReferrer. * * @method init * @public */ init: function() { this.detectBrowser(); this.setDimensions(); this.setReferrer(); }, /** * Retrieves and stores window dimensions in this object. Called automatically when this module is loaded. * * @method setDimensions * @public */ setDimensions: function() { //this.windowWidth=window.innerWidth !== null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body !== null ? document.body.clientWidth : null; //this.windowHeight=window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null; var myWidth = 0, myHeight = 0; if ( typeof window.innerWidth=== 'number' ) { myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } this.windowWidth = myWidth; this.windowHeight = myHeight; }, /** * Stores the referrer. Called automatically when this module is loaded. * * @method setReferrer * @public */ setReferrer: function() { if (document.referrer && document.referrer.length) { this.referrer = window.escape(document.referrer); } else { this.referrer = false; } }, /** * Detects the browser and stores the found properties. Called automatically when this module is loaded. * * @method detectBrowser * @public */ detectBrowser: function() { this._sniffUserAgent(navigator.userAgent); }, _sniffUserAgent: function (sAgent) { this.userAgent = sAgent; sAgent = sAgent.toLowerCase(); if (/applewebkit\//.test(sAgent)) { this.cssPrefix = '-webkit-'; this.domPrefix = 'Webkit'; if(/(chrome|crios)\//.test(sAgent)) { // Chrome this.CHROME = true; this.model = 'chrome'; this.version = sAgent.replace(/(.*)chrome\/([^\s]+)(.*)/, "$2"); } else { // Safari this.SAFARI = true; this.model = 'safari'; var rVersion = /version\/([^) ]+)/; if (rVersion.test(sAgent)) { this.version = sAgent.match(rVersion)[1]; } else { this.version = sAgent.replace(/(.*)applewebkit\/([^\s]+)(.*)/, "$2"); } } } else if (/opera/.test(sAgent)) { // Opera this.OPERA = true; this.model = 'opera'; this.version = sAgent.replace(/(.*)opera.([^\s$]+)(.*)/, "$2"); this.cssPrefix = '-o-'; this.domPrefix = 'O'; } else if (/konqueror/.test(sAgent)) { // Konqueroh this.KONQUEROR = true; this.model = 'konqueror'; this.version = sAgent.replace(/(.*)konqueror\/([^;]+);(.*)/, "$2"); this.cssPrefix = '-khtml-'; this.domPrefix = 'Khtml'; } else if (/(msie|trident)/i.test(sAgent)) { // MSIE this.IE = true; this.model = 'ie'; if (/rv:((?:\d|\.)+)/.test(sAgent)) { // IE 11 this.version = sAgent.match(/rv:((?:\d|\.)+)/)[1]; } else { this.version = sAgent.replace(/(.*)\smsie\s([^;]+);(.*)/, "$2"); } this.cssPrefix = '-ms-'; this.domPrefix = 'ms'; } else if (/gecko/.test(sAgent)) { // GECKO // Supports only: // Camino, Chimera, Epiphany, Minefield (firefox 3), Firefox, Firebird, Phoenix, Galeon, // Iceweasel, K-Meleon, SeaMonkey, Netscape, Songbird, Sylera, this.cssPrefix = '-moz-'; this.domPrefix = 'Moz'; this.GECKO = true; var re = /(camino|chimera|epiphany|minefield|firefox|firebird|phoenix|galeon|iceweasel|k\-meleon|seamonkey|netscape|songbird|sylera)/; if(re.test(sAgent)) { this.model = sAgent.match(re)[1]; this.version = sAgent.replace(new RegExp("(.*)"+this.model+"\/([^;\\s$]+)(.*)"), "$2"); } else { // probably is mozilla this.model = 'mozilla'; var reVersion = /(.*)rv:([^)]+)(.*)/; if(reVersion.test(sAgent)) { this.version = sAgent.replace(reVersion, "$2"); } } } }, /** * Debug function which displays browser (and Ink.Dom.Browser) information as an alert message. * * @method debug * @public * * @example * * The following code * * Ink.requireModules(['Ink.Dom.Browser_1'], function (Browser) { * Browser.debug(); * }); * * Alerts (On Firefox 22): * * known browsers: (ie, gecko, opera, safari, konqueror) * false,true,false,false,false * model -> firefox * version -> 22.0 * * original UA -> Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0 */ debug: function() { /*global alert:false */ var str = "known browsers: (ie, gecko, opera, safari, konqueror) \n"; str += [this.IE, this.GECKO, this.OPERA, this.SAFARI, this.KONQUEROR] +"\n"; str += "model -> "+this.model+"\n"; str += "version -> "+this.version+"\n"; str += "\n"; str += "original UA -> "+this.userAgent; alert(str); } }; Browser.init(); return Browser; }); /** * @author inkdev AT sapo.pt */ Ink.createModule( 'Ink.Dom.Css', 1, [], function() { 'use strict'; /** * @module Ink.Dom.Css_1 */ // getComputedStyle feature detection. var getCs = ("defaultView" in document) && ("getComputedStyle" in document.defaultView) ? document.defaultView.getComputedStyle : window.getComputedStyle; /** * @class Ink.Dom.Css * @static */ var Css = { /** * adds or removes a class to the given element according to addRemState * * @method addRemoveClassName * @param {DOMElement|string} elm DOM element or element id * @param {string} className class name to add or remove. * @param {boolean} addRemState Whether to add or remove. `true` to add, `false` to remove. * * @example * Ink.requireModules(['Ink.Dom.Css_1'], function (Css) { * Css.addRemoveClassName(myElm, 'classss', true); // Adds the `classss` class. * Css.addRemoveClassName(myElm, 'classss', false); // Removes the `classss` class. * }); */ addRemoveClassName: function(elm, className, addRemState) { if (addRemState) { return this.addClassName(elm, className); } this.removeClassName(elm, className); }, /** * add a class to a given element * * @method addClassName * @param {DOMElement|String} elm DOM element or element id * @param {String} className */ addClassName: function(elm, className) { elm = Ink.i(elm); if (!elm || !className) { return null; } className = ('' + className).split(/[, ]+/); var i = 0; var len = className.length; for (; i < len; i++) { if (typeof elm.classList !== "undefined") { elm.classList.add(className[i]); } else if (!Css.hasClassName(elm, className[i])) { elm.className += (elm.className ? ' ' : '') + className[i]; } } }, /** * removes a class from a given element * * @method removeClassName * @param {DOMElement|String} elm DOM element or element id * @param {String} className */ removeClassName: function(elm, className) { elm = Ink.i(elm); if (!elm || !className) { return null; } className = ('' + className).split(/[, ]+/); var i = 0; var len = className.length; if (typeof elm.classList !== "undefined"){ for (; i < len; i++) { elm.classList.remove(className[i]); } } else { var elmClassName = elm.className || ''; var re; for (; i < len; i++) { re = new RegExp("(^|\\s+)" + className[i] + "(\\s+|$)"); elmClassName = elmClassName.replace(re, ' '); } elm.className = (elmClassName .replace(/^\s+/, '') .replace(/\s+$/, '')); } }, /** * Alias to addRemoveClassName. Utility function, saves many if/elses. * * @method setClassName * @param {DOMElement|String} elm DOM element or element id * @param {String} className * @param {Boolean} add true to add, false to remove */ setClassName: function(elm, className, add) { this.addRemoveClassName(elm, className, add || false); }, /** * @method hasClassName * @param {DOMElement|String} elm DOM element or element id * @param {String|Array} classNames classNames to test * @param {Boolean} [all=false] if true, return whether all classes in classNames are there. Otherwise, return true if any is present. * @return {Boolean} true if a given class is applied to a given element */ hasClassName: function(elm, className, all) { elm = Ink.i(elm); if (!elm || !className) { return false; } className = ('' + className).split(/[, ]+/); var i = 0; var len = className.length; var has; var re; for ( ; i < len; i++) { if (typeof elm.classList !== "undefined"){ has = elm.classList.contains(className[i]); } else { var elmClassName = elm.className; if (elmClassName === className[i]) { has = true; } else { re = new RegExp("(^|\\s)" + className[i] + "(\\s|$)"); has = re.test(elmClassName); } } if (has && !all) { return true; } // return if looking for any class if (!has && all) { return false; } // return if looking for all classes } if (all) { // if we got here, all classes were found so far return true; } else { // if we got here with all == false, no class was found return false; } }, /** * Add and removes the class from the element with a timeout, so it blinks * * @method blinkClass * @param {DOMElement|String} elm DOM element or element id * @param {String} className class name * @param {Boolean} timeout timeout in ms between adding and removing, default 100 ms * @param {Boolean} negate is true, class is removed then added */ blinkClass: function(element, className, timeout, negate){ element = Ink.i(element); Css.addRemoveClassName(element, className, !negate); setTimeout(function() { Css.addRemoveClassName(element, className, negate); }, Number(timeout) || 100); }, /** * Add or remove a class name from a given element * * @method toggleClassName * @param {DOMElement|String} elm DOM element or element id * @param {String} className class name * @param {Boolean} forceAdd forces the addition of the class if it doesn't exists */ toggleClassName: function(elm, className, forceAdd) { if (elm && className){ if (typeof elm.classList !== "undefined" && !/[, ]/.test(className)){ elm = Ink.i(elm); if (elm !== null){ elm.classList.toggle(className); } return true; } } if (typeof forceAdd !== 'undefined') { if (forceAdd === true) { Css.addClassName(elm, className); } else if (forceAdd === false) { Css.removeClassName(elm, className); } } else { if (Css.hasClassName(elm, className)) { Css.removeClassName(elm, className); } else { Css.addClassName(elm, className); } } }, /** * sets the opacity of given client a given element * * @method setOpacity * @param {DOMElement|String} elm DOM element or element id * @param {Number} value allows 0 to 1(default mode decimal) or percentage (warning using 0 or 1 will reset to default mode) */ setOpacity: function(elm, value) { elm = Ink.i(elm); if (elm !== null){ var val = 1; if (!isNaN(Number(value))){ if (value <= 0) { val = 0; } else if (value <= 1) { val = value; } else if (value <= 100) { val = value / 100; } else { val = 1; } } if (typeof elm.style.opacity !== 'undefined') { elm.style.opacity = val; } else { elm.style.filter = "alpha(opacity:"+(val*100|0)+")"; } } }, /** * Converts a css property name to a string in camelcase to be used with CSSStyleDeclaration. * @method _camelCase * @private * @param {String} str String to convert * @return {String} Converted string */ _camelCase: function(str) { return str ? str.replace(/-(\w)/g, function (_, $1) { return $1.toUpperCase(); }) : str; }, /** * Gets the value for an element's style attribute * * @method getStyle * @param {DOMElement|String} elm DOM element or element id * @param {String} style Which css attribute to fetch * @return Style value */ getStyle: function(elm, style) { elm = Ink.i(elm); if (elm !== null) { style = style === 'float' ? 'cssFloat': this._camelCase(style); var value = elm.style[style]; if (getCs && (!value || value === 'auto')) { var css = getCs(elm, null); value = css ? css[style] : null; } else if (!value && elm.currentStyle) { value = elm.currentStyle[style]; if (value === 'auto' && (style === 'width' || style === 'height')) { value = elm["offset" + style.charAt(0).toUpperCase() + style.slice(1)] + "px"; } } if (style === 'opacity') { return value ? parseFloat(value, 10) : 1.0; } else if (style === 'borderTopWidth' || style === 'borderBottomWidth' || style === 'borderRightWidth' || style === 'borderLeftWidth' ) { if (value === 'thin') { return '1px'; } else if (value === 'medium') { return '3px'; } else if (value === 'thick') { return '5px'; } } return value === 'auto' ? null : value; } }, /** * Adds CSS rules to an element's style attribute. * * @method setStyle * @param {DOMElement|String} elm DOM element or element id * @param {String} style Which css attribute to set * * @example * <a href="#" class="change-color">Change his color</a> * <p class="him">"He" is me</p> * <script type="text/javascript"> * Ink.requireModules(['Ink.Dom.Css_1', 'Ink.Dom.Event_1', 'Ink.Dom.Selector_1'], function (Css, InkEvent, Selector) { * var btn = Selector.select('.change-color')[0]; * var other = Selector.select('.him')[0]; * InkEvent.observe(btn, 'click', function () { * Css.setStyle(other, 'background-color: black'); * Css.setStyle(other, 'color: white'); * }); * }); * </script> * */ setStyle: function(elm, style) { elm = Ink.i(elm); if (elm === null) { return; } if (typeof style === 'string') { elm.style.cssText += '; '+style; if (style.indexOf('opacity') !== -1) { this.setOpacity(elm, style.match(/opacity:\s*(\d?\.?\d*)/)[1]); } } else { for (var prop in style) { if (style.hasOwnProperty(prop)){ if (prop === 'opacity') { this.setOpacity(elm, style[prop]); } else if (prop === 'float' || prop === 'cssFloat') { if (typeof elm.style.styleFloat === 'undefined') { elm.style.cssFloat = style[prop]; } else { elm.style.styleFloat = style[prop]; } } else { elm.style[prop] = style[prop]; } } } } }, /** * Makes an element visible * * @method show * @param {DOMElement|String} elm DOM element or element id * @param {String} forceDisplayProperty Css display property to apply on show */ show: function(elm, forceDisplayProperty) { elm = Ink.i(elm); if (elm !== null) { elm.style.display = (forceDisplayProperty) ? forceDisplayProperty : ''; } }, /** * Hides an element * * @method hide * @param {DOMElement|String} elm DOM element or element id */ hide: function(elm) { elm = Ink.i(elm); if (elm !== null) { elm.style.display = 'none'; } }, /** * shows or hides according to param show * * @method showHide * @param {DOMElement|String} elm DOM element or element id * @param {boolean} [show=false] Whether to show or hide `elm`. */ showHide: function(elm, show) { elm = Ink.i(elm); if (elm) { elm.style.display = show ? '' : 'none'; } }, /** * Shows or hides an element depending on current state * @method toggle * @param {DOMElement|String} elm DOM element or element id * @param {Boolean} forceShow Forces showing if element is hidden */ toggle: function(elm, forceShow) { elm = Ink.i(elm); if (elm !== null) { if (typeof forceShow !== 'undefined') { if (forceShow === true) { this.show(elm); } else { this.hide(elm); } } else { if (this.getStyle(elm,'display').toLowerCase() === 'none') { this.show(elm); } else { this.hide(elm); } } } }, _getRefTag: function(head){ if (head.firstElementChild) { return head.firstElementChild; } for (var child = head.firstChild; child; child = child.nextSibling){ if (child.nodeType === 1){ return child; } } return null; }, /** * Adds css style tags to the head section of a page * * @method appendStyleTag * @param {String} selector The css selector for the rule * @param {String} style The content of the style rule * @param {Object} options Options for the tag * @param {String} [options.type] file type * @param {Boolean} [options.force] if true, style tag will be appended to end of head */ appendStyleTag: function(selector, style, options){ options = Ink.extendObj({ type: 'text/css', force: false }, options || {}); var styles = document.getElementsByTagName("style"), oldStyle = false, setStyle = true, i, l; for (i=0, l=styles.length; i<l; i++) { oldStyle = styles[i].innerHTML; if (oldStyle.indexOf(selector) >= 0) { setStyle = false; } } if (setStyle) { var defStyle = document.createElement("style"), head = document.getElementsByTagName("head")[0], refTag = false, styleStr = ''; defStyle.type = options.type; styleStr += selector +" {"; styleStr += style; styleStr += "} "; if (typeof defStyle.styleSheet !== "undefined") { defStyle.styleSheet.cssText = styleStr; } else { defStyle.appendChild(document.createTextNode(styleStr)); } if (options.force){ head.appendChild(defStyle); } else { refTag = this._getRefTag(head); if (refTag){ head.insertBefore(defStyle, refTag); } } } }, /** * Adds a link tag for a stylesheet to the head section of a page * * @method appendStylesheet * @param {String} path File path * @param {Object} options Options for the tag * @param {String} [options.media='screen'] media type * @param {String} [options.type='text/css'] file type * @param {Boolean} [options.force=false] if true, tag will be appended to end of head */ appendStylesheet: function(path, options){ options = Ink.extendObj({ media: 'screen', type: 'text/css', force: false }, options || {}); var refTag, style = document.createElement("link"), head = document.getElementsByTagName("head")[0]; style.media = options.media; style.type = options.type; style.href = path; style.rel = "Stylesheet"; if (options.force){ head.appendChild(style); } else { refTag = this._getRefTag(head); if (refTag){ head.insertBefore(style, refTag); } } }, /** * Loads CSS via LINK element inclusion in HEAD (skips append if already there) * * Works similarly to appendStylesheet but: * a) supports all browsers; * b) supports optional callback which gets invoked once the CSS has been applied * * @method appendStylesheetCb * @param {String} cssURI URI of the CSS to load, if empty ignores and just calls back directly * @param {Function(cssURI)} [callback] optional callback which will be called once the CSS is loaded */ _loadingCSSFiles: {}, _loadedCSSFiles: {}, appendStylesheetCb: function(url, callback) { if (!url) { return callback(url); } if (this._loadedCSSFiles[url]) { return callback(url); } var cbs = this._loadingCSSFiles[url]; if (cbs) { return cbs.push(callback); } this._loadingCSSFiles[url] = [callback]; var linkEl = document.createElement('link'); linkEl.type = 'text/css'; linkEl.rel = 'stylesheet'; linkEl.href = url; var headEl = document.getElementsByTagName('head')[0]; headEl.appendChild(linkEl); var imgEl = document.createElement('img'); /* var _self = this; (function(_url) { imgEl.onerror = function() { //var url = this; var url = _url; _self._loadedCSSFiles[url] = true; var callbacks = _self._loadingCSSFiles[url]; for (var i = 0, f = callbacks.length; i < f; ++i) { callbacks[i](url); } delete _self._loadingCSSFiles[url]; }; })(url); */ imgEl.onerror = Ink.bindEvent(function(event, _url) { //var url = this; var url = _url; this._loadedCSSFiles[url] = true; var callbacks = this._loadingCSSFiles[url]; for (var i = 0, f = callbacks.length; i < f; ++i) { callbacks[i](url); } delete this._loadingCSSFiles[url]; }, this, url); imgEl.src = url; }, /** * Converts decimal to hexadecimal values, for use with colors * * @method decToHex * @param {String} dec Either a single decimal value, * an rgb(r, g, b) string or an Object with r, g and b properties * @return Hexadecimal value */ decToHex: function(dec) { var normalizeTo2 = function(val) { if (val.length === 1) { val = '0' + val; } val = val.toUpperCase(); return val; }; if (typeof dec === 'object') { var rDec = normalizeTo2(parseInt(dec.r, 10).toString(16)); var gDec = normalizeTo2(parseInt(dec.g, 10).toString(16)); var bDec = normalizeTo2(parseInt(dec.b, 10).toString(16)); return rDec+gDec+bDec; } else { dec += ''; var rgb = dec.match(/\((\d+),\s?(\d+),\s?(\d+)\)/); if (rgb !== null) { return normalizeTo2(parseInt(rgb[1], 10).toString(16)) + normalizeTo2(parseInt(rgb[2], 10).toString(16)) + normalizeTo2(parseInt(rgb[3], 10).toString(16)); } else { return normalizeTo2(parseInt(dec, 10).toString(16)); } } }, /** * Converts hexadecimal values to decimal, for use with colors * * @method hexToDec * @param {String} hex hexadecimal value with 6, 3, 2 or 1 characters * @return {Number} Object with properties r, g, b if length of number is >= 3 or decimal value instead. */ hexToDec: function(hex){ if (hex.indexOf('#') === 0) { hex = hex.substr(1); } if (hex.length === 6) { // will return object RGB return { r: parseInt(hex.substr(0,2), 16), g: parseInt(hex.substr(2,2), 16), b: parseInt(hex.substr(4,2), 16) }; } else if (hex.length === 3) { // will return object RGB return { r: parseInt(hex.charAt(0) + hex.charAt(0), 16), g: parseInt(hex.charAt(1) + hex.charAt(1), 16), b: parseInt(hex.charAt(2) + hex.charAt(2), 16) }; } else if (hex.length <= 2) { // will return int return parseInt(hex, 16); } }, /** * use this to obtain the value of a CSS property (searched from loaded CSS documents) * * @method getPropertyFromStylesheet * @param {String} selector a CSS rule. must be an exact match * @param {String} property a CSS property * @return {String} value of the found property, or null if it wasn't matched */ getPropertyFromStylesheet: function(selector, property) { var rule = this.getRuleFromStylesheet(selector); if (rule) { return rule.style[property]; } return null; }, getPropertyFromStylesheet2: function(selector, property) { var rules = this.getRulesFromStylesheet(selector); /* rules.forEach(function(rule) { var x = rule.style[property]; if (x !== null && x !== undefined) { return x; } }); */ var x; for(var i=0, t=rules.length; i < t; i++) { x = rules[i].style[property]; if (x !== null && x !== undefined) { return x; } } return null; }, getRuleFromStylesheet: function(selector) { var sheet, rules, ri, rf, rule; var s = document.styleSheets; if (!s) { return null; } for (var si = 0, sf = document.styleSheets.length; si < sf; ++si) { sheet = document.styleSheets[si]; rules = sheet.rules ? sheet.rules : sheet.cssRules; if (!rules) { return null; } for (ri = 0, rf = rules.length; ri < rf; ++ri) { rule = rules[ri]; if (!rule.selectorText) { continue; } if (rule.selectorText === selector) { return rule; } } } return null; }, getRulesFromStylesheet: function(selector) { var res = []; var sheet, rules, ri, rf, rule; var s = document.styleSheets; if (!s) { return res; } for (var si = 0, sf = document.styleSheets.length; si < sf; ++si) { sheet = document.styleSheets[si]; rules = sheet.rules ? sheet.rules : sheet.cssRules; if (!rules) { return null; } for (ri = 0, rf = rules.length; ri < rf; ++ri) { rule = rules[ri]; if (!rule.selectorText) { continue; } if (rule.selectorText === selector) { res.push(rule); } } } return res; }, getPropertiesFromRule: function(selector) { var rule = this.getRuleFromStylesheet(selector); var props = {}; var prop, i, f; /*if (typeof rule.style.length === 'snumber') { for (i = 0, f = rule.style.length; i < f; ++i) { prop = this._camelCase( rule.style[i] ); props[prop] = rule.style[prop]; } } else { // HANDLES IE 8, FIREFOX RULE JOINING... */ rule = rule.style.cssText; var parts = rule.split(';'); var steps, val, pre, pos; for (i = 0, f = parts.length; i < f; ++i) { if (parts[i].charAt(0) === ' ') { parts[i] = parts[i].substring(1); } steps = parts[i].split(':'); prop = this._camelCase( steps[0].toLowerCase() ); val = steps[1]; if (val) { val = val.substring(1); if (prop === 'padding' || prop === 'margin' || prop === 'borderWidth') { if (prop === 'borderWidth') { pre = 'border'; pos = 'Width'; } else { pre = prop; pos = ''; } if (val.indexOf(' ') !== -1) { val = val.split(' '); props[pre + 'Top' + pos] = val[0]; props[pre + 'Bottom'+ pos] = val[0]; props[pre + 'Left' + pos] = val[1]; props[pre + 'Right' + pos] = val[1]; } else { props[pre + 'Top' + pos] = val; props[pre + 'Bottom'+ pos] = val; props[pre + 'Left' + pos] = val; props[pre + 'Right' + pos] = val; } } else if (prop === 'borderRadius') { if (val.indexOf(' ') !== -1) { val = val.split(' '); props.borderTopLeftRadius = val[0]; props.borderBottomRightRadius = val[0]; props.borderTopRightRadius = val[1]; props.borderBottomLeftRadius = val[1]; } else { props.borderTopLeftRadius = val; props.borderTopRightRadius = val; props.borderBottomLeftRadius = val; props.borderBottomRightRadius = val; } } else { props[prop] = val; } } } //} //console.log(props); return props; }, /** * Changes the font size of the elements which match the given CSS rule * For this function to work, the CSS file must be in the same domain than the host page, otherwise JS can't access it. * * @method changeFontSize * @param {String} selector CSS selector rule * @param {Number} delta number of pixels to change on font-size * @param {String} [op] supported operations are '+' and '*'. defaults to '+' * @param {Number} [minVal] if result gets smaller than minVal, change does not occurr * @param {Number} [maxVal] if result gets bigger than maxVal, change does not occurr */ changeFontSize: function(selector, delta, op, minVal, maxVal) { var that = this; Ink.requireModules(['Ink.Dom.Selector_1'], function(Selector) { var e; if (typeof selector !== 'string') { e = '1st argument must be a CSS selector rule.'; } else if (typeof delta !== 'number') { e = '2nd argument must be a number.'; } else if (op !== undefined && op !== '+' && op !== '*') { e = '3rd argument must be one of "+", "*".'; } else if (minVal !== undefined && (typeof minVal !== 'number' || minVal <= 0)) { e = '4th argument must be a positive number.'; } else if (maxVal !== undefined && (typeof maxVal !== 'number' || maxVal < maxVal)) { e = '5th argument must be a positive number greater than minValue.'; } if (e) { throw new TypeError(e); } var val, el, els = Selector.select(selector); if (minVal === undefined) { minVal = 1; } op = (op === '*') ? function(a,b){return a*b;} : function(a,b){return a+b;}; for (var i = 0, f = els.length; i < f; ++i) { el = els[i]; val = parseFloat( that.getStyle(el, 'fontSize')); val = op(val, delta); if (val < minVal) { continue; } if (typeof maxVal === 'number' && val > maxVal) { continue; } el.style.fontSize = val + 'px'; } }); } }; return Css; }); /** * @author inkdev AT sapo.pt */ Ink.createModule('Ink.Dom.Element', 1, [], function() { 'use strict'; var createContextualFragmentSupport = ( typeof document.createRange === 'function' && typeof window.Range.prototype.createContextualFragment === 'function'); var deleteThisTbodyToken = 'Ink.Dom.Element tbody: ' + Math.random(); var browserCreatesTbodies = (function () { var div = document.createElement('div'); div.innerHTML = '<table>'; return div.getElementsByTagName('tbody').length !== 0; }()); function rect(elem){ var dimensions = {}; try { dimensions = elem.getBoundingClientRect(); } catch(e){ dimensions = { top: elem.offsetTop, left: elem.offsetLeft }; } return dimensions; } /** * @module Ink.Dom.Element_1 */ /** * @class Ink.Dom.Element */ var InkElement = { /** * Shortcut for `document.getElementById` * * @method get * @param {String|DOMElement} elm Either an ID of an element, or an element. * @return {DOMElement|null} The DOM element with the given id or null when it was not found */ get: function(elm) { if(typeof elm !== 'undefined') { if(typeof elm === 'string') { return document.getElementById(elm); } return elm; } return null; }, /** * Creates a DOM element * * @method create * @param {String} tag tag name * @param {Object} properties object with properties to be set on the element. You can also call other functions in Ink.Dom.Element like this * * @example * * var myPanel = InkElement.create('div', { * appendHTML: '<span></span>', * className: 'classes to add', * insertAfter: anotherPane * }; * * myPanel.innerHTML; // -> '<div class="classes to add"><span></span></div> * myPanel.parentNode; // -> anotherPane */ create: function(tag, properties) { var el = document.createElement(tag); //Ink.extendObj(el, properties); for(var property in properties) { if(properties.hasOwnProperty(property)) { if (property in InkElement) { InkElement[property](el, properties[property]); } else { if(property === 'className' || property === 'class') { el.className = properties.className || properties['class']; } else { el.setAttribute(property, properties[property]); } } } } return el; }, /** * Removes a DOM Element from the DOM * * @method remove * @param {DOMElement} elm The element to remove */ remove: function(el) { var parEl; if (el && (parEl = el.parentNode)) { parEl.removeChild(el); } }, /** * Scrolls the window to an element * * @method scrollTo * @param {DOMElement|String} elm Element where to scroll */ scrollTo: function(elm) { elm = InkElement.get(elm); if(elm) { if (elm.scrollIntoView) { return elm.scrollIntoView(); } var elmOffset = {}, elmTop = 0, elmLeft = 0; do { elmTop += elm.offsetTop || 0; elmLeft += elm.offsetLeft || 0; elm = elm.offsetParent; } while(elm); elmOffset = {x: elmLeft, y: elmTop}; window.scrollTo(elmOffset.x, elmOffset.y); } }, /** * Gets the top cumulative offset for an element * * Requires Ink.Dom.Browser * * @method offsetTop * @param {DOMElement|String} elm target element * @return {Number} Offset from the target element to the top of the document */ offsetTop: function(elm) { return InkElement.offset(elm)[1]; }, /** * Gets the left cumulative offset for an element * * Requires Ink.Dom.Browser * * @method offsetLeft * @param {DOMElement|String} elm target element * @return {Number} Offset from the target element to the left of the document */ offsetLeft: function(elm) { return InkElement.offset(elm)[0]; }, /** * Gets the element offset relative to its closest positioned ancestor * * @method positionedOffset * @param {DOMElement|String} elm target element * @return {Array} Array with the element offsetleft and offsettop relative to the closest positioned ancestor */ positionedOffset: function(element) { var valueTop = 0, valueLeft = 0; element = InkElement.get(element); do { valueTop += element.offsetTop || 0; valueLeft += element.offsetLeft || 0; element = element.offsetParent; if (element) { if (element.tagName.toLowerCase() === 'body') { break; } var value = element.style.position; if (!value && element.currentStyle) { value = element.currentStyle.position; } if ((!value || value === 'auto') && typeof getComputedStyle !== 'undefined') { var css = getComputedStyle(element, null); value = css ? css.position : null; } if (value === 'relative' || value === 'absolute') { break; } } } while (element); return [valueLeft, valueTop]; }, /** * Gets the cumulative offset for an element * * Returns the top left position of the element on the page * * Requires Ink.Dom.Browser * * @method offset * @param {DOMElement|String} elm Target element * @return {[Number, Number]} Array with pixel distance from the target element to the top left corner of the document */ offset: function(el) { /*jshint boss:true */ el = Ink.i(el); var res = [0, 0]; var doc = el.ownerDocument, docElem = doc.documentElement, box = rect(el), body = doc.body, clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, scrollTop = doc.pageYOffset || docElem.scrollTop || body.scrollTop, scrollLeft = doc.pageXOffset || docElem.scrollLeft || body.scrollLeft, top = box.top + scrollTop - clientTop, left = box.left + scrollLeft - clientLeft; res = [left, top]; return res; }, /** * Gets the scroll of the element * * @method scroll * @param {DOMElement|String} [elm] target element or document.body * @returns {Array} offset values for x and y scroll */ scroll: function(elm) { elm = elm ? Ink.i(elm) : document.body; return [ ( ( !window.pageXOffset ) ? elm.scrollLeft : window.pageXOffset ), ( ( !window.pageYOffset ) ? elm.scrollTop : window.pageYOffset ) ]; }, _getPropPx: function(cs, prop) { var n, c; var val = cs.getPropertyValue ? cs.getPropertyValue(prop) : cs[prop]; if (!val) { n = 0; } else { c = val.indexOf('px'); if (c === -1) { n = 0; } else { n = parseFloat(val, 10); } } //console.log([prop, ' "', val, '" ', n].join('')); return n; }, /** * Alias for offset() * * @method offset2 * @deprecated Kept for historic reasons. Use offset() instead. */ offset2: function(el) { return InkElement.offset(el); }, /** * Verifies the existence of an attribute * * @method hasAttribute * @param {Object} elm target element * @param {String} attr attribute name * @return {Boolean} Boolean based on existance of attribute */ hasAttribute: function(elm, attr){ return elm.hasAttribute ? elm.hasAttribute(attr) : !!elm.getAttribute(attr); }, /** * Inserts a element immediately after a target element * * @method insertAfter * @param {DOMElement} newElm element to be inserted * @param {DOMElement|String} targetElm key element */ insertAfter: function(newElm, targetElm) { /*jshint boss:true */ if (targetElm = InkElement.get(targetElm)) { if (targetElm.nextSibling !== null) { targetElm.parentNode.insertBefore(newElm, targetElm.nextSibling); } else { targetElm.parentNode.appendChild(newElm); } } }, /** * Inserts an element before a target element * * @method insertBefore * @param {DOMElement} newElm element to be inserted * @param {DOMElement|String} targetElm key element */ insertBefore: function (newElm, targetElm) { /*jshint boss:true */ if ( (targetElm = InkElement.get(targetElm)) ) { targetElm.parentNode.insertBefore(newElm, targetElm); } }, /** * Inserts a element at the top of the childNodes of a target element * * @method insertTop * @param {DOMElement} newElm element to be inserted * @param {DOMElement|String} targetElm key element */ insertTop: function(newElm,targetElm) { /*jshint boss:true */ if (targetElm = InkElement.get(targetElm)) { if (targetElm.firstChild) { targetElm.insertBefore(newElm, targetElm.firstChild); } else { targetElm.appendChild(newElm); } } }, /** * Inserts an element after all the child nodes of another element * * @method insertBottom * @param {DOMElement} newElm element to be inserted * @param {DOMElement|String} targetElm key element */ insertBottom: function(newElm,targetElm) { /*jshint boss:true */ targetElm.appendChild(newElm); }, /** * Retrieves textContent from node * * @method innerText * @param {DOMNode} node from which to retreive text from. Can be any node type. * @return {String} the text */ textContent: function(node){ node = Ink.i(node); var text, k, cs, m; switch(node && node.nodeType) { case 9: /*DOCUMENT_NODE*/ // IE quirks mode does not have documentElement return InkElement.textContent(node.documentElement || node.body && node.body.parentNode || node.body); case 1: /*ELEMENT_NODE*/ text = node.innerText; if (typeof text !== 'undefined') { return text; } /* falls through */ case 11: /*DOCUMENT_FRAGMENT_NODE*/ text = node.textContent; if (typeof text !== 'undefined') { return text; } if (node.firstChild === node.lastChild) { // Common case: 0 or 1 children return InkElement.textContent(node.firstChild); } text = []; cs = node.childNodes; for (k = 0, m = cs.length; k < m; ++k) { text.push( InkElement.textContent( cs[k] ) ); } return text.join(''); case 3: /*TEXT_NODE*/ case 4: /*CDATA_SECTION_NODE*/ return node.nodeValue; } return ''; }, /** * Removes all nodes children and adds the text * * @method setTextContent * @param {DOMNode} node node to add the text to. Can be any node type. * @param {String} text text to be appended to the node. */ setTextContent: function(node, text){ node = Ink.i(node); switch(node && node.nodeType) { case 1: /*ELEMENT_NODE*/ if ('innerText' in node) { node.innerText = text; break; } /* falls through */ case 11: /*DOCUMENT_FRAGMENT_NODE*/ if ('textContent' in node) { node.textContent = text; break; } /* falls through */ case 9: /*DOCUMENT_NODE*/ while(node.firstChild) { node.removeChild(node.firstChild); } if (text !== '') { var doc = node.ownerDocument || node; node.appendChild(doc.createTextNode(text)); } break; case 3: /*TEXT_NODE*/ case 4: /*CDATA_SECTION_NODE*/ node.nodeValue = text; break; } }, /** * Tells if element is a clickable link * * @method isLink * @param {DOMNode} node node to check if it's link * @return {Boolean} */ isLink: function(element){ var b = element && element.nodeType === 1 && ((/^a|area$/i).test(element.tagName) || element.hasAttributeNS && element.hasAttributeNS('http://www.w3.org/1999/xlink','href')); return !!b; }, /** * Tells if ancestor is ancestor of node * * @method isAncestorOf * @param {DOMNode} ancestor ancestor node * @param {DOMNode} node descendant node * @return {Boolean} */ isAncestorOf: function(ancestor, node){ /*jshint boss:true */ if (!node || !ancestor) { return false; } if (node.compareDocumentPosition) { return (ancestor.compareDocumentPosition(node) & 0x10) !== 0;/*Node.DOCUMENT_POSITION_CONTAINED_BY*/ } while (node = node.parentNode){ if (node === ancestor){ return true; } } return false; }, /** * Tells if descendant is descendant of node * * @method descendantOf * @param {DOMNode} node the ancestor * @param {DOMNode} descendant the descendant * @return {Boolean} true if 'descendant' is descendant of 'node' */ descendantOf: function(node, descendant){ return node !== descendant && InkElement.isAncestorOf(node, descendant); }, /** * Get first child in document order of node type 1 * @method firstElementChild * @param {DOMNode} elm parent node * @return {DOMNode} the element child */ firstElementChild: function(elm){ if(!elm) { return null; } if ('firstElementChild' in elm) { return elm.firstElementChild; } var child = elm.firstChild; while(child && child.nodeType !== 1) { child = child.nextSibling; } return child; }, /** * Get last child in document order of node type 1 * @method lastElementChild * @param {DOMNode} elm parent node * @return {DOMNode} the element child */ lastElementChild: function(elm){ if(!elm) { return null; } if ('lastElementChild' in elm) { return elm.lastElementChild; } var child = elm.lastChild; while(child && child.nodeType !== 1) { child = child.previousSibling; } return child; }, /** * Get the first element sibling after the node * * @method nextElementSibling * @param {DOMNode} node current node * @return {DOMNode|Null} the first element sibling after node or null if none is found */ nextElementSibling: function(node){ var sibling = null; if(!node){ return sibling; } if("nextElementSibling" in node){ return node.nextElementSibling; } else { sibling = node.nextSibling; // 1 === Node.ELEMENT_NODE while(sibling && sibling.nodeType !== 1){ sibling = sibling.nextSibling; } return sibling; } }, /** * Get the first element sibling before the node * * @method previousElementSibling * @param {DOMNode} node current node * @return {DOMNode|Null} the first element sibling before node or null if none is found */ previousElementSibling: function(node){ var sibling = null; if(!node){ return sibling; } if("previousElementSibling" in node){ return node.previousElementSibling; } else { sibling = node.previousSibling; // 1 === Node.ELEMENT_NODE while(sibling && sibling.nodeType !== 1){ sibling = sibling.previousSibling; } return sibling; } }, /** * Returns the width of the given element, in pixels * * @method elementWidth * @param {DOMElement|string} element target DOM element or target ID * @return {Number} the element's width */ elementWidth: function(element) { if(typeof element === "string") { element = document.getElementById(element); } return element.offsetWidth; }, /** * Returns the height of the given element, in pixels * * @method elementHeight * @param {DOMElement|string} element target DOM element or target ID * @return {Number} the element's height */ elementHeight: function(element) { if(typeof element === "string") { element = document.getElementById(element); } return element.offsetHeight; }, /** * Returns the element's left position in pixels * * @method elementLeft * @param {DOMElement|string} element target DOM element or target ID * @return {Number} element's left position */ elementLeft: function(element) { if(typeof element === "string") { element = document.getElementById(element); } return element.offsetLeft; }, /** * Returns the element's top position in pixels * * @method elementTop * @param {DOMElement|string} element target DOM element or target ID * @return {Number} element's top position */ elementTop: function(element) { if(typeof element === "string") { element = document.getElementById(element); } return element.offsetTop; }, /** * Returns the dimensions of the given element, in pixels * * @method elementDimensions * @param {element} element target element * @return {Array} array with element's width and height */ elementDimensions: function(element) { element = Ink.i(element); return [element.offsetWidth, element.offsetHeight]; }, /** * Returns the outer (width + margin + padding included) dimensions of an element, in pixels. * * Requires Ink.Dom.Css * * @method outerDimensions * @param {DOMElement} element Target element * @return {Array} Array with element width and height. */ outerDimensions: function (element) { var bbox = rect(element); var Css = Ink.getModule('Ink.Dom.Css_1'); var getStyle = Ink.bindMethod(Css, 'getStyle', element); return [ bbox.right - bbox.left + parseFloat(getStyle('marginLeft') || 0) + parseFloat(getStyle('marginRight') || 0), // w bbox.bottom - bbox.top + parseFloat(getStyle('marginTop') || 0) + parseFloat(getStyle('marginBottom') || 0) // h ]; }, /** * Check whether an element is inside the viewport * * @method inViewport * @param {DOMElement} element Element to check * @param {Boolean} [partial=false] Return `true` even if it is only partially visible. * @return {Boolean} */ inViewport: function (element, partial) { var dims = rect(Ink.i(element)); if (partial) { return dims.bottom > 0 && // from the top dims.left < InkElement.viewportWidth() && // from the right dims.top < InkElement.viewportHeight() && // from the bottom dims.right > 0; // from the left } else { return dims.top > 0 && // from the top dims.right < InkElement.viewportWidth() && // from the right dims.bottom < InkElement.viewportHeight() && // from the bottom dims.left > 0; // from the left } }, /** * Check whether an element is hidden * Taken from Mootools Element extras ( https://gist.github.com/cheeaun/73342 ) * Does not take into account visibility:hidden * @method isHidden * @param {DOMElement} element Element to check * @return {Boolean} */ isHidden: function (element) { var w = element.offsetWidth, h = element.offsetHeight, force = (element.tagName.toLowerCase() === 'tr'); var Css = Ink.getModule('Ink.Dom.Css_1'); return (w===0 && h===0 && !force) ? true : (w!==0 && h!==0 && !force) ? false : Css.getStyle(element, 'display').toLowerCase() === 'none'; }, /** * Check whether an element is visible * * @method isVisible * @param {DOMElement} element Element to check * @return {Boolean} */ isVisible: function (element) { return !this.isHidden(element); }, /** * Applies the cloneFrom's dimensions to cloneTo * * @method clonePosition * @param {DOMElement} cloneTo element to be position cloned * @param {DOMElement} cloneFrom element to get the cloned position * @return {DOMElement} the element with positionClone */ clonePosition: function(cloneTo, cloneFrom){ var pos = InkElement.offset(cloneFrom); cloneTo.style.left = pos[0]+'px'; cloneTo.style.top = pos[1]+'px'; return cloneTo; }, /** * Slices off a piece of text at the end of the element and adds the ellipsis * so all text fits in the element. * * @method ellipsizeText * @param {DOMElement} element which text is to add the ellipsis * @param {String} [ellipsis='\u2026'] String to append to the chopped text */ ellipsizeText: function(element, ellipsis){ /*jshint boss:true */ if (element = Ink.i(element)){ while (element && element.scrollHeight > (element.offsetHeight + 8)) { element.textContent = element.textContent.replace(/(\s+\S+)\s*$/, ellipsis || '\u2026'); } } }, /** * Searches up the DOM tree for an element fulfilling the boolTest function (returning trueish) * * @method findUpwardsHaving * @param {HtmlElement} element * @param {Function} boolTest * @return {HtmlElement|false} the matched element or false if did not match */ findUpwardsHaving: function(element, boolTest) { while (element && element.nodeType === 1) { if (boolTest(element)) { return element; } element = element.parentNode; } return false; }, /** * Śearches up the DOM tree for an element of specified class name * * @method findUpwardsByClass * @param {HtmlElement} element * @param {String} className * @returns {HtmlElement|false} the matched element or false if did not match */ findUpwardsByClass: function(element, className) { var re = new RegExp("(^|\\s)" + className + "(\\s|$)"); var tst = function(el) { var cls = el.className; return cls && re.test(cls); }; return InkElement.findUpwardsHaving(element, tst); }, /** * Śearches up the DOM tree for an element of specified tag * * @method findUpwardsByTag * @param {HtmlElement} element * @param {String} tag * @returns {HtmlElement|false} the matched element or false if did not match */ findUpwardsByTag: function(element, tag) { tag = tag.toUpperCase(); var tst = function(el) { return el.nodeName && el.nodeName.toUpperCase() === tag; }; return InkElement.findUpwardsHaving(element, tst); }, /** * Śearches up the DOM tree for an element of specified id * * @method findUpwardsById * @param {HtmlElement} element * @param {String} id * @returns {HtmlElement|false} the matched element or false if did not match */ findUpwardsById: function(element, id) { var tst = function(el) { return el.id === id; }; return InkElement.findUpwardsHaving(element, tst); }, /** * Śearches up the DOM tree for an element matching the given selector * * @method findUpwardsBySelector * @param {HtmlElement} element * @param {String} sel * @returns {HtmlElement|false} the matched element or false if did not match */ findUpwardsBySelector: function(element, sel) { var Selector = Ink.getModule('Ink.Dom.Selector'); if (!Selector) { throw new Error('This method requires Ink.Dom.Selector'); } var tst = function(el) { return Selector.matchesSelector(el, sel); }; return InkElement.findUpwardsHaving(element, tst); }, /** * Returns trimmed text content of descendants * * @method getChildrenText * @param {DOMElement} el element being seeked * @param {Boolean} [removeIt] whether to remove the found text nodes or not * @return {String} text found */ getChildrenText: function(el, removeIt) { var node, j, part, nodes = el.childNodes, jLen = nodes.length, text = ''; if (!el) { return text; } for (j = 0; j < jLen; ++j) { node = nodes[j]; if (!node) { continue; } if (node.nodeType === 3) { // TEXT NODE part = InkElement._trimString( String(node.data) ); if (part.length > 0) { text += part; if (removeIt) { el.removeChild(node); } } else { el.removeChild(node); } } } return text; }, /** * String trim implementation * Used by getChildrenText * * function _trimString * param {String} text * return {String} trimmed text */ _trimString: function(text) { return (String.prototype.trim) ? text.trim() : text.replace(/^\s*/, '').replace(/\s*$/, ''); }, /** * Returns the values of a select element * * @method getSelectValues * @param {DomElement|String} select element * @return {Array} selected values */ getSelectValues: function (select) { var selectEl = Ink.i(select); var values = []; for (var i = 0; i < selectEl.options.length; ++i) { values.push( selectEl.options[i].value ); } return values; }, /* used by fills */ _normalizeData: function(data) { var d, data2 = []; for (var i = 0, f = data.length; i < f; ++i) { d = data[i]; if (!(d instanceof Array)) { // if not array, wraps primitive twice: val -> [val, val] d = [d, d]; } else if (d.length === 1) { // if 1 element array: [val] -> [val, val] d.push(d[0]); } data2.push(d); } return data2; }, /** * Fills select element with choices * * @method fillSelect * @param {DomElement|String} container select element which will get filled * @param {Array} data data which will populate the component * @param {Boolean} [skipEmpty] true to skip empty option * @param {String|Number} [defaultValue] primitive value to select at beginning */ fillSelect: function(container, data, skipEmpty, defaultValue) { var containerEl = Ink.i(container); if (!containerEl) { return; } containerEl.innerHTML = ''; var d, optionEl; if (!skipEmpty) { // add initial empty option optionEl = document.createElement('option'); optionEl.setAttribute('value', ''); containerEl.appendChild(optionEl); } data = InkElement._normalizeData(data); for (var i = 0, f = data.length; i < f; ++i) { d = data[i]; optionEl = document.createElement('option'); optionEl.setAttribute('value', d[0]); if (d.length > 2) { optionEl.setAttribute('extra', d[2]); } optionEl.appendChild( document.createTextNode(d[1]) ); if (d[0] === defaultValue) { optionEl.setAttribute('selected', 'selected'); } containerEl.appendChild(optionEl); } }, /** * Select element on steroids - allows the creation of new values * * @method fillSelect2 * @param {DomElement|String} ctn select element which will get filled * @param {Object} opts * @param {Array} [opts.data] data which will populate the component * @param {Boolean} [opts.skipEmpty] if true empty option is not created (defaults to false) * @param {String} [opts.emptyLabel] label to display on empty option * @param {String} [opts.createLabel] label to display on create option * @param {String} [opts.optionsGroupLabel] text to display on group surrounding value options * @param {String} [opts.defaultValue] option to select initially * @param {Function(selEl, addOptFn)} [opts.onCreate] callback that gets called once user selects the create option */ fillSelect2: function(ctn, opts) { ctn = Ink.i(ctn); ctn.innerHTML = ''; var defs = { skipEmpty: false, skipCreate: false, emptyLabel: 'none', createLabel: 'create', optionsGroupLabel: 'groups', emptyOptionsGroupLabel: 'none exist', defaultValue: '' }; if (!opts) { throw 'param opts is a requirement!'; } if (!opts.data) { throw 'opts.data is a requirement!'; } opts = Ink.extendObj(defs, opts); var optionEl, d; var optGroupValuesEl = document.createElement('optgroup'); optGroupValuesEl.setAttribute('label', opts.optionsGroupLabel); opts.data = InkElement._normalizeData(opts.data); if (!opts.skipCreate) { opts.data.unshift(['$create$', opts.createLabel]); } if (!opts.skipEmpty) { opts.data.unshift(['', opts.emptyLabel]); } for (var i = 0, f = opts.data.length; i < f; ++i) { d = opts.data[i]; optionEl = document.createElement('option'); optionEl.setAttribute('value', d[0]); optionEl.appendChild( document.createTextNode(d[1]) ); if (d[0] === opts.defaultValue) { optionEl.setAttribute('selected', 'selected'); } if (d[0] === '' || d[0] === '$create$') { ctn.appendChild(optionEl); } else { optGroupValuesEl.appendChild(optionEl); } } var lastValIsNotOption = function(data) { var lastVal = data[data.length-1][0]; return (lastVal === '' || lastVal === '$create$'); }; if (lastValIsNotOption(opts.data)) { optionEl = document.createElement('option'); optionEl.setAttribute('value', '$dummy$'); optionEl.setAttribute('disabled', 'disabled'); optionEl.appendChild( document.createTextNode(opts.emptyOptionsGroupLabel) ); optGroupValuesEl.appendChild(optionEl); } ctn.appendChild(optGroupValuesEl); var addOption = function(v, l) { var optionEl = ctn.options[ctn.options.length - 1]; if (optionEl.getAttribute('disabled')) { optionEl.parentNode.removeChild(optionEl); } // create it optionEl = document.createElement('option'); optionEl.setAttribute('value', v); optionEl.appendChild( document.createTextNode(l) ); optGroupValuesEl.appendChild(optionEl); // select it ctn.options[ctn.options.length - 1].setAttribute('selected', true); }; if (!opts.skipCreate) { ctn.onchange = function() { if ((ctn.value === '$create$') && (typeof opts.onCreate === 'function')) { opts.onCreate(ctn, addOption); } }; } }, /** * Creates set of radio buttons, returns wrapper * * @method fillRadios * @param {DomElement|String} insertAfterEl element which will precede the input elements * @param {String} name name to give to the form field ([] is added if not as suffix already) * @param {Array} data data which will populate the component * @param {Boolean} [skipEmpty] true to skip empty option * @param {String|Number} [defaultValue] primitive value to select at beginning * @param {String} [splitEl] name of element to add after each input element (example: 'br') * @return {DOMElement} wrapper element around radio buttons */ fillRadios: function(insertAfterEl, name, data, skipEmpty, defaultValue, splitEl) { var afterEl = Ink.i(insertAfterEl); afterEl = afterEl.nextSibling; while (afterEl && afterEl.nodeType !== 1) { afterEl = afterEl.nextSibling; } var containerEl = document.createElement('span'); if (afterEl) { afterEl.parentNode.insertBefore(containerEl, afterEl); } else { Ink.i(insertAfterEl).appendChild(containerEl); } data = InkElement._normalizeData(data); if (name.substring(name.length - 1) !== ']') { name += '[]'; } var d, inputEl; if (!skipEmpty) { // add initial empty option inputEl = document.createElement('input'); inputEl.setAttribute('type', 'radio'); inputEl.setAttribute('name', name); inputEl.setAttribute('value', ''); containerEl.appendChild(inputEl); if (splitEl) { containerEl.appendChild( document.createElement(splitEl) ); } } for (var i = 0; i < data.length; ++i) { d = data[i]; inputEl = document.createElement('input'); inputEl.setAttribute('type', 'radio'); inputEl.setAttribute('name', name); inputEl.setAttribute('value', d[0]); containerEl.appendChild(inputEl); containerEl.appendChild( document.createTextNode(d[1]) ); if (splitEl) { containerEl.appendChild( document.createElement(splitEl) ); } if (d[0] === defaultValue) { inputEl.checked = true; } } return containerEl; }, /** * Creates set of checkbox buttons, returns wrapper * * @method fillChecks * @param {DomElement|String} insertAfterEl element which will precede the input elements * @param {String} name name to give to the form field ([] is added if not as suffix already) * @param {Array} data data which will populate the component * @param {Boolean} [skipEmpty] true to skip empty option * @param {String|Number} [defaultValue] primitive value to select at beginning * @param {String} [splitEl] name of element to add after each input element (example: 'br') * @return {DOMElement} wrapper element around checkboxes */ fillChecks: function(insertAfterEl, name, data, defaultValue, splitEl) { var afterEl = Ink.i(insertAfterEl); afterEl = afterEl.nextSibling; while (afterEl && afterEl.nodeType !== 1) { afterEl = afterEl.nextSibling; } var containerEl = document.createElement('span'); if (afterEl) { afterEl.parentNode.insertBefore(containerEl, afterEl); } else { Ink.i(insertAfterEl).appendChild(containerEl); } data = InkElement._normalizeData(data); if (name.substring(name.length - 1) !== ']') { name += '[]'; } var d, inputEl; for (var i = 0; i < data.length; ++i) { d = data[i]; inputEl = document.createElement('input'); inputEl.setAttribute('type', 'checkbox'); inputEl.setAttribute('name', name); inputEl.setAttribute('value', d[0]); containerEl.appendChild(inputEl); containerEl.appendChild( document.createTextNode(d[1]) ); if (splitEl) { containerEl.appendChild( document.createElement(splitEl) ); } if (d[0] === defaultValue) { inputEl.checked = true; } } return containerEl; }, /** * Returns index of element from parent, -1 if not child of parent... * * @method parentIndexOf * @param {DOMElement} parentEl Element to parse * @param {DOMElement} childEl Child Element to look for * @return {Number} */ parentIndexOf: function(parentEl, childEl) { var node, idx = 0; for (var i = 0, f = parentEl.childNodes.length; i < f; ++i) { node = parentEl.childNodes[i]; if (node.nodeType === 1) { // ELEMENT if (node === childEl) { return idx; } ++idx; } } return -1; }, /** * Returns an array of elements - the next siblings * * @method nextSiblings * @param {String|DomElement} elm element * @return {Array} Array of next sibling elements */ nextSiblings: function(elm) { if(typeof(elm) === "string") { elm = document.getElementById(elm); } if(typeof(elm) === 'object' && elm !== null && elm.nodeType && elm.nodeType === 1) { var elements = [], siblings = elm.parentNode.children, index = InkElement.parentIndexOf(elm.parentNode, elm); for(var i = ++index, len = siblings.length; i<len; i++) { elements.push(siblings[i]); } return elements; } return []; }, /** * Returns an array of elements - the previous siblings * * @method previousSiblings * @param {String|DomElement} elm element * @return {Array} Array of previous sibling elements */ previousSiblings: function(elm) { if(typeof(elm) === "string") { elm = document.getElementById(elm); } if(typeof(elm) === 'object' && elm !== null && elm.nodeType && elm.nodeType === 1) { var elements = [], siblings = elm.parentNode.children, index = InkElement.parentIndexOf(elm.parentNode, elm); for(var i = 0, len = index; i<len; i++) { elements.push(siblings[i]); } return elements; } return []; }, /** * Returns an array of elements - its siblings * * @method siblings * @param {String|DomElement} elm element * @return {Array} Array of sibling elements */ siblings: function(elm) { if(typeof(elm) === "string") { elm = document.getElementById(elm); } if(typeof(elm) === 'object' && elm !== null && elm.nodeType && elm.nodeType === 1) { var elements = [], siblings = elm.parentNode.children; for(var i = 0, len = siblings.length; i<len; i++) { if(elm !== siblings[i]) { elements.push(siblings[i]); } } return elements; } return []; }, /** * fallback to elem.childElementCount * * @method childElementCount * @param {String|DomElement} elm element * @return {Number} number of child elements */ childElementCount: function(elm) { elm = Ink.i(elm); if ('childElementCount' in elm) { return elm.childElementCount; } if (!elm) { return 0; } return InkElement.siblings(elm).length + 1; }, _wrapElements: { TABLE: function (div, html) { /* If we don't create a tbody, IE7 does that for us. Adding a tbody with a random string and then filtering for that random string is the only way to avoid double insertion of tbodies. */ if (browserCreatesTbodies) { div.innerHTML = "<table>" + html + "<tbody><tr><td>" + deleteThisTbodyToken + "</tr></td></tbody></table>"; } else { div.innerHTML = "<table>" + html + "</table>"; } return div.firstChild; }, TBODY: function (div, html) { div.innerHTML = '<table><tbody>' + html + '</tbody></table>'; return div.firstChild.getElementsByTagName('tbody')[0]; }, THEAD: function (div, html) { div.innerHTML = '<table><thead>' + html + '</thead><tbody></tbody></table>'; return div.firstChild.getElementsByTagName('thead')[0]; }, TFOOT: function (div, html) { div.innerHTML = '<table><tfoot>' + html + '</tfoot><tbody></tbody></table>'; return div.firstChild.getElementsByTagName('tfoot')[0]; }, TR: function (div, html) { div.innerHTML = '<table><tbody><tr>' + html + '</tr></tbody></table>'; return div.firstChild.firstChild.firstChild; } }, /** * Gets a wrapper DIV with a certain HTML content for being inserted in `elm`. * Necessary for appendHTML,prependHTML functions, because they need a container element to copy the children from. * * Works around IE table quirks * @method _getWrapper * @private * @param elm * @param html */ _getWrapper: function (elm, html) { var nodeName = elm.nodeName && elm.nodeName.toUpperCase(); var wrapper = document.createElement('div'); var wrapFunc = InkElement._wrapElements[nodeName]; if ( !wrapFunc ) { wrapper.innerHTML = html; return wrapper; } // special cases wrapper = wrapFunc(wrapper, html); // worst case: tbody auto-creation even when our HTML has a tbody. if (browserCreatesTbodies && nodeName === 'TABLE') { // terrible case. Deal with tbody creation too. var tds = wrapper.getElementsByTagName('td'); for (var i = 0, len = tds.length; i < len; i++) { if (tds[i].innerHTML === deleteThisTbodyToken) { var tbody = tds[i].parentNode.parentNode; tbody.parentNode.removeChild(tbody); } } } return wrapper; }, /** * parses and appends an html string to a container, not destroying its contents * * @method appendHTML * @param {String|DomElement} elm element * @param {String} html markup string */ appendHTML: function(elm, html){ var wrapper = InkElement._getWrapper(elm, html); while (wrapper.firstChild) { elm.appendChild(wrapper.firstChild); } }, /** * parses and prepends an html string to a container, not destroying its contents * * @method prependHTML * @param {String|DomElement} elm element * @param {String} html markup string */ prependHTML: function(elm, html){ var wrapper = InkElement._getWrapper(elm, html); while (wrapper.lastChild) { elm.insertBefore(wrapper.lastChild, elm.firstChild); } }, /** * sets the Inner HTML of an element to the given HTML string * * @method setHTML * @param {String|DomElement} elm element * @param {String} html markup string */ setHTML: function (elm, html) { try { elm.innerHTML = html; } catch (e) { // Tables in IE7 while (elm.firstChild) { elm.removeChild(elm.firstChild); } InkElement.appendHTML(elm, html); } }, /** * Wraps an element inside a container. * * The container may or may not be in the document yet. * * @method wrap * @param {String|DomElement} target Element to be wrapped * @param {String|DomElement} container Element to wrap the target * @return Container element * * @example * before: * * <div id="target"></div> * * call this function to wrap #target with a wrapper div. * * InkElement.wrap('target', InkElement.create('div', {id: 'container'}); * * after: * * <div id="container"><div id="target"></div></div> */ wrap: function (target, container) { target = Ink.i(target); container = Ink.i(container); var nextNode = target.nextSibling; var parent = target.parentNode; container.appendChild(target); if (nextNode !== null) { parent.insertBefore(container, nextNode); } else { parent.appendChild(container); } return container; }, /** * Pulls an element out of its wrapper. * * @method unwrap * @param elem The element you're trying to unwrap. This should be a child of the wrapper. * @param {String} [wrapperSelector] Use this if you want to find your wrapper (if `elem` is inside several layers of wrappers). * * @example * * When you have this: * * <div id="wrapper"> * <div id="unwrapMe"></div> * </div> * * If you do this: * * InkElement.unwrap('unwrapMe'); * * You get this: * * <div id="unwrapMe"></div> * <div id="wrapper"></div> * **/ unwrap: function (elem, wrapperSelector) { elem = Ink.i(elem); var wrapper; if (wrapperSelector) { wrapper = InkElement.findUpwardsBySelector(elem, wrapperSelector); } else { wrapper = elem.parentNode; } if (!wrapper || !wrapper.parentNode) { return; } InkElement.insertBefore(elem, wrapper); }, /** * Replaces an element with another. * * @method replace * @param element The element to be replaced. * @param replacement The new element. * * @example * var newelement1 = InkElement.create('div'); * // ... * replace(Ink.i('element1'), newelement1); */ replace: function (element, replacement) { InkElement.insertBefore(replacement, element); InkElement.remove(element); }, /** * Removes direct children on type text. * Useful to remove nasty layout gaps generated by whitespace on the markup. * * @method removeTextNodeChildren * @param {DOMElement} el */ removeTextNodeChildren: function(el) { var prevEl, toRemove, parent = el; el = el.firstChild; while (el) { toRemove = (el.nodeType === 3); prevEl = el; el = el.nextSibling; if (toRemove) { parent.removeChild(prevEl); } } }, /** * Pass an HTML string and receive a documentFragment with the corresponding elements * @method htmlToFragment * @param {String} html html string * @return {DocumentFragment} DocumentFragment containing all of the elements from the html string */ htmlToFragment: (createContextualFragmentSupport ? function(html){ var range; if(typeof html !== 'string'){ return document.createDocumentFragment(); } range = document.createRange(); // set the context to document.body (firefox does this already, webkit doesn't) range.selectNode(document.body); return range.createContextualFragment(html); } : function (html) { var fragment = document.createDocumentFragment(), tempElement, current; if(typeof html !== 'string'){ return fragment; } tempElement = document.createElement('div'); tempElement.innerHTML = html; // append child removes elements from the original parent while( (current = tempElement.firstChild) ){ // intentional assignment fragment.appendChild(current); } return fragment; }), _camelCase: function(str) { return str ? str.replace(/-(\w)/g, function (_, $1){ return $1.toUpperCase(); }) : str; }, /** * Gets all of the data attributes from an element * * @method data * @param {String|DomElement} selector Element or CSS selector * @return {Object} Object with the data-* properties. If no data-attributes are present, an empty object is returned. */ data: function(selector) { var el; if (typeof selector !== 'object' && typeof selector !== 'string') { throw '[Ink.Dom.Element.data] :: Invalid selector defined'; } if (typeof selector === 'object') { el = selector; } else { var InkDomSelector = Ink.getModule('Ink.Dom.Selector', 1); if (!InkDomSelector) { throw "[Ink.Dom.Element.data] :: this method requires Ink.Dom.Selector - v1"; } el = InkDomSelector.select(selector); if (el.length <= 0) { throw "[Ink.Dom.Element.data] :: Can't find any element with the specified selector"; } el = el[0]; } var dataset = {}; var attrs = el.attributes || []; var curAttr, curAttrName, curAttrValue; if (attrs) { for (var i = 0, total = attrs.length; i < total; ++i) { curAttr = attrs[i]; curAttrName = curAttr.name; curAttrValue = curAttr.value; if (curAttrName && curAttrName.indexOf('data-') === 0) { dataset[InkElement._camelCase(curAttrName.replace('data-', ''))] = curAttrValue; } } } return dataset; }, /** * @method moveCursorTo * @param {Input|Textarea} el * @param {Number} t */ moveCursorTo: function(el, t) { if (el.setSelectionRange) { el.setSelectionRange(t, t); //el.focus(); } else { var range = el.createTextRange(); range.collapse(true); range.moveEnd( 'character', t); range.moveStart('character', t); range.select(); } }, /** * @method pageWidth * @return {Number} page width */ pageWidth: function() { var xScroll; if (window.innerWidth && window.scrollMaxX) { xScroll = window.innerWidth + window.scrollMaxX; } else if (document.body.scrollWidth > document.body.offsetWidth){ xScroll = document.body.scrollWidth; } else { xScroll = document.body.offsetWidth; } var windowWidth; if (window.self.innerWidth) { if(document.documentElement.clientWidth){ windowWidth = document.documentElement.clientWidth; } else { windowWidth = window.self.innerWidth; } } else if (document.documentElement && document.documentElement.clientWidth) { windowWidth = document.documentElement.clientWidth; } else if (document.body) { windowWidth = document.body.clientWidth; } if(xScroll < windowWidth){ return xScroll; } else { return windowWidth; } }, /** * @method pageHeight * @return {Number} page height */ pageHeight: function() { var yScroll; if (window.innerHeight && window.scrollMaxY) { yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ yScroll = document.body.scrollHeight; } else { yScroll = document.body.offsetHeight; } var windowHeight; if (window.self.innerHeight) { windowHeight = window.self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { windowHeight = document.documentElement.clientHeight; } else if (document.body) { windowHeight = document.body.clientHeight; } if(yScroll < windowHeight){ return windowHeight; } else { return yScroll; } }, /** * @method viewportWidth * @return {Number} viewport width in pixels */ viewportWidth: function() { if(typeof window.innerWidth !== "undefined") { return window.innerWidth; } if (document.documentElement && typeof document.documentElement.offsetWidth !== "undefined") { return document.documentElement.offsetWidth; } }, /** * @method viewportHeight * @return {Number} viewport height */ viewportHeight: function() { if (typeof window.innerHeight !== "undefined") { return window.innerHeight; } if (document.documentElement && typeof document.documentElement.offsetHeight !== "undefined") { return document.documentElement.offsetHeight; } }, /** * @method scrollWidth * @return {Number} scroll width */ scrollWidth: function() { if (typeof window.self.pageXOffset !== 'undefined') { return window.self.pageXOffset; } if (typeof document.documentElement !== 'undefined' && typeof document.documentElement.scrollLeft !== 'undefined') { return document.documentElement.scrollLeft; } return document.body.scrollLeft; }, /** * @method scrollHeight * @return {Number} scroll height */ scrollHeight: function() { if (typeof window.self.pageYOffset !== 'undefined') { return window.self.pageYOffset; } if (typeof document.documentElement !== 'undefined' && typeof document.documentElement.scrollTop !== 'undefined') { return document.documentElement.scrollTop; } return document.body.scrollTop; } }; return InkElement; }); /** * @author inkdev AT sapo.pt */ Ink.createModule('Ink.Dom.Event', 1, [], function() { /* jshint asi:true, strict:false, laxcomma:true, eqeqeq:false, laxbreak:true, boss:true, curly:false, expr:true */ /*! * Bean - copyright (c) Jacob Thornton 2011-2012 * https://github.com/fat/bean * MIT license */ var bean = (function (name, context, definition) { return definition() })('bean', this, function (name, context) { name = name || 'bean' context = context || this var win = window , old = context[name] , namespaceRegex = /[^\.]*(?=\..*)\.|.*/ , nameRegex = /\..*/ , addEvent = 'addEventListener' , removeEvent = 'removeEventListener' , doc = document || {} , root = doc.documentElement || {} , W3C_MODEL = root[addEvent] , eventSupport = W3C_MODEL ? addEvent : 'attachEvent' , ONE = {} // singleton for quick matching making add() do one() , slice = Array.prototype.slice , str2arr = function (s, d) { return s.split(d || ' ') } , isString = function (o) { return typeof o == 'string' } , isFunction = function (o) { return typeof o == 'function' } // events that we consider to be 'native', anything not in this list will // be treated as a custom event , standardNativeEvents = 'click dblclick mouseup mousedown contextmenu ' + // mouse buttons 'mousewheel mousemultiwheel DOMMouseScroll ' + // mouse wheel 'mouseover mouseout mousemove selectstart selectend ' + // mouse movement 'keydown keypress keyup ' + // keyboard 'orientationchange ' + // mobile 'focus blur change reset select submit ' + // form elements 'load unload beforeunload resize move DOMContentLoaded ' + // window 'readystatechange message ' + // window 'error abort scroll ' // misc // element.fireEvent('onXYZ'... is not forgiving if we try to fire an event // that doesn't actually exist, so make sure we only do these on newer browsers , w3cNativeEvents = 'show ' + // mouse buttons 'input invalid ' + // form elements 'touchstart touchmove touchend touchcancel ' + // touch 'gesturestart gesturechange gestureend ' + // gesture 'textinput' + // TextEvent 'readystatechange pageshow pagehide popstate ' + // window 'hashchange offline online ' + // window 'afterprint beforeprint ' + // printing 'dragstart dragenter dragover dragleave drag drop dragend ' + // dnd 'loadstart progress suspend emptied stalled loadmetadata ' + // media 'loadeddata canplay canplaythrough playing waiting seeking ' + // media 'seeked ended durationchange timeupdate play pause ratechange ' + // media 'volumechange cuechange ' + // media 'checking noupdate downloading cached updateready obsolete ' // appcache // convert to a hash for quick lookups , nativeEvents = (function (hash, events, i) { for (i = 0; i < events.length; i++) events[i] && (hash[events[i]] = 1) return hash }({}, str2arr(standardNativeEvents + (W3C_MODEL ? w3cNativeEvents : '')))) // custom events are events that we *fake*, they are not provided natively but // we can use native events to generate them , customEvents = (function () { var isAncestor = 'compareDocumentPosition' in root ? function (element, container) { return container.compareDocumentPosition && (container.compareDocumentPosition(element) & 16) === 16 } : 'contains' in root ? function (element, container) { container = container.nodeType === 9 || container === window ? root : container return container !== element && container.contains(element) } : function (element, container) { while (element = element.parentNode) if (element === container) return 1 return 0 } , check = function (event) { var related = event.relatedTarget return !related ? related == null : (related !== this && related.prefix !== 'xul' && !/document/.test(this.toString()) && !isAncestor(related, this)) } return { mouseenter: { base: 'mouseover', condition: check } , mouseleave: { base: 'mouseout', condition: check } , mousewheel: { base: /Firefox/.test(navigator.userAgent) ? 'DOMMouseScroll' : 'mousewheel' } } }()) // we provide a consistent Event object across browsers by taking the actual DOM // event object and generating a new one from its properties. , Event = (function () { // a whitelist of properties (for different event types) tells us what to check for and copy var commonProps = str2arr('altKey attrChange attrName bubbles cancelable ctrlKey currentTarget ' + 'detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey ' + 'srcElement target timeStamp type view which propertyName') , mouseProps = commonProps.concat(str2arr('button buttons clientX clientY dataTransfer ' + 'fromElement offsetX offsetY pageX pageY screenX screenY toElement')) , mouseWheelProps = mouseProps.concat(str2arr('wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ ' + 'axis')) // 'axis' is FF specific , keyProps = commonProps.concat(str2arr('char charCode key keyCode keyIdentifier ' + 'keyLocation location')) , textProps = commonProps.concat(str2arr('data')) , touchProps = commonProps.concat(str2arr('touches targetTouches changedTouches scale rotation')) , messageProps = commonProps.concat(str2arr('data origin source')) , stateProps = commonProps.concat(str2arr('state')) , overOutRegex = /over|out/ // some event types need special handling and some need special properties, do that all here , typeFixers = [ { // key events reg: /key/i , fix: function (event, newEvent) { newEvent.keyCode = event.keyCode || event.which return keyProps } } , { // mouse events reg: /click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i , fix: function (event, newEvent, type) { newEvent.rightClick = event.which === 3 || event.button === 2 newEvent.pos = { x: 0, y: 0 } if (event.pageX || event.pageY) { newEvent.clientX = event.pageX newEvent.clientY = event.pageY } else if (event.clientX || event.clientY) { newEvent.clientX = event.clientX + doc.body.scrollLeft + root.scrollLeft newEvent.clientY = event.clientY + doc.body.scrollTop + root.scrollTop } if (overOutRegex.test(type)) { newEvent.relatedTarget = event.relatedTarget || event[(type == 'mouseover' ? 'from' : 'to') + 'Element'] } return mouseProps } } , { // mouse wheel events reg: /mouse.*(wheel|scroll)/i , fix: function () { return mouseWheelProps } } , { // TextEvent reg: /^text/i , fix: function () { return textProps } } , { // touch and gesture events reg: /^touch|^gesture/i , fix: function () { return touchProps } } , { // message events reg: /^message$/i , fix: function () { return messageProps } } , { // popstate events reg: /^popstate$/i , fix: function () { return stateProps } } , { // everything else reg: /.*/ , fix: function () { return commonProps } } ] , typeFixerMap = {} // used to map event types to fixer functions (above), a basic cache mechanism , Event = function (event, element, isNative) { if (!arguments.length) return event = event || ((element.ownerDocument || element.document || element).parentWindow || win).event this.originalEvent = event this.isNative = isNative this.isBean = true if (!event) return var type = event.type , target = event.target || event.srcElement , i, l, p, props, fixer this.target = target && target.nodeType === 3 ? target.parentNode : target if (isNative) { // we only need basic augmentation on custom events, the rest expensive & pointless fixer = typeFixerMap[type] if (!fixer) { // haven't encountered this event type before, map a fixer function for it for (i = 0, l = typeFixers.length; i < l; i++) { if (typeFixers[i].reg.test(type)) { // guaranteed to match at least one, last is .* typeFixerMap[type] = fixer = typeFixers[i].fix break } } } props = fixer(event, this, type) for (i = props.length; i--;) { if (!((p = props[i]) in this) && p in event) this[p] = event[p] } } } // preventDefault() and stopPropagation() are a consistent interface to those functions // on the DOM, stop() is an alias for both of them together Event.prototype.preventDefault = function () { if (this.originalEvent.preventDefault) this.originalEvent.preventDefault() else this.originalEvent.returnValue = false } Event.prototype.stopPropagation = function () { if (this.originalEvent.stopPropagation) this.originalEvent.stopPropagation() else this.originalEvent.cancelBubble = true } Event.prototype.stop = function () { this.preventDefault() this.stopPropagation() this.stopped = true } // stopImmediatePropagation() has to be handled internally because we manage the event list for // each element // note that originalElement may be a Bean#Event object in some situations Event.prototype.stopImmediatePropagation = function () { if (this.originalEvent.stopImmediatePropagation) this.originalEvent.stopImmediatePropagation() this.isImmediatePropagationStopped = function () { return true } } Event.prototype.isImmediatePropagationStopped = function () { return this.originalEvent.isImmediatePropagationStopped && this.originalEvent.isImmediatePropagationStopped() } Event.prototype.clone = function (currentTarget) { //TODO: this is ripe for optimisation, new events are *expensive* // improving this will speed up delegated events var ne = new Event(this, this.element, this.isNative) ne.currentTarget = currentTarget return ne } return Event }()) // if we're in old IE we can't do onpropertychange on doc or win so we use doc.documentElement for both , targetElement = function (element, isNative) { return !W3C_MODEL && !isNative && (element === doc || element === win) ? root : element } /** * Bean maintains an internal registry for event listeners. We don't touch elements, objects * or functions to identify them, instead we store everything in the registry. * Each event listener has a RegEntry object, we have one 'registry' for the whole instance. */ , RegEntry = (function () { // each handler is wrapped so we can handle delegation and custom events var wrappedHandler = function (element, fn, condition, args) { var call = function (event, eargs) { return fn.apply(element, args ? slice.call(eargs, event ? 0 : 1).concat(args) : eargs) } , findTarget = function (event, eventElement) { return fn.__beanDel ? fn.__beanDel.ft(event.target, element) : eventElement } , handler = condition ? function (event) { var target = findTarget(event, this) // deleated event if (condition.apply(target, arguments)) { if (event) event.currentTarget = target return call(event, arguments) } } : function (event) { if (fn.__beanDel) event = event.clone(findTarget(event)) // delegated event, fix the fix return call(event, arguments) } handler.__beanDel = fn.__beanDel return handler } , RegEntry = function (element, type, handler, original, namespaces, args, root) { var customType = customEvents[type] , isNative if (type == 'unload') { // self clean-up handler = once(removeListener, element, type, handler, original) } if (customType) { if (customType.condition) { handler = wrappedHandler(element, handler, customType.condition, args) } type = customType.base || type } this.isNative = isNative = nativeEvents[type] && !!element[eventSupport] this.customType = !W3C_MODEL && !isNative && type this.element = element this.type = type this.original = original this.namespaces = namespaces this.eventType = W3C_MODEL || isNative ? type : 'propertychange' this.target = targetElement(element, isNative) this[eventSupport] = !!this.target[eventSupport] this.root = root this.handler = wrappedHandler(element, handler, null, args) } // given a list of namespaces, is our entry in any of them? RegEntry.prototype.inNamespaces = function (checkNamespaces) { var i, j, c = 0 if (!checkNamespaces) return true if (!this.namespaces) return false for (i = checkNamespaces.length; i--;) { for (j = this.namespaces.length; j--;) { if (checkNamespaces[i] == this.namespaces[j]) c++ } } return checkNamespaces.length === c } // match by element, original fn (opt), handler fn (opt) RegEntry.prototype.matches = function (checkElement, checkOriginal, checkHandler) { return this.element === checkElement && (!checkOriginal || this.original === checkOriginal) && (!checkHandler || this.handler === checkHandler) } return RegEntry }()) , registry = (function () { // our map stores arrays by event type, just because it's better than storing // everything in a single array. // uses '$' as a prefix for the keys for safety and 'r' as a special prefix for // rootListeners so we can look them up fast var map = {} // generic functional search of our registry for matching listeners, // `fn` returns false to break out of the loop , forAll = function (element, type, original, handler, root, fn) { var pfx = root ? 'r' : '$' if (!type || type == '*') { // search the whole registry for (var t in map) { if (t.charAt(0) == pfx) { forAll(element, t.substr(1), original, handler, root, fn) } } } else { var i = 0, l, list = map[pfx + type], all = element == '*' if (!list) return for (l = list.length; i < l; i++) { if ((all || list[i].matches(element, original, handler)) && !fn(list[i], list, i, type)) return } } } , has = function (element, type, original, root) { // we're not using forAll here simply because it's a bit slower and this // needs to be fast var i, list = map[(root ? 'r' : '$') + type] if (list) { for (i = list.length; i--;) { if (!list[i].root && list[i].matches(element, original, null)) return true } } return false } , get = function (element, type, original, root) { var entries = [] forAll(element, type, original, null, root, function (entry) { return entries.push(entry) }) return entries } , put = function (entry) { var has = !entry.root && !this.has(entry.element, entry.type, null, false) , key = (entry.root ? 'r' : '$') + entry.type ;(map[key] || (map[key] = [])).push(entry) return has } , del = function (entry) { forAll(entry.element, entry.type, null, entry.handler, entry.root, function (entry, list, i) { list.splice(i, 1) entry.removed = true if (list.length === 0) delete map[(entry.root ? 'r' : '$') + entry.type] return false }) } // dump all entries, used for onunload , entries = function () { var t, entries = [] for (t in map) { if (t.charAt(0) == '$') entries = entries.concat(map[t]) } return entries } return { has: has, get: get, put: put, del: del, entries: entries } }()) // we need a selector engine for delegated events, use querySelectorAll if it exists // but for older browsers we need Qwery, Sizzle or similar , selectorEngine , setSelectorEngine = function (e) { if (!arguments.length) { selectorEngine = doc.querySelectorAll ? function (s, r) { return r.querySelectorAll(s) } : function () { throw new Error('Bean: No selector engine installed') // eeek } } else { selectorEngine = e } } // we attach this listener to each DOM event that we need to listen to, only once // per event type per DOM element , rootListener = function (event, type) { if (!W3C_MODEL && type && event && event.propertyName != '_on' + type) return var listeners = registry.get(this, type || event.type, null, false) , l = listeners.length , i = 0 event = new Event(event, this, true) if (type) event.type = type // iterate through all handlers registered for this type, calling them unless they have // been removed by a previous handler or stopImmediatePropagation() has been called for (; i < l && !event.isImmediatePropagationStopped(); i++) { if (!listeners[i].removed) listeners[i].handler.call(this, event) } } // add and remove listeners to DOM elements , listener = W3C_MODEL ? function (element, type, add) { // new browsers element[add ? addEvent : removeEvent](type, rootListener, false) } : function (element, type, add, custom) { // IE8 and below, use attachEvent/detachEvent and we have to piggy-back propertychange events // to simulate event bubbling etc. var entry if (add) { registry.put(entry = new RegEntry( element , custom || type , function (event) { // handler rootListener.call(element, event, custom) } , rootListener , null , null , true // is root )) if (custom && element['_on' + custom] == null) element['_on' + custom] = 0 entry.target.attachEvent('on' + entry.eventType, entry.handler) } else { entry = registry.get(element, custom || type, rootListener, true)[0] if (entry) { entry.target.detachEvent('on' + entry.eventType, entry.handler) registry.del(entry) } } } , once = function (rm, element, type, fn, originalFn) { // wrap the handler in a handler that does a remove as well return function () { fn.apply(this, arguments) rm(element, type, originalFn) } } , removeListener = function (element, orgType, handler, namespaces) { var type = orgType && orgType.replace(nameRegex, '') , handlers = registry.get(element, type, null, false) , removed = {} , i, l for (i = 0, l = handlers.length; i < l; i++) { if ((!handler || handlers[i].original === handler) && handlers[i].inNamespaces(namespaces)) { // TODO: this is problematic, we have a registry.get() and registry.del() that // both do registry searches so we waste cycles doing this. Needs to be rolled into // a single registry.forAll(fn) that removes while finding, but the catch is that // we'll be splicing the arrays that we're iterating over. Needs extra tests to // make sure we don't screw it up. @rvagg registry.del(handlers[i]) if (!removed[handlers[i].eventType] && handlers[i][eventSupport]) removed[handlers[i].eventType] = { t: handlers[i].eventType, c: handlers[i].type } } } // check each type/element for removed listeners and remove the rootListener where it's no longer needed for (i in removed) { if (!registry.has(element, removed[i].t, null, false)) { // last listener of this type, remove the rootListener listener(element, removed[i].t, false, removed[i].c) } } } // set up a delegate helper using the given selector, wrap the handler function , delegate = function (selector, fn) { //TODO: findTarget (therefore $) is called twice, once for match and once for // setting e.currentTarget, fix this so it's only needed once var findTarget = function (target, root) { var i, array = isString(selector) ? selectorEngine(selector, root) : selector for (; target && target !== root; target = target.parentNode) { for (i = array.length; i--;) { if (array[i] === target) return target } } } , handler = function (e) { var match = findTarget(e.target, this) if (match) fn.apply(match, arguments) } // __beanDel isn't pleasant but it's a private function, not exposed outside of Bean handler.__beanDel = { ft : findTarget // attach it here for customEvents to use too , selector : selector } return handler } , fireListener = W3C_MODEL ? function (isNative, type, element) { // modern browsers, do a proper dispatchEvent() var evt = doc.createEvent(isNative ? 'HTMLEvents' : 'UIEvents') evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, win, 1) element.dispatchEvent(evt) } : function (isNative, type, element) { // old browser use onpropertychange, just increment a custom property to trigger the event element = targetElement(element, isNative) isNative ? element.fireEvent('on' + type, doc.createEventObject()) : element['_on' + type]++ } /** * Public API: off(), on(), add(), (remove()), one(), fire(), clone() */ /** * off(element[, eventType(s)[, handler ]]) */ , off = function (element, typeSpec, fn) { var isTypeStr = isString(typeSpec) , k, type, namespaces, i if (isTypeStr && typeSpec.indexOf(' ') > 0) { // off(el, 't1 t2 t3', fn) or off(el, 't1 t2 t3') typeSpec = str2arr(typeSpec) for (i = typeSpec.length; i--;) off(element, typeSpec[i], fn) return element } type = isTypeStr && typeSpec.replace(nameRegex, '') if (type && customEvents[type]) type = customEvents[type].base if (!typeSpec || isTypeStr) { // off(el) or off(el, t1.ns) or off(el, .ns) or off(el, .ns1.ns2.ns3) if (namespaces = isTypeStr && typeSpec.replace(namespaceRegex, '')) namespaces = str2arr(namespaces, '.') removeListener(element, type, fn, namespaces) } else if (isFunction(typeSpec)) { // off(el, fn) removeListener(element, null, typeSpec) } else { // off(el, { t1: fn1, t2, fn2 }) for (k in typeSpec) { if (typeSpec.hasOwnProperty(k)) off(element, k, typeSpec[k]) } } return element } /** * on(element, eventType(s)[, selector], handler[, args ]) */ , on = function(element, events, selector, fn) { var originalFn, type, types, i, args, entry, first //TODO: the undefined check means you can't pass an 'args' argument, fix this perhaps? if (selector === undefined && typeof events == 'object') { //TODO: this can't handle delegated events for (type in events) { if (events.hasOwnProperty(type)) { on.call(this, element, type, events[type]) } } return } if (!isFunction(selector)) { // delegated event originalFn = fn args = slice.call(arguments, 4) fn = delegate(selector, originalFn, selectorEngine) } else { args = slice.call(arguments, 3) fn = originalFn = selector } types = str2arr(events) // special case for one(), wrap in a self-removing handler if (this === ONE) { fn = once(off, element, events, fn, originalFn) } for (i = types.length; i--;) { // add new handler to the registry and check if it's the first for this element/type first = registry.put(entry = new RegEntry( element , types[i].replace(nameRegex, '') // event type , fn , originalFn , str2arr(types[i].replace(namespaceRegex, ''), '.') // namespaces , args , false // not root )) if (entry[eventSupport] && first) { // first event of this type on this element, add root listener listener(element, entry.eventType, true, entry.customType) } } return element } /** * add(element[, selector], eventType(s), handler[, args ]) * * Deprecated: kept (for now) for backward-compatibility */ , add = function (element, events, fn, delfn) { return on.apply( null , !isString(fn) ? slice.call(arguments) : [ element, fn, events, delfn ].concat(arguments.length > 3 ? slice.call(arguments, 5) : []) ) } /** * one(element, eventType(s)[, selector], handler[, args ]) */ , one = function () { return on.apply(ONE, arguments) } /** * fire(element, eventType(s)[, args ]) * * The optional 'args' argument must be an array, if no 'args' argument is provided * then we can use the browser's DOM event system, otherwise we trigger handlers manually */ , fire = function (element, type, args) { var types = str2arr(type) , i, j, l, names, handlers for (i = types.length; i--;) { type = types[i].replace(nameRegex, '') if (names = types[i].replace(namespaceRegex, '')) names = str2arr(names, '.') if (!names && !args && element[eventSupport]) { fireListener(nativeEvents[type], type, element) } else { // non-native event, either because of a namespace, arguments or a non DOM element // iterate over all listeners and manually 'fire' handlers = registry.get(element, type, null, false) args = [false].concat(args) for (j = 0, l = handlers.length; j < l; j++) { if (handlers[j].inNamespaces(names)) { handlers[j].handler.apply(element, args) } } } } return element } /** * clone(dstElement, srcElement[, eventType ]) * * TODO: perhaps for consistency we should allow the same flexibility in type specifiers? */ , clone = function (element, from, type) { var handlers = registry.get(from, type, null, false) , l = handlers.length , i = 0 , args, beanDel for (; i < l; i++) { if (handlers[i].original) { args = [ element, handlers[i].type ] if (beanDel = handlers[i].handler.__beanDel) args.push(beanDel.selector) args.push(handlers[i].original) on.apply(null, args) } } return element } , bean = { 'on' : on , 'add' : add , 'one' : one , 'off' : off , 'remove' : off , 'clone' : clone , 'fire' : fire , 'Event' : Event , 'setSelectorEngine' : setSelectorEngine , 'noConflict' : function () { context[name] = old return this } } // for IE, clean up on unload to avoid leaks if (win.attachEvent) { var cleanup = function () { var i, entries = registry.entries() for (i in entries) { if (entries[i].type && entries[i].type !== 'unload') off(entries[i].element, entries[i].type) } win.detachEvent('onunload', cleanup) win.CollectGarbage && win.CollectGarbage() } win.attachEvent('onunload', cleanup) } // initialize selector engine to internal default (qSA or throw Error) setSelectorEngine(Ink.ss) return bean }); /** * Keep this declaration here and off Bean as it extends the Event * object and some properties are readonly in strict mode */ 'use strict'; /** * Instantiate browser native events array */ /** * @module Ink.Dom.Event_1 */ /** * @class Ink.Dom.Event */ var InkEvent = { KEY_BACKSPACE: 8, KEY_TAB: 9, KEY_RETURN: 13, KEY_ESC: 27, KEY_LEFT: 37, KEY_UP: 38, KEY_RIGHT: 39, KEY_DOWN: 40, KEY_DELETE: 46, KEY_HOME: 36, KEY_END: 35, KEY_PAGEUP: 33, KEY_PAGEDOWN: 34, KEY_INSERT: 45, /** * Returns a function which calls `func`, waiting at least `wait` * milliseconds between calls. This is useful for events such as `scroll` * or `resize`, which can be triggered too many times per second, slowing * down the browser with needless function calls. * * *note:* This does not delay the first function call to the function. * * @method throttle * @param {Function} func Function to call. Arguments and context are both passed. * @param {Number} [wait=0] Milliseconds to wait between calls. * * @example * * Suppose you are observing the `scroll` event, but your application is lagging because `scroll` is triggered too many times. * * // BEFORE * InkEvent.observe(window, 'scroll', function () { * ... * }); // When scrolling on mobile devices or on firefox's smooth scroll * // this is expensive because onscroll is called many times * * // AFTER * InkEvent.observe(window, 'scroll', InkEvent.throttle(function () { * ... * }, 100)); // The event handler is called only every 100ms. Problem solved. * * @example * var handler = InkEvent.throttle(function () { * ... * }, 100); * * InkEvent.observe(window, 'scroll', handler); * InkEvent.observe(window, 'resize', handler); * * // on resize, both the "scroll" and the "resize" events are triggered * // a LOT of times. This prevents both of them being called a lot of * // times when the window is being resized by a user. * **/ throttle: function (func, wait) { wait = wait || 0; var lastCall = 0; // Warning: This breaks on Jan 1st 1970 0:00 var timeout; var throttled = function () { var now = +new Date(); var timeDiff = now - lastCall; if (timeDiff >= wait) { lastCall = now; return func.apply(this, [].slice.call(arguments)); } else { var that = this; var args = [].slice.call(arguments); if (!timeout) { timeout = setTimeout(function () { timeout = null; return throttled.apply(that, args); }, wait - timeDiff); } } }; return throttled; }, /** * Returns the target of the event object * * @method element * @param {Object} ev event object * @return {Node} The target */ element: function(ev) { var node = ev.delegationTarget || ev.target || // IE stuff (ev.type === 'mouseout' && ev.fromElement) || (ev.type === 'mouseleave' && ev.fromElement) || (ev.type === 'mouseover' && ev.toElement) || (ev.type === 'mouseenter' && ev.toElement) || ev.srcElement || null; return node && (node.nodeType === 3 || node.nodeType === 4) ? node.parentNode : node; }, /** * Returns the related target of the event object * * @method relatedTarget * @param {Object} ev event object * @return {Node} The related target */ relatedTarget: function(ev){ var node = ev.relatedTarget || // IE stuff (ev.type === 'mouseout' && ev.toElement) || (ev.type === 'mouseleave' && ev.toElement) || (ev.type === 'mouseover' && ev.fromElement) || (ev.type === 'mouseenter' && ev.fromElement) || null; return node && (node.nodeType === 3 || node.nodeType === 4) ? node.parentNode : node; }, /** * Navigate up the DOM tree, looking for a tag with the name `elmTagName`. * * If such tag is not found, `document` is returned. * * @method findElement * @param {Object} ev event object * @param {String} elmTagName tag name to find * @param {Boolean} [force=false] If this is true, never return `document`, and returns `false` instead. * @return {DOMElement} the first element which matches given tag name or the document element if the wanted tag is not found */ findElement: function(ev, elmTagName, force) { var node = this.element(ev); while(true) { if(node.nodeName.toLowerCase() === elmTagName.toLowerCase()) { return node; } else { node = node.parentNode; if(!node) { if(force) { return false; } return document; } if(!node.parentNode){ if(force){ return false; } return document; } } } }, /** * Attaches an event to element * * @method observe * @param {DOMElement|String} element Element id or element * @param {String} eventName Event name * @param {Function} callBack Receives event object as a * parameter. If you're manually firing custom events, check the * eventName property of the event object to make sure you're handling * the right event. * @param {Boolean} [useCapture] Set to true to change event listening from bubbling to capture. * @return {Function} The event handler used. Hang on to this if you want to `stopObserving` later. */ observe: function(element, eventName, callBack, useCapture) { element = Ink.i(element); if(element) { if(element.addEventListener) { element.addEventListener(eventName, callBack, !!useCapture); } else { element.attachEvent('on' + eventName, (callBack = Ink.bind(callBack, element))); } return callBack; } }, /** * Like observe, but listen to the event only once. * * @method observeOnce * @param {DOMElement|String} element Element id or element * @param {String} eventName Event name * @param {Function} callBack Receives event object as a * parameter. If you're manually firing custom events, check the * eventName property of the event object to make sure you're handling * the right event. * @param {Boolean} [useCapture] Set to true to change event listening from bubbling to capture. * @return {Function} The event handler used. Hang on to this if you want to `stopObserving` later. */ observeOnce: function (element, eventName, callBack, useCapture) { var onceBack = function () { InkEvent.stopObserving(element, eventName, onceBack); return callBack(); }; return InkEvent.observe(element, eventName, onceBack, useCapture); }, /** * Attaches an event to a selector or array of elements. * * Requires Ink.Dom.Selector * * @method observeMulti * @param {Array|String} elements * @param ... See the `observe` function. * @return {Function} The used callback. */ observeMulti: function (elements, eventName, callBack, useCapture) { if (typeof elements === 'string') { elements = Ink.ss(elements); } else if ( /* is an element */ elements && elements.nodeType === 1) { elements = [elements]; } if (!elements[0]) { return false; } for (var i = 0, len = elements.length; i < len; i++) { this.observe(elements[i], eventName, callBack, useCapture); } return callBack; }, /** * Observe an event on the given element and every children which matches the selector string (if provided). * * Requires Ink.Dom.Selector if you need to use a selector. * * @method observeDelegated * @param {DOMElement|String} element Element to observe. * @param {String} eventName Event name to observe. * @param {String} selector Child element selector. When null, finds any element. * @param {Function} callback Callback to be called when the event is fired * @return {Function} The used callback, for ceasing to listen to the event later. **/ observeDelegated: function (element, eventName, selector, callback) { return InkEvent.observe(element, eventName, function (event) { var fromElement = InkEvent.element(event); if (!fromElement || fromElement === element) { return; } var cursor = fromElement; // Go up the document tree until we hit the element itself. while (cursor !== element && cursor !== document && cursor) { if (Ink.Dom.Selector_1.matchesSelector(cursor, selector)) { event.delegationTarget = cursor; return callback(event); } cursor = cursor.parentNode; } }); }, /** * Remove an event attached to an element * * @method stopObserving * @param {DOMElement|String} element element id or element * @param {String} eventName event name * @param {Function} callBack callback function * @param {Boolean} [useCapture] set to true if the event was being observed with useCapture set to true as well. */ stopObserving: function(element, eventName, callBack, useCapture) { element = Ink.i(element); if(element) { if(element.removeEventListener) { element.removeEventListener(eventName, callBack, !!useCapture); } else { element.detachEvent('on' + eventName, callBack); } } }, /** * Stops event propagation and bubbling * * @method stop * @param {Object} event event handle */ stop: function(event) { if(event.cancelBubble !== null) { event.cancelBubble = true; } if(event.stopPropagation) { event.stopPropagation(); } if(event.preventDefault) { event.preventDefault(); } if(window.attachEvent) { event.returnValue = false; } if(event.cancel !== null) { event.cancel = true; } }, /** * Stops event propagation * * @method stopPropagation * @param {Object} event event handle */ stopPropagation: function(event) { if(event.cancelBubble !== null) { event.cancelBubble = true; } if(event.stopPropagation) { event.stopPropagation(); } }, /** * Stops event default behaviour * * @method stopDefault * @param {Object} event event handle */ stopDefault: function(event) { if(event.preventDefault) { event.preventDefault(); } if(window.attachEvent) { event.returnValue = false; } if(event.cancel !== null) { event.cancel = true; } }, /** * @method pointer * @param {Object} ev event object * @return {Object} an object with the mouse X and Y position */ pointer: function(ev) { return { x: this.pointerX(ev), y: this.pointerY(ev) }; }, /** * @method pointerX * @param {Object} ev event object * @return {Number} mouse X position */ pointerX: function(ev) { return (ev.touches && ev.touches[0] && ev.touches[0].pageX) || (ev.pageX) || (ev.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)); }, /** * @method pointerY * @param {Object} ev event object * @return {Number} mouse Y position */ pointerY: function(ev) { return (ev.touches && ev.touches[0] && ev.touches[0].pageY) || (ev.pageY) || (ev.clientY + (document.documentElement.scrollTop || document.body.scrollTop)); }, /** * @method isLeftClick * @param {Object} ev event object * @return {Boolean} True if the event is a left mouse click */ isLeftClick: function(ev) { if (window.addEventListener) { if(ev.button === 0){ return true; } else if(ev.type === 'touchend' && ev.button === null){ // [todo] do the above check for pointerEvents too return true; } } else { if(ev.button === 1){ return true; } } return false; }, /** * @method isRightClick * @param {Object} ev event object * @return {Boolean} True if there is a right click on the event */ isRightClick: function(ev) { return (ev.button === 2); }, /** * @method isMiddleClick * @param {Object} ev event object * @return {Boolean} True if there is a middle click on the event */ isMiddleClick: function(ev) { if (window.addEventListener) { return (ev.button === 1); } else { return (ev.button === 4); } return false; }, /** * Work in Progress. * Used in SAPO.Component.MaskedInput * * @method getCharFromKeyboardEvent * @param {KeyboardEvent} event keyboard event * @param {optional Boolean} [changeCasing] if true uppercases, if false lowercases, otherwise keeps casing * @return {String} character representation of pressed key combination */ getCharFromKeyboardEvent: function(event, changeCasing) { var k = event.keyCode; var c = String.fromCharCode(k); var shiftOn = event.shiftKey; if (k >= 65 && k <= 90) { // A-Z if (typeof changeCasing === 'boolean') { shiftOn = changeCasing; } return (shiftOn) ? c : c.toLowerCase(); } else if (k >= 96 && k <= 105) { // numpad digits return String.fromCharCode( 48 + (k-96) ); } switch (k) { case 109: case 189: return '-'; case 107: case 187: return '+'; } return c; }, debug: function(){} }; /** * bean.on() lets you attach event listeners to both elements and objects. * http://github.com/fat/bean#on * * @method on * @param {DOMElement|Object} element An HTML DOM element or any JavaScript Object * @param {String} eventType An Event (or multiple events, space separated) to listen to * @param {String} [selector] A CSS DOM Element selector string to bind the listener to child elements matching the selector * @param {Function} [handler] The callback function * @param {Object} [args...] Additional arguments to pass to the callback function when triggered * * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object */ /** * bean.one() is an alias for bean.on() except that the handler will only be executed once and then removed for the event type(s). * http://github.com/fat/bean#one * * @method one * @param {DOMElement|Object} element An HTML DOM element or any JavaScript Object * @param {String} eventType An Event (or multiple events, space separated) to listen to * @param {String} [selector] A CSS DOM Element selector string to bind the listener to child elements matching the selector * @param {Function} [handler] The callback function * @param [args...] Additional arguments to pass to the callback function when triggered * * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object */ /** * bean.off() is how you get rid of handlers once you no longer want them active. It's also a good idea to call off on elements before you remove them from your DOM; this gives Bean a chance to clean up some things and prevents memory leaks. * http://github.com/fat/bean#off * * @method off * @param {DOMElement|Object} element An HTML DOM element or any JavaScript Object * @param {String} eventType An Event (or multiple events, space separated) to remove * @param {Function} [handler] The specific callback function to remove * * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object */ /** * bean.clone() is a method for cloning events from one DOM element or object to another. * http://github.com/fat/bean#clone * * @method clone * @param {DOMElement|Object} destElement An HTML DOM element or any JavaScript Object to copy events to * @param {String} srcElement An HTML DOM element or any JavaScript Object to copy events from * @param {String} [eventType] An Event (or multiple events, space separated) to clone * * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object */ /** * bean.fire() gives you the ability to trigger events. * http://github.com/fat/bean#fire * * @method fire * @param {DOMElement|Object} destElement An HTML DOM element or any JavaScript Object fire the event on * @param {String} eventType An Event (or multiple events, space separated) to fire * @param [args...] Additional arguments to pass to the callback function when triggered * * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object */ return Ink.extendObj(InkEvent, bean); }); /** * @module Ink.Dom.FormSerialize * @author inkdev AT sapo.pt */ Ink.createModule('Ink.Dom.FormSerialize', 1, [], function () { 'use strict'; /** * Supports serialization of form data to/from javascript Objects. * * Valid applications are ad hoc AJAX/syndicated submission of forms, restoring form values from server side state, etc. * * @class Ink.Dom.FormSerialize * */ var FormSerialize = { /** * Serializes a form into an object, turning field names into keys, and field values into values. * * note: Multi-select and checkboxes with multiple values will yield arrays * * @method serialize * @return {Object} map of fieldName -> String|String[]|Boolean * @param {DomElement|String} form form element from which the extraction is to occur * * @example * <form id="frm"> * <input type="text" name="field1"> * <button type="submit">Submit</button> * </form> * <script type="text/javascript"> * Ink.requireModules(['Ink.Dom.FormSerialize_1', 'Ink.Dom.Event_1'], function (FormSerialize, InkEvent) { * InkEvent.observe('frm', 'submit', function (event) { * var formData = FormSerialize.serialize('frm'); // -> {field1:"123"} * InkEvent.stop(event); * }); * }); * </script> */ serialize: function(form) { form = Ink.i(form); var map = this._getFieldNameInputsMap(form); var map2 = {}; for (var k in map) if (map.hasOwnProperty(k)) { if(k !== null) { var tmpK = k.replace(/\[\]$/, ''); map2[tmpK] = this._getValuesOfField( map[k] ); } else { map2[k] = this._getValuesOfField( map[k] ); } } delete map2['null']; // this can occur. if so, delete it... return map2; }, /** * Sets form elements's values with values given from object * * One cannot restore the values of an input with `type="file"` (browser prohibits it) * * @method fillIn * @param {DomElement|String} form form element which is to be populated * @param {Object} map2 map of fieldName -> String|String[]|Boolean * @example * <form id="frm"> * <input type="text" name="field1"> * <button type="submit">Submit</button> * </form> * <script type="text/javascript"> * Ink.requireModules(['Ink.Dom.FormSerialize_1'], function (FormSerialize) { * var values = {field1: 'CTHULHU'}; * FormSerialize.fillIn('frm', values); * // At this point the form is pre-filled with the values above. * }); * </script> */ fillIn: function(form, map2) { form = Ink.i(form); var map = this._getFieldNameInputsMap(form); delete map['null']; // this can occur. if so, delete it... for (var k in map2) if (map2.hasOwnProperty(k)) { this._setValuesOfField( map[k], map2[k] ); } }, _getFieldNameInputsMap: function(formEl) { var name, nodeName, el, map = {}; for (var i = 0, f = formEl.elements.length; i < f; ++i) { el = formEl.elements[i]; name = el.getAttribute('name'); nodeName = el.nodeName.toLowerCase(); if (nodeName === 'fieldset') { continue; } else if (map[name] === undefined) { map[name] = [el]; } else { map[name].push(el); } } return map; }, _getValuesOfField: function(fieldInputs) { var nodeName = fieldInputs[0].nodeName.toLowerCase(); var type = fieldInputs[0].getAttribute('type'); var value = fieldInputs[0].value; var i, f, j, o, el, m, res = []; switch(nodeName) { case 'select': for (i = 0, f = fieldInputs.length; i < f; ++i) { res[i] = []; m = fieldInputs[i].getAttribute('multiple'); for (j = 0, o = fieldInputs[i].options.length; j < o; ++j) { el = fieldInputs[i].options[j]; if (el.selected) { if (m) { res[i].push(el.value); } else { res[i] = el.value; break; } } } } return ((fieldInputs.length > 0 && /\[[^\]]*\]$/.test(fieldInputs[0].getAttribute('name'))) ? res : res[0]); case 'textarea': case 'input': if (type === 'checkbox' || type === 'radio') { for (i = 0, f = fieldInputs.length; i < f; ++i) { el = fieldInputs[i]; if (el.checked) { res.push( el.value ); } } if (type === 'checkbox') { return (fieldInputs.length > 1) ? res : !!(res.length); } return (fieldInputs.length > 1) ? res[0] : !!(res.length); // on radios only 1 option is selected at most } else { //if (fieldInputs.length > 1) { throw 'Got multiple input elements with same name!'; } if(fieldInputs.length > 0 && /\[[^\]]*\]$/.test(fieldInputs[0].getAttribute('name'))) { var tmpValues = []; for(i=0, f = fieldInputs.length; i < f; ++i) { tmpValues.push(fieldInputs[i].value); } return tmpValues; } else { return value; } } break; // to keep JSHint happy... (reply to this comment by gamboa: - ROTFL) default: //throw 'Unsupported element: "' + nodeName + '"!'; return undefined; } }, _valInArray: function(val, arr) { for (var i = 0, f = arr.length; i < f; ++i) { if (arr[i] === val) { return true; } } return false; }, _setValuesOfField: function(fieldInputs, fieldValues) { if (!fieldInputs) { return; } var nodeName = fieldInputs[0].nodeName.toLowerCase(); var type = fieldInputs[0].getAttribute('type'); var i, f, el; switch(nodeName) { case 'select': if (fieldInputs.length > 1) { throw 'Got multiple select elements with same name!'; } for (i = 0, f = fieldInputs[0].options.length; i < f; ++i) { el = fieldInputs[0].options[i]; el.selected = (fieldValues instanceof Array) ? this._valInArray(el.value, fieldValues) : el.value === fieldValues; } break; case 'textarea': case 'input': if (type === 'checkbox' || type === 'radio') { for (i = 0, f = fieldInputs.length; i < f; ++i) { el = fieldInputs[i]; //el.checked = (fieldValues instanceof Array) ? this._valInArray(el.value, fieldValues) : el.value === fieldValues; el.checked = (fieldValues instanceof Array) ? this._valInArray(el.value, fieldValues) : (fieldInputs.length > 1 ? el.value === fieldValues : !!fieldValues); } } else { if (fieldInputs.length > 1) { throw 'Got multiple input elements with same name!'; } if (type !== 'file') { fieldInputs[0].value = fieldValues; } } break; default: throw 'Unsupported element: "' + nodeName + '"!'; } } }; return FormSerialize; }); /** * @module Ink.Dom.Loaded_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.Dom.Loaded', 1, [], function() { 'use strict'; /** * The Loaded class provides a method that allows developers to queue functions to run when * the page is loaded (document is ready). * * @class Ink.Dom.Loaded * @version 1 * @static */ var Loaded = { /** * Callbacks and their contexts. Array of 2-arrays. * * [] * * @attribute _contexts Array * @private * */ _contexts: [], // Callbacks' queue /** * Adds a new function that will be invoked once the document is ready * * @method run * @param {Object} [win=window] Window object to attach/add the event * @param {Function} fn Callback function to be run after the page is loaded * @public * @example * Ink.requireModules(['Ink.Dom.Loaded_1'], function(Loaded){ * Loaded.run(function(){ * console.log('This will run when the page/document is ready/loaded'); * }); * }); */ run: function(win, fn) { if (!fn) { fn = win; win = window; } var context; for (var i = 0, len = this._contexts.length; i < len; i++) { if (this._contexts[i][0] === win) { context = this._contexts[i][1]; break; } } if (!context) { context = { cbQueue: [], win: win, doc: win.document, root: win.document.documentElement, done: false, top: true }; context.handlers = { checkState: Ink.bindEvent(this._checkState, this, context), poll: Ink.bind(this._poll, this, context) }; this._contexts.push( [win, context] // Javascript Objects cannot map different windows to // different values. ); } var ael = context.doc.addEventListener; context.add = ael ? 'addEventListener' : 'attachEvent'; context.rem = ael ? 'removeEventListener' : 'detachEvent'; context.pre = ael ? '' : 'on'; context.det = ael ? 'DOMContentLoaded' : 'onreadystatechange'; context.wet = context.pre + 'load'; var csf = context.handlers.checkState; var alreadyLoaded = ( context.doc.readyState === 'complete' && context.win.location.toString() !== 'about:blank'); // https://code.google.com/p/chromium/issues/detail?id=32357 if (alreadyLoaded){ setTimeout(Ink.bind(function () { fn.call(context.win, 'lazy'); }, this), 0); } else { context.cbQueue.push(fn); context.doc[context.add]( context.det , csf ); context.win[context.add]( context.wet , csf ); var frameElement = 1; try{ frameElement = context.win.frameElement; } catch(e) {} if ( !ael && context.root && context.root.doScroll ) { // IE HACK try { context.top = !frameElement; } catch(e) { } if (context.top) { this._poll(context); } } } }, /** * Function that will be running the callbacks after the page is loaded * * @method _checkState * @param {Event} event Triggered event * @private */ _checkState: function(event, context) { if ( !event || (event.type === 'readystatechange' && context.doc.readyState !== 'complete')) { return; } var where = (event.type === 'load') ? context.win : context.doc; where[context.rem](context.pre+event.type, context.handlers.checkState, false); this._ready(context); }, /** * Polls the load progress of the page to see if it has already loaded or not * * @method _poll * @private */ /** * * function _poll */ _poll: function(context) { try { context.root.doScroll('left'); } catch(e) { return setTimeout(context.handlers.poll, 50); } this._ready(context); }, /** * Function that runs the callbacks from the queue when the document is ready. * * @method _ready * @private */ _ready: function(context) { if (!context.done) { context.done = true; for (var i = 0; i < context.cbQueue.length; ++i) { context.cbQueue[i].call(context.win); } context.cbQueue = []; } } }; return Loaded; }); /** * @module Ink.Dom.Selector_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.Dom.Selector', 1, [], function() { /*jshint forin:false, eqnull:true, noempty:false, expr:true, boss:true, maxdepth:false*/ 'use strict'; /** * @class Ink.Dom.Selector * @static * @version 1 */ /*! * Sizzle CSS Selector Engine * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license * http://sizzlejs.com/ */ var i, cachedruns, Expr, getText, isXML, compile, outermostContext, recompare, sortInput, // Local document vars setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, // Instance-specific data expando = "sizzle" + -(new Date()), preferredDoc = window.document, support = {}, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), hasDuplicate = false, sortOrder = function() { return 0; }, // General-purpose constants strundefined = typeof undefined, MAX_NEGATIVE = 1 << 31, // Array methods arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, // Use a stripped-down indexOf if we can't use a native one indexOf = arr.indexOf || function( elem ) { var i = 0, len = this.length; for ( ; i < len; i++ ) { if ( this[i] === elem ) { return i; } } return -1; }, // Regular expressions // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/css3-syntax/#characters characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", // Loosely modeled on CSS identifier characters // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace( "w", "w#" ), // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors operators = "([*^$|!~]?=)", attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", // Prefer arguments quoted, // then not containing pseudos/brackets, // then attribute selectors/non-parenthetical expressions, // then anything else // These preferences are here to reduce the number of selectors // needing tokenize in the PSEUDO preFilter pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { "ID": new RegExp( "^#(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), // For use in libraries implementing .is() // We use this for POS matching in `select` "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, rsibling = /[\x20\t\r\n\f]*[+~]/, rnative = /^[^{]+\{\s*\[native code/, // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rescape = /'|\\/g, rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, funescape = function( _, escaped ) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint return high !== high ? escaped : // BMP codepoint high < 0 ? String.fromCharCode( high + 0x10000 ) : // Supplemental Plane codepoint (surrogate pair) String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }; // Optimize for push.apply( _, NodeList ) try { push.apply( (arr = slice.call( preferredDoc.childNodes )), preferredDoc.childNodes ); // Support: Android<4.0 // Detect silently failing push.apply arr[ preferredDoc.childNodes.length ].nodeType; } catch ( e ) { push = { apply: arr.length ? // Leverage slice if possible function( target, els ) { push_native.apply( target, slice.call(els) ); } : // Support: IE<9 // Otherwise append directly function( target, els ) { var j = target.length, i = 0; // Can't trust NodeList.length while ( (target[j++] = els[i++]) ) {} target.length = j - 1; } }; } /* * For feature detection * @param {Function} fn The function to test for native support */ function isNative( fn ) { return rnative.test( fn + "" ); } /* * Create key-value caches of limited size * @returns {Function(string, Object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry */ function createCache() { var cache, keys = []; return (cache = function( key, value ) { // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) if ( keys.push( key += " " ) > Expr.cacheLength ) { // Only keep the most recent entries delete cache[ keys.shift() ]; } return (cache[ key ] = value); }); } /* * Mark a function for special use by Sizzle * @param {Function} fn The function to mark */ function markFunction( fn ) { fn[ expando ] = true; return fn; } /* * Support testing using an element * @param {Function} fn Passed the created div and expects a boolean result */ function assert( fn ) { var div = document.createElement("div"); try { return !!fn( div ); } catch (e) { return false; } finally { // release memory in IE div = null; } } function Sizzle( selector, context, results, seed ) { var match, elem, m, nodeType, // QSA vars i, groups, old, nid, newContext, newSelector; if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { setDocument( context ); } context = context || document; results = results || []; if ( !selector || typeof selector !== "string" ) { return results; } if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { return []; } if ( documentIsHTML && !seed ) { // Shortcuts if ( (match = rquickExpr.exec( selector )) ) { // Speed-up: Sizzle("#ID") if ( (m = match[1]) ) { if ( nodeType === 9 ) { elem = context.getElementById( m ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE, Opera, and Webkit return items // by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } } else { // Context is not a document if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Speed-up: Sizzle("TAG") } else if ( match[2] ) { push.apply( results, context.getElementsByTagName( selector ) ); return results; // Speed-up: Sizzle(".CLASS") } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } } // QSA path if ( support.qsa && !rbuggyQSA.test(selector) ) { old = true; nid = expando; newContext = context; newSelector = nodeType === 9 && selector; // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { groups = tokenize( selector ); if ( (old = context.getAttribute("id")) ) { nid = old.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", nid ); } nid = "[id='" + nid + "'] "; i = groups.length; while ( i-- ) { groups[i] = nid + toSelector( groups[i] ); } newContext = rsibling.test( selector ) && context.parentNode || context; newSelector = groups.join(","); } if ( newSelector ) { try { push.apply( results, newContext.querySelectorAll( newSelector ) ); return results; } catch(qsaError) { } finally { if ( !old ) { context.removeAttribute("id"); } } } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed ); } /* * Detect xml * @param {Element|Object} elem An element or a document */ isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; /* * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { var doc = node ? node.ownerDocument || node : preferredDoc; // If no document and documentElement is available, return if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { return document; } // Set our document document = doc; docElem = doc.documentElement; // Support tests documentIsHTML = !isXML( doc ); // Check if getElementsByTagName("*") returns only elements support.getElementsByTagName = assert(function( div ) { div.appendChild( doc.createComment("") ); return !div.getElementsByTagName("*").length; }); // Check if attributes should be retrieved by attribute nodes support.attributes = assert(function( div ) { div.innerHTML = "<select></select>"; var type = typeof div.lastChild.getAttribute("multiple"); // IE8 returns a string for some attributes even when not present return type !== "boolean" && type !== "string"; }); // Check if getElementsByClassName can be trusted support.getElementsByClassName = assert(function( div ) { // Opera can't find a second classname (in 9.6) div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { return false; } // Safari 3.2 caches class attributes and doesn't catch changes div.lastChild.className = "e"; return div.getElementsByClassName("e").length === 2; }); // Check if getElementsByName privileges form controls or returns elements by ID // If so, assume (for broader support) that getElementById returns elements by name support.getByName = assert(function( div ) { // Inject content div.id = expando + 0; // Support: Windows 8 Native Apps // Assigning innerHTML with "name" attributes throws uncatchable exceptions // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx div.appendChild( document.createElement("a") ).setAttribute( "name", expando ); div.appendChild( document.createElement("i") ).setAttribute( "name", expando ); docElem.appendChild( div ); // Test var pass = doc.getElementsByName && // buggy browsers will return fewer than the correct 2 doc.getElementsByName( expando ).length === 2 + // buggy browsers will return more than the correct 0 doc.getElementsByName( expando + 0 ).length; // Cleanup docElem.removeChild( div ); return pass; }); // Support: Webkit<537.32 // Detached nodes confoundingly follow *each other* support.sortDetached = assert(function( div1 ) { return div1.compareDocumentPosition && // Should return 1, but Webkit returns 4 (following) (div1.compareDocumentPosition( document.createElement("div") ) & 1); }); // IE6/7 return modified attributes Expr.attrHandle = assert(function( div ) { div.innerHTML = "<a href='#'></a>"; return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && div.firstChild.getAttribute("href") === "#"; }) ? {} : { "href": function( elem ) { return elem.getAttribute( "href", 2 ); }, "type": function( elem ) { return elem.getAttribute("type"); } }; // ID find and filter if ( support.getByName ) { Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== strundefined && documentIsHTML ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [m] : []; } }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; } else { Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== strundefined && documentIsHTML ) { var m = context.getElementById( id ); return m ? m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? [m] : undefined : []; } }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); return node && node.value === attrId; }; }; } // Tag Expr.find["TAG"] = support.getElementsByTagName ? function( tag, context ) { if ( typeof context.getElementsByTagName !== strundefined ) { return context.getElementsByTagName( tag ); } } : function( tag, context ) { var elem, tmp = [], i = 0, results = context.getElementsByTagName( tag ); // Filter out possible comments if ( tag === "*" ) { while ( (elem = results[i++]) ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }; // Name Expr.find["NAME"] = support.getByName && function( tag, context ) { if ( typeof context.getElementsByName !== strundefined ) { return context.getElementsByName( name ); } }; // Class Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { return context.getElementsByClassName( className ); } }; // QSA and matchesSelector support // matchesSelector(:active) reports false when true (IE9/Opera 11.5) rbuggyMatches = []; // qSa(:focus) reports false when true (Chrome 21), // no need to also add to buggyMatches since matches checks buggyQSA // A support test would require too much code (would include document ready) rbuggyQSA = [ ":focus" ]; if ( (support.qsa = isNative(doc.querySelectorAll)) ) { // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explicitly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 div.innerHTML = "<select><option selected=''></option></select>"; // IE8 - Some boolean attributes are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } }); assert(function( div ) { // Opera 10-12/IE8 - ^= $= *= and empty values // Should not select anything div.innerHTML = "<input type='hidden' i=''/>"; if ( div.querySelectorAll("[i^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Opera 10-11 does not throw on post-comma invalid pseudos div.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector || docElem.mozMatchesSelector || docElem.webkitMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) support.disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead matches.call( div, "[s!='']:x" ); rbuggyMatches.push( "!=", pseudos ); }); } rbuggyQSA = new RegExp( rbuggyQSA.join("|") ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); // Element contains another // Purposefully does not implement inclusive descendent // As in, an element does not contain itself contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && ( adown.contains ? adown.contains( bup ) : a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } } return false; }; // Document order sorting sortOrder = docElem.compareDocumentPosition ? function( a, b ) { // Flag for duplicate removal if ( a === b ) { hasDuplicate = true; return 0; } var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b ); if ( compare ) { // Disconnected nodes if ( compare & 1 || (recompare && b.compareDocumentPosition( a ) === compare) ) { // Choose the first element that is related to our preferred document if ( a === doc || contains(preferredDoc, a) ) { return -1; } if ( b === doc || contains(preferredDoc, b) ) { return 1; } // Maintain original order return sortInput ? ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 0; } return compare & 4 ? -1 : 1; } // Not directly comparable, sort on existence of method return a.compareDocumentPosition ? -1 : 1; } : function( a, b ) { var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [ a ], bp = [ b ]; // Exit early if the nodes are identical if ( a === b ) { hasDuplicate = true; return 0; // Parentless nodes are either documents or disconnected } else if ( !aup || !bup ) { return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : 0; // If the nodes are siblings, we can do a quick check } else if ( aup === bup ) { return siblingCheck( a, b ); } // Otherwise we need full lists of their ancestors for comparison cur = a; while ( (cur = cur.parentNode) ) { ap.unshift( cur ); } cur = b; while ( (cur = cur.parentNode) ) { bp.unshift( cur ); } // Walk down the tree looking for a discrepancy while ( ap[i] === bp[i] ) { i++; } return i ? // Do a sibling check if the nodes have a common ancestor siblingCheck( ap[i], bp[i] ) : // Otherwise nodes in our document sort first ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; }; return document; }; Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); // rbuggyQSA always contains :focus, so no need for an existence check if ( support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch(e) {} } return Sizzle( expr, document, null, [elem] ).length > 0; }; Sizzle.contains = function( context, elem ) { // Set document vars if needed if ( ( context.ownerDocument || context ) !== document ) { setDocument( context ); } return contains( context, elem ); }; Sizzle.attr = function( elem, name ) { var val; // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } if ( documentIsHTML ) { name = name.toLowerCase(); } if ( (val = Expr.attrHandle[ name ]) ) { return val( elem ); } if ( !documentIsHTML || support.attributes ) { return elem.getAttribute( name ); } return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ? name : val && val.specified ? val.value : null; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; // Document sorting and removing duplicates Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], j = 0, i = 0; // Unless we *know* we can detect duplicates, assume their presence hasDuplicate = !support.detectDuplicates; // Compensate for sort limitations recompare = !support.sortDetached; sortInput = !support.sortStable && results.slice( 0 ); results.sort( sortOrder ); if ( hasDuplicate ) { while ( (elem = results[i++]) ) { if ( elem === results[ i ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } return results; }; /* * Checks document order of two siblings * @param {Element} a * @param {Element} b * @returns Returns -1 if a precedes b, 1 if a follows b */ function siblingCheck( a, b ) { var cur = b && a, diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); // Use IE sourceIndex if available on both nodes if ( diff ) { return diff; } // Check if b follows a if ( cur ) { while ( (cur = cur.nextSibling) ) { if ( cur === b ) { return -1; } } } return a ? 1 : -1; } // Returns a function to use in pseudos for input types function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } // Returns a function to use in pseudos for buttons function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } // Returns a function to use in pseudos for positionals function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /* * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( !nodeType ) { // If no nodeType, this is expected to be an array for ( ; (node = elem[i]); i++ ) { // Do not traverse comment nodes ret += getText( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (see #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes return ret; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, find: {}, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 what (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4 xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component 6 x of xn-component 7 sign of y-component 8 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1].slice( 0, 3 ) === "nth" ) { // nth-* requires argument if ( !match[3] ) { Sizzle.error( match[0] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); // other types prohibit arguments } else if ( match[3] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var excess, unquoted = !match[5] && match[2]; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } // Accept quoted arguments as-is if ( match[4] ) { match[2] = match[4]; // Strip excess characters from unquoted arguments } else if ( unquoted && rpseudo.test( unquoted ) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index match[0] = match[0].slice( 0, excess ); match[2] = unquoted.slice( 0, excess ); } // Return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "TAG": function( nodeName ) { if ( nodeName === "*" ) { return function() { return true; }; } nodeName = nodeName.replace( runescape, funescape ).toLowerCase(); return function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); }); }, "ATTR": function( name, operator, check ) { return function( elem ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.slice( -check.length ) === check : operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, what, argument, first, last ) { var simple = type.slice( 0, 3 ) !== "nth", forward = type.slice( -4 ) !== "last", ofType = what === "of-type"; return first === 1 && last === 0 ? // Shortcut for :nth-*(n) function( elem ) { return !!elem.parentNode; } : function( elem, context, xml ) { var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType; if ( parent ) { // :(first|last|only)-(child|of-type) if ( simple ) { while ( dir ) { node = elem; while ( (node = node[ dir ]) ) { if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { return false; } } // Reverse direction for :only-* (if we haven't yet done so) start = dir = type === "only" && !start && "nextSibling"; } return true; } start = [ forward ? parent.firstChild : parent.lastChild ]; // non-xml :nth-child(...) stores cache data on `parent` if ( forward && useCache ) { // Seek `elem` from a previously-cached index outerCache = parent[ expando ] || (parent[ expando ] = {}); cache = outerCache[ type ] || []; nodeIndex = cache[0] === dirruns && cache[1]; diff = cache[0] === dirruns && cache[2]; node = nodeIndex && parent.childNodes[ nodeIndex ]; while ( (node = ++nodeIndex && node && node[ dir ] || // Fallback to seeking `elem` from the start (diff = nodeIndex = 0) || start.pop()) ) { // When found, cache indexes on `parent` and break if ( node.nodeType === 1 && ++diff && node === elem ) { outerCache[ type ] = [ dirruns, nodeIndex, diff ]; break; } } // Use previously-cached element index if available } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { diff = cache[1]; // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) } else { // Use the same loop as above to seek `elem` from the start while ( (node = ++nodeIndex && node && node[ dir ] || (diff = nodeIndex = 0) || start.pop()) ) { if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { // Cache the index of each encountered element if ( useCache ) { (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; } if ( node === elem ) { break; } } } } // Incorporate the offset, then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); } }; }, "PSEUDO": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if ( fn[ expando ] ) { return fn( argument ); } // But maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf.call( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { // Potentially complex pseudos "not": markFunction(function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // Match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), // "Whether an element is represented by a :lang() selector // is based solely on the element's language value // being equal to the identifier C, // or beginning with the identifier C immediately followed by "-". // The matching of C against the element's language value is performed case-insensitively. // The identifier C does not have to be a valid language name." // http://www.w3.org/TR/selectors/#lang-pseudo "lang": markFunction( function( lang ) { // lang value must be a valid identifier if ( !ridentifier.test(lang || "") ) { Sizzle.error( "unsupported lang: " + lang ); } lang = lang.replace( runescape, funescape ).toLowerCase(); return function( elem ) { var elemLang; do { if ( (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { elemLang = elemLang.toLowerCase(); return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; } } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); return false; }; }), // Miscellaneous "target": function( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, "root": function( elem ) { return elem === docElem; }, "focus": function( elem ) { return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, // Boolean properties "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, // Contents "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), // not comment, processing instructions, or others // Thanks to Diego Perini for the nodeName shortcut // Greater than "@" means alpha characters (specifically not starting with "#" or "?") for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { return false; } } return true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, // Element/input types "header": function( elem ) { return rheader.test( elem.nodeName ); }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function( elem ) { var attr; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); }, // Position-in-collection "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; // Add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { Expr.pseudos[ i ] = createInputPseudo( i ); } for ( i in { submit: true, reset: true } ) { Expr.pseudos[ i ] = createButtonPseudo( i ); } function tokenize( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } groups.push( tokens = [] ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { matched = match.shift(); tokens.push( { value: matched, // Cast descendant combinators to space type: match[0].replace( rtrim, " " ) } ); soFar = soFar.slice( matched.length ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { matched = match.shift(); tokens.push( { value: matched, type: type, matches: match } ); soFar = soFar.slice( matched.length ); } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); } function toSelector( tokens ) { var i = 0, len = tokens.length, selector = ""; for ( ; i < len; i++ ) { selector += tokens[i].value; } return selector; } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { return matcher( elem, context, xml ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { var data, cache, outerCache, dirkey = dirruns + " " + doneName; // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching if ( xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { if ( matcher( elem, context, xml ) ) { return true; } } } } else { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || (elem[ expando ] = {}); if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { if ( (data = cache[1]) === true || data === cachedruns ) { return data === true; } } else { cache = outerCache[ dir ] = [ dirkey ]; cache[1] = matcher( elem, context, xml ) || cachedruns; if ( cache[1] === true ) { return true; } } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { // Restore matcherIn since elem is not yet a final match temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf.call( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && toSelector( tokens ) ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { // A counter to specify which element is currently being matched var matcherCachedRuns = 0, bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, expandContext ) { var elem, j, matcher, setMatched = [], matchedCount = 0, i = "0", unmatched = seed && [], outermost = expandContext != null, contextBackup = outermostContext, // We must always have either seed elements or context elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); if ( outermost ) { outermostContext = context !== document && context; cachedruns = matcherCachedRuns; } // Add elements passing elementMatchers directly to results // Keep `i` a string if there are no elements so `matchedCount` will be "00" below for ( ; (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; cachedruns = ++matcherCachedRuns; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // Apply set filters to unmatched elements matchedCount += i; if ( bySet && i !== matchedCount ) { j = 0; while ( (matcher = setMatchers[j++]) ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ selector + " " ]; if ( !cached ) { // Generate a function of recursive functions that can be used to check each element if ( !group ) { group = tokenize( selector ); } i = group.length; while ( i-- ) { cached = matcherFromTokens( group[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); } return cached; }; function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; } function select( selector, context, results, seed ) { var i, tokens, token, type, find, match = tokenize( selector ); if ( !seed ) { // Try to minimize operations if there is only one group if ( match.length === 1 ) { // Take a shortcut and set the context if the root selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; if ( !context ) { return results; } selector = selector.slice( tokens.shift().value.length ); } // Fetch a seed set for right-to-left matching i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; while ( i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( runescape, funescape ), rsibling.test( tokens[0].type ) && context.parentNode || context )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && toSelector( tokens ); if ( !selector ) { push.apply( results, seed ); return results; } break; } } } } } // Compile and execute a filtering function // Provide `match` to avoid retokenization if we modified the selector above compile( selector, match )( seed, context, !documentIsHTML, results, rsibling.test( selector ) ); return results; } // Deprecated Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Easy API for creating new setFilters function setFilters() {} setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); // Check sort stability support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; // Initialize with the default document setDocument(); // Always assume the presence of duplicates if sort doesn't // pass them to our comparison function (as in Google Chrome). [0, 0].sort( sortOrder ); support.detectDuplicates = hasDuplicate; // EXPOSE /*if ( typeof define === "function" && define.amd ) { define(function() { return Sizzle; }); } else { window.Sizzle = Sizzle; }*/ // EXPOSE /** * Alias for the Sizzle selector engine * * @method select * @param {String} selector CSS selector to search for elements * @param {DOMElement} [context] By default the search is done in the document element. However, you can specify an element as search context * @param {Array} [results] By default this is considered an empty array. But if you want to merge it with other searches you did, pass their result array through here. * @param {Object} [seed] * @return {Array} Array of resulting DOM Elements */ /** * Returns elements which match with the second argument to the function. * * @method matches * @param {String} selector CSS selector to search for elements * @param {Array} matches Elements to be 'matched' with * @return {Array} Elements that matched */ /** * Returns true iif element matches given selector * * @method matchesSelector * @param {DOMElement} element to test * @param {String} selector CSS selector to test the element with * @return {Boolean} true iif element matches the CSS selector */ return { select: Sizzle, matches: Sizzle.matches, matchesSelector: Sizzle.matchesSelector }; }); //( window ); /** * @module Ink.Util.Array_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.Util.Array', '1', [], function() { 'use strict'; var arrayProto = Array.prototype; /** * Utility functions to use with Arrays * * @class Ink.Util.Array * @version 1 * @static */ var InkArray = { /** * Checks if value exists in array * * @method inArray * @param {Mixed} value * @param {Array} arr * @return {Boolean} True if value exists in the array * @public * @static * @example * Ink.requireModules(['Ink.Util.Array_1'], function( InkArray ){ * var testArray = [ 'value1', 'value2', 'value3' ]; * if( InkArray.inArray( 'value2', testArray ) === true ){ * console.log( "Yep it's in the array." ); * } else { * console.log( "No it's NOT in the array." ); * } * }); */ inArray: function(value, arr) { if (typeof arr === 'object') { for (var i = 0, f = arr.length; i < f; ++i) { if (arr[i] === value) { return true; } } } return false; }, /** * Sorts an array of object by an object property * * @method sortMulti * @param {Array} arr array of objects to sort * @param {String} key property to sort by * @return {Array|Boolean} False if it's not an array, returns a sorted array if it's an array. * @public * @static * @example * Ink.requireModules(['Ink.Util.Array_1'], function( InkArray ){ * var testArray = [ * { 'myKey': 'value1' }, * { 'myKey': 'value2' }, * { 'myKey': 'value3' } * ]; * * InkArray.sortMulti( testArray, 'myKey' ); * }); */ sortMulti: function(arr, key) { if (typeof arr === 'undefined' || arr.constructor !== Array) { return false; } if (typeof key !== 'string') { return arr.sort(); } if (arr.length > 0) { if (typeof(arr[0][key]) === 'undefined') { return false; } arr.sort(function(a, b){ var x = a[key]; var y = b[key]; return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }); } return arr; }, /** * Returns the associated key of an array value * * @method keyValue * @param {String} value Value to search for * @param {Array} arr Array where the search will run * @param {Boolean} [first] Flag that determines if the search stops at first occurrence. It also returns an index number instead of an array of indexes. * @return {Boolean|Number|Array} False if not exists | number if exists and 3rd input param is true | array if exists and 3rd input param is not set or it is !== true * @public * @static * @example * Ink.requireModules(['Ink.Util.Array_1'], function( InkArray ){ * var testArray = [ 'value1', 'value2', 'value3', 'value2' ]; * console.log( InkArray.keyValue( 'value2', testArray, true ) ); // Result: 1 * console.log( InkArray.keyValue( 'value2', testArray ) ); // Result: [1, 3] * }); */ keyValue: function(value, arr, first) { if (typeof value !== 'undefined' && typeof arr === 'object' && this.inArray(value, arr)) { var aKeys = []; for (var i = 0, f = arr.length; i < f; ++i) { if (arr[i] === value) { if (typeof first !== 'undefined' && first === true) { return i; } else { aKeys.push(i); } } } return aKeys; } return false; }, /** * Returns the array shuffled, false if the param is not an array * * @method shuffle * @param {Array} arr Array to shuffle * @return {Boolean|Number|Array} False if not an array | Array shuffled * @public * @static * @example * Ink.requireModules(['Ink.Util.Array_1'], function( InkArray ){ * var testArray = [ 'value1', 'value2', 'value3', 'value2' ]; * console.log( InkArray.shuffle( testArray ) ); // Result example: [ 'value3', 'value2', 'value2', 'value1' ] * }); */ shuffle: function(arr) { if (typeof(arr) !== 'undefined' && arr.constructor !== Array) { return false; } var total = arr.length, tmp1 = false, rnd = false; while (total--) { rnd = Math.floor(Math.random() * (total + 1)); tmp1 = arr[total]; arr[total] = arr[rnd]; arr[rnd] = tmp1; } return arr; }, /** * Runs a function through each of the elements of an array * * @method forEach * @param {Array} arr Array to be cycled/iterated * @param {Function} cb The function receives as arguments the value, index and array. * @return {Array} Array iterated. * @public * @static * @example * Ink.requireModules(['Ink.Util.Array_1'], function( InkArray ){ * var testArray = [ 'value1', 'value2', 'value3', 'value2' ]; * InkArray.forEach( testArray, function( value, index, arr ){ * console.log( 'The value is: ' + value + ' | The index is: ' + index ); * }); * }); */ forEach: function(array, callback, context) { if (arrayProto.forEach) { return arrayProto.forEach.call(array, callback, context); } for (var i = 0, len = array.length >>> 0; i < len; i++) { callback.call(context, array[i], i, array); } }, /** * Alias for backwards compatibility. See forEach * * @method forEach */ each: function () { InkArray.forEach.apply(InkArray, [].slice.call(arguments)); }, /** * Run a `map` function for each item in the array. The function will receive each item as argument and its return value will change the corresponding array item. * @method map * @param {Array} array The array to map over * @param {Function} map The map function. Will take `(item, index, array)` and `this` will be the `context` argument. * @param {Object} [context] Object to be `this` in the map function. * * @example * InkArray.map([1, 2, 3, 4], function (item) { * return item + 1; * }); // -> [2, 3, 4, 5] */ map: function (array, callback, context) { if (arrayProto.map) { return arrayProto.map.call(array, callback, context); } var mapped = new Array(len); for (var i = 0, len = array.length >>> 0; i < len; i++) { mapped[i] = callback.call(context, array[i], i, array); } return mapped; }, /** * Run a test function through all the input array. Items which pass the test function (for which the test function returned `true`) are kept in the array. Other items are removed. * @param {Array} array * @param {Function} test A test function taking `(item, index, array)` * @param {Object} [context] Object to be `this` in the test function. * @return filtered array * * @example * InkArray.filter([1, 2, 3, 4, 5], function (val) { * return val > 2; * }) // -> [3, 4, 5] */ filter: function (array, test, context) { if (arrayProto.filter) { return arrayProto.filter.call(array, test, context); } var filtered = [], val = null; for (var i = 0, len = array.length; i < len; i++) { val = array[i]; // it might be mutated if (test.call(context, val, i, array)) { filtered.push(val); } } return filtered; }, /** * Runs a callback function, which should return true or false. * If one of the 'runs' returns true, it will return. Otherwise if none returns true, it will return false. * See more at: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/some (MDN) * * @method some * @param {Array} arr The array you walk to iterate through * @param {Function} cb The callback that will be called on the array's elements. It receives the value, the index and the array as arguments. * @param {Object} Context object of the callback function * @return {Boolean} True if the callback returns true at any point, false otherwise * @public * @static * @example * Ink.requireModules(['Ink.Util.Array_1'], function( InkArray ){ * var testArray1 = [ 10, 20, 50, 100, 30 ]; * var testArray2 = [ 1, 2, 3, 4, 5 ]; * * function myTestFunction( value, index, arr ){ * if( value > 90 ){ * return true; * } * return false; * } * console.log( InkArray.some( testArray1, myTestFunction, null ) ); // Result: true * console.log( InkArray.some( testArray2, myTestFunction, null ) ); // Result: false * }); */ some: function(arr, cb, context){ if (arr === null){ throw new TypeError('First argument is invalid.'); } var t = Object(arr); var len = t.length >>> 0; if (typeof cb !== "function"){ throw new TypeError('Second argument must be a function.'); } for (var i = 0; i < len; i++) { if (i in t && cb.call(context, t[i], i, t)){ return true; } } return false; }, /** * Returns an array containing every item that is shared between the two given arrays * * @method intersect * @param {Array} arr Array1 to be intersected with Array2 * @param {Array} arr Array2 to be intersected with Array1 * @return {Array} Empty array if one of the arrays is false (or do not intersect) | Array with the intersected values * @public * @static * @example * Ink.requireModules(['Ink.Util.Array_1'], function( InkArray ){ * var testArray1 = [ 'value1', 'value2', 'value3' ]; * var testArray2 = [ 'value2', 'value3', 'value4', 'value5', 'value6' ]; * console.log( InkArray.intersect( testArray1,testArray2 ) ); // Result: [ 'value2', 'value3' ] * }); */ intersect: function(arr1, arr2) { if (!arr1 || !arr2 || arr1 instanceof Array === false || arr2 instanceof Array === false) { return []; } var shared = []; for (var i = 0, I = arr1.length; i<I; ++i) { for (var j = 0, J = arr2.length; j < J; ++j) { if (arr1[i] === arr2[j]) { shared.push(arr1[i]); } } } return shared; }, /** * Convert lists type to type array * * @method convert * @param {Array} arr Array to be converted * @return {Array} Array resulting of the conversion * @public * @static * @example * Ink.requireModules(['Ink.Util.Array_1'], function( InkArray ){ * var testArray = [ 'value1', 'value2' ]; * testArray.myMethod = function(){ * console.log('stuff'); * } * * console.log( InkArray.convert( testArray ) ); // Result: [ 'value1', 'value2' ] * }); */ convert: function(arr) { return arrayProto.slice.call(arr || [], 0); }, /** * Insert value into the array on specified idx * * @method insert * @param {Array} arr Array where the value will be inserted * @param {Number} idx Index of the array where the value should be inserted * @param {Mixed} value Value to be inserted * @public * @static * @example * Ink.requireModules(['Ink.Util.Array_1'], function( InkArray ){ * var testArray = [ 'value1', 'value2' ]; * console.log( InkArray.insert( testArray, 1, 'value3' ) ); // Result: [ 'value1', 'value3', 'value2' ] * }); */ insert: function(arr, idx, value) { arr.splice(idx, 0, value); }, /** * Remove a range of values from the array * * @method remove * @param {Array} arr Array where the value will be inserted * @param {Number} from Index of the array where the removal will start removing. * @param {Number} rLen Number of items to be removed from the index onwards. * @return {Array} An array with the remaining values * @public * @static * @example * Ink.requireModules(['Ink.Util.Array_1'], function( InkArray ){ * var testArray = [ 'value1', 'value2', 'value3', 'value4', 'value5' ]; * console.log( InkArray.remove( testArray, 1, 3 ) ); // Result: [ 'value1', 'value4', 'value5' ] * }); */ remove: function(arr, from, rLen){ var output = []; for(var i = 0, iLen = arr.length; i < iLen; i++){ if(i >= from && i < from + rLen){ continue; } output.push(arr[i]); } return output; } }; return InkArray; }); /** * @module Ink.Util.BinPack_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.Util.BinPack', '1', [], function() { 'use strict'; /*jshint boss:true */ // https://github.com/jakesgordon/bin-packing/ /* Copyright (c) 2011, 2012, 2013 Jake Gordon and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var Packer = function(w, h) { this.init(w, h); }; Packer.prototype = { init: function(w, h) { this.root = { x: 0, y: 0, w: w, h: h }; }, fit: function(blocks) { var n, node, block; for (n = 0; n < blocks.length; ++n) { block = blocks[n]; if (node = this.findNode(this.root, block.w, block.h)) { block.fit = this.splitNode(node, block.w, block.h); } } }, findNode: function(root, w, h) { if (root.used) { return this.findNode(root.right, w, h) || this.findNode(root.down, w, h); } else if ((w <= root.w) && (h <= root.h)) { return root; } else { return null; } }, splitNode: function(node, w, h) { node.used = true; node.down = { x: node.x, y: node.y + h, w: node.w, h: node.h - h }; node.right = { x: node.x + w, y: node.y, w: node.w - w, h: h }; return node; } }; var GrowingPacker = function() {}; GrowingPacker.prototype = { fit: function(blocks) { var n, node, block, len = blocks.length; var w = len > 0 ? blocks[0].w : 0; var h = len > 0 ? blocks[0].h : 0; this.root = { x: 0, y: 0, w: w, h: h }; for (n = 0; n < len ; n++) { block = blocks[n]; if (node = this.findNode(this.root, block.w, block.h)) { block.fit = this.splitNode(node, block.w, block.h); } else { block.fit = this.growNode(block.w, block.h); } } }, findNode: function(root, w, h) { if (root.used) { return this.findNode(root.right, w, h) || this.findNode(root.down, w, h); } else if ((w <= root.w) && (h <= root.h)) { return root; } else { return null; } }, splitNode: function(node, w, h) { node.used = true; node.down = { x: node.x, y: node.y + h, w: node.w, h: node.h - h }; node.right = { x: node.x + w, y: node.y, w: node.w - w, h: h }; return node; }, growNode: function(w, h) { var canGrowDown = (w <= this.root.w); var canGrowRight = (h <= this.root.h); var shouldGrowRight = canGrowRight && (this.root.h >= (this.root.w + w)); // attempt to keep square-ish by growing right when height is much greater than width var shouldGrowDown = canGrowDown && (this.root.w >= (this.root.h + h)); // attempt to keep square-ish by growing down when width is much greater than height if (shouldGrowRight) { return this.growRight(w, h); } else if (shouldGrowDown) { return this.growDown(w, h); } else if (canGrowRight) { return this.growRight(w, h); } else if (canGrowDown) { return this.growDown(w, h); } else { return null; // need to ensure sensible root starting size to avoid this happening } }, growRight: function(w, h) { this.root = { used: true, x: 0, y: 0, w: this.root.w + w, h: this.root.h, down: this.root, right: { x: this.root.w, y: 0, w: w, h: this.root.h } }; var node; if (node = this.findNode(this.root, w, h)) { return this.splitNode(node, w, h); } else { return null; } }, growDown: function(w, h) { this.root = { used: true, x: 0, y: 0, w: this.root.w, h: this.root.h + h, down: { x: 0, y: this.root.h, w: this.root.w, h: h }, right: this.root }; var node; if (node = this.findNode(this.root, w, h)) { return this.splitNode(node, w, h); } else { return null; } } }; var sorts = { random: function() { return Math.random() - 0.5; }, w: function(a, b) { return b.w - a.w; }, h: function(a, b) { return b.h - a.h; }, a: function(a, b) { return b.area - a.area; }, max: function(a, b) { return Math.max(b.w, b.h) - Math.max(a.w, a.h); }, min: function(a, b) { return Math.min(b.w, b.h) - Math.min(a.w, a.h); }, height: function(a, b) { return sorts.msort(a, b, ['h', 'w']); }, width: function(a, b) { return sorts.msort(a, b, ['w', 'h']); }, area: function(a, b) { return sorts.msort(a, b, ['a', 'h', 'w']); }, maxside: function(a, b) { return sorts.msort(a, b, ['max', 'min', 'h', 'w']); }, msort: function(a, b, criteria) { /* sort by multiple criteria */ var diff, n; for (n = 0; n < criteria.length; ++n) { diff = sorts[ criteria[n] ](a, b); if (diff !== 0) { return diff; } } return 0; } }; // end of Jake's code // aux, used to display blocks in unfitted property var toString = function() { return [this.w, ' x ', this.h].join(''); }; /** * Binary Packing algorithm implementation * * Based on the work of Jake Gordon * * see https://github.com/jakesgordon/bin-packing/ * * @class Ink.Util.BinPack * @version 1 * @static */ var BinPack = { /** * @method binPack * @param {Object} o options * @param {Object[]} o.blocks array of items with w and h integer attributes. * @param {Number[2]} [o.dimensions] if passed, container has fixed dimensions * @param {String} [o.sorter] sorter function. one of: random, height, width, area, maxside * @return {Object} * * {Number[2]} dimensions - resulted container size, * * {Number} filled - filled ratio, * * {Object[]} fitted, * * {Object[]} unfitted, * * {Object[]} blocks * @static */ binPack: function(o) { var i, f, bl; // calculate area if not there already for (i = 0, f = o.blocks.length; i < f; ++i) { bl = o.blocks[i]; if (! ('area' in bl) ) { bl.area = bl.w * bl.h; } } // apply algorithm var packer = o.dimensions ? new Packer(o.dimensions[0], o.dimensions[1]) : new GrowingPacker(); if (!o.sorter) { o.sorter = 'maxside'; } o.blocks.sort( sorts[ o.sorter ] ); packer.fit(o.blocks); var dims2 = [packer.root.w, packer.root.h]; // layout is done here, generating report data... var fitted = []; var unfitted = []; for (i = 0, f = o.blocks.length; i < f; ++i) { bl = o.blocks[i]; if (bl.fit) { fitted.push(bl); } else { bl.toString = toString; // TO AID SERIALIZATION unfitted.push(bl); } } var area = dims2[0] * dims2[1]; var fit = 0; for (i = 0, f = fitted.length; i < f; ++i) { bl = fitted[i]; fit += bl.area; } return { dimensions: dims2, filled: fit / area, blocks: o.blocks, fitted: fitted, unfitted: unfitted }; } }; return BinPack; }); /** * @module Ink.Util.Cookie_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.Util.Cookie', '1', [], function() { 'use strict'; /** * Utilities for Cookie handling * * @class Ink.Util.Cookie * @version 1 * @static */ var Cookie = { /** * Gets an object with current page cookies * * @method get * @param {String} name * @return {String|Object} If the name is specified, it returns the value related to that property. Otherwise it returns the full cookie object * @public * @static * @example * Ink.requireModules(['Ink.Util.Cookie_1'], function( InkCookie ){ * var myCookieValue = InkCookie.get('someVarThere'); * console.log( myCookieValue ); // This will output the value of the cookie 'someVarThere', from the cookie object. * }); */ get: function(name) { var cookie = document.cookie || false; var _Cookie = {}; if(cookie) { cookie = cookie.replace(new RegExp("; ", "g"), ';'); var aCookie = cookie.split(';'); var aItem = []; if(aCookie.length > 0) { for(var i=0; i < aCookie.length; i++) { aItem = aCookie[i].split('='); if(aItem.length === 2) { _Cookie[aItem[0]] = decodeURIComponent(aItem[1]); } aItem = []; } } } if(name) { if(typeof(_Cookie[name]) !== 'undefined') { return _Cookie[name]; } else { return null; } } return _Cookie; }, /** * Sets a cookie * * @method set * @param {String} name Cookie name * @param {String} value Cookie value * @param {Number} [expires] Number to add to current Date in seconds * @param {String} [path] Path to sets cookie (default '/') * @param {String} [domain] Domain to sets cookie (default current hostname) * @param {Boolean} [secure] True if wants secure, default 'false' * @public * @static * @example * Ink.requireModules(['Ink.Util.Cookie_1'], function( InkCookie ){ * var expireDate = new Date( 2014,00,01, 0,0,0); * InkCookie.set( 'someVarThere', 'anyValueHere', expireDate.getTime() ); * }); */ set: function(name, value, expires, path, domain, secure) { var sName; if(!name || value===false || typeof(name) === 'undefined' || typeof(value) === 'undefined') { return false; } else { sName = name+'='+encodeURIComponent(value); } var sExpires = false; var sPath = false; var sDomain = false; var sSecure = false; if(expires && typeof(expires) !== 'undefined' && !isNaN(expires)) { var oDate = new Date(); var sDate = (parseInt(Number(oDate.valueOf()), 10) + (Number(parseInt(expires, 10)) * 1000)); var nDate = new Date(sDate); var expiresString = nDate.toGMTString(); var re = new RegExp("([^\\s]+)(\\s\\d\\d)\\s(\\w\\w\\w)\\s(.*)"); expiresString = expiresString.replace(re, "$1$2-$3-$4"); sExpires = 'expires='+expiresString; } else { if(typeof(expires) !== 'undefined' && !isNaN(expires) && Number(parseInt(expires, 10))===0) { sExpires = ''; } else { sExpires = 'expires=Thu, 01-Jan-2037 00:00:01 GMT'; } } if(path && typeof(path) !== 'undefined') { sPath = 'path='+path; } else { sPath = 'path=/'; } if(domain && typeof(domain) !== 'undefined') { sDomain = 'domain='+domain; } else { var portClean = new RegExp(":(.*)"); sDomain = 'domain='+window.location.host; sDomain = sDomain.replace(portClean,""); } if(secure && typeof(secure) !== 'undefined') { sSecure = secure; } else { sSecure = false; } document.cookie = sName+'; '+sExpires+'; '+sPath+'; '+sDomain+'; '+sSecure; }, /** * Delete a cookie * * @method remove * @param {String} cookieName Cookie name * @param {String} [path] Path of the cookie (default '/') * @param {String} [domain] Domain of the cookie (default current hostname) * @public * @static * @example * Ink.requireModules(['Ink.Util.Cookie_1'], function( InkCookie ){ * InkCookie.remove( 'someVarThere' ); * }); */ remove: function(cookieName, path, domain) { //var expiresDate = 'Thu, 01-Jan-1970 00:00:01 GMT'; var sPath = false; var sDomain = false; var expiresDate = -999999999; if(path && typeof(path) !== 'undefined') { sPath = path; } else { sPath = '/'; } if(domain && typeof(domain) !== 'undefined') { sDomain = domain; } else { sDomain = window.location.host; } this.set(cookieName, 'deleted', expiresDate, sPath, sDomain); } }; return Cookie; }); /** * @module Ink.Util.Date_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.Util.Date', '1', [], function() { 'use strict'; /** * Class to provide the same features that php date does * * @class Ink.Util.Date * @version 1 * @static */ var InkDate = { /** * Function that returns the string representation of the month [PT only] * * @method _months * @param {Number} index Month javascript (0 to 11) * @return {String} The month's name * @private * @static * @example * console.log( InkDate._months(0) ); // Result: Janeiro */ _months: function(index){ var _m = ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro']; return _m[index]; }, /** * Function that returns the month [PT only] ( 0 to 11 ) * * @method _iMonth * @param {String} month Month javascript (0 to 11) * @return {Number} The month's number * @private * @static * @example * console.log( InkDate._iMonth('maio') ); // Result: 4 */ _iMonth : function( month ) { if ( Number( month ) ) { return +month - 1; } return { 'janeiro' : 0 , 'jan' : 0 , 'fevereiro' : 1 , 'fev' : 1 , 'março' : 2 , 'mar' : 2 , 'abril' : 3 , 'abr' : 3 , 'maio' : 4 , 'mai' : 4 , 'junho' : 5 , 'jun' : 5 , 'julho' : 6 , 'jul' : 6 , 'agosto' : 7 , 'ago' : 7 , 'setembro' : 8 , 'set' : 8 , 'outubro' : 9 , 'out' : 9 , 'novembro' : 10 , 'nov' : 10 , 'dezembro' : 11 , 'dez' : 11 }[ month.toLowerCase( ) ]; } , /** * Function that returns the representation the day of the week [PT Only] * * @method _wDays * @param {Number} index Week's day index * @return {String} The week's day name * @private * @static * @example * console.log( InkDate._wDays(0) ); // Result: Domingo */ _wDays: function(index){ var _d = ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado']; return _d[index]; }, /** * Function that returns day of the week in javascript 1 to 7 * * @method _iWeek * @param {String} week Week's day name * @return {Number} The week's day index * @private * @static * @example * console.log( InkDate._iWeek('quarta') ); // Result: 3 */ _iWeek: function( week ) { if ( Number( week ) ) { return +week || 7; } return { 'segunda' : 1 , 'seg' : 1 , 'terça' : 2 , 'ter' : 2 , 'quarta' : 3 , 'qua' : 3 , 'quinta' : 4 , 'qui' : 4 , 'sexta' : 5 , 'sex' : 5 , 'sábado' : 6 , 'sáb' : 6 , 'domingo' : 7 , 'dom' : 7 }[ week.toLowerCase( ) ]; }, /** * Function that returns the number of days of a given month (m) on a given year (y) * * @method _daysInMonth * @param {Number} _m Month * @param {Number} _y Year * @return {Number} Number of days of a give month on a given year * @private * @static * @example * console.log( InkDate._daysInMonth(2,2013) ); // Result: 28 */ _daysInMonth: function(_m,_y){ var nDays; if(_m===1 || _m===3 || _m===5 || _m===7 || _m===8 || _m===10 || _m===12) { nDays= 31; } else if ( _m===4 || _m===6 || _m===9 || _m===11) { nDays = 30; } else { if((_y%400===0) || (_y%4===0 && _y%100!==0)) { nDays = 29; } else { nDays = 28; } } return nDays; }, /** * Function that works exactly as php date() function * Works like PHP 5.2.2 <a href="http://php.net/manual/en/function.date.php" target="_blank">PHP Date function</a> * * @method get * @param {String} format - as the string in which the date it will be formatted - mandatory * @param {Date} [_date] - the date to format. If undefined it will do it on now() date. Can receive unix timestamp or a date object * @return {String} Formatted date * @public * @static * @example * <script> * Ink.requireModules( ['Ink.Util.Date_1'], function( InkDate ){ * console.log( InkDate.get('Y-m-d') ); // Result (at the time of writing): 2013-05-07 * }); * </script> */ get: function(format, _date){ /*jshint maxcomplexity:65 */ if(typeof(format) === 'undefined' || format === ''){ format = "Y-m-d"; } var iFormat = format.split(""); var result = new Array(iFormat.length); var escapeChar = "\\"; var jsDate; if (typeof(_date) === 'undefined'){ jsDate = new Date(); } else if (typeof(_date)==='number'){ jsDate = new Date(_date*1000); } else { jsDate = new Date(_date); } var jsFirstDay, jsThisDay, jsHour; /* This switch is presented in the same order as in php date function (PHP 5.2.2) */ for (var i = 0; i < iFormat.length; i++) { switch(iFormat[i]) { case escapeChar: result[i] = iFormat[i+1]; i++; break; /* DAY */ case "d": /* Day of the month, 2 digits with leading zeros; ex: 01 to 31 */ var jsDay = jsDate.getDate(); result[i] = (String(jsDay).length > 1) ? jsDay : "0" + jsDay; break; case "D": /* A textual representation of a day, three letters; Seg to Dom */ result[i] = this._wDays(jsDate.getDay()).substring(0, 3); break; case "j": /* Day of the month without leading zeros; ex: 1 to 31 */ result[i] = jsDate.getDate(); break; case "l": /* A full textual representation of the day of the week; Domingo to Sabado */ result[i] = this._wDays(jsDate.getDay()); break; case "N": /* ISO-8601 numeric representation of the day of the week; 1 (Segunda) to 7 (Domingo) */ result[i] = jsDate.getDay() || 7; break; case "S": /* English ordinal suffix for the day of the month, 2 characters; st, nd, rd or th. Works well with j */ var temp = jsDate.getDate(); var suffixes = ["st", "nd", "rd"]; var suffix = ""; if (temp >= 11 && temp <= 13) { result[i] = "th"; } else { result[i] = (suffix = suffixes[String(temp).substr(-1) - 1]) ? (suffix) : ("th"); } break; case "w": /* Numeric representation of the day of the week; 0 (for Sunday) through 6 (for Saturday) */ result[i] = jsDate.getDay(); break; case "z": /* The day of the year (starting from 0); 0 to 365 */ jsFirstDay = Date.UTC(jsDate.getFullYear(), 0, 0); jsThisDay = Date.UTC(jsDate.getFullYear(), jsDate.getMonth(), jsDate.getDate()); result[i] = Math.floor((jsThisDay - jsFirstDay) / (1000 * 60 * 60 * 24)); break; /* WEEK */ case "W": /* ISO-8601 week number of year, weeks starting on Monday; ex: 42 (the 42nd week in the year) */ var jsYearStart = new Date( jsDate.getFullYear( ) , 0 , 1 ); jsFirstDay = jsYearStart.getDay() || 7; var days = Math.floor( ( jsDate - jsYearStart ) / ( 24 * 60 * 60 * 1000 ) + 1 ); result[ i ] = Math.ceil( ( days - ( 8 - jsFirstDay ) ) / 7 ) + 1; break; /* MONTH */ case "F": /* A full textual representation of a month, such as Janeiro or Marco; Janeiro a Dezembro */ result[i] = this._months(jsDate.getMonth()); break; case "m": /* Numeric representation of a month, with leading zeros; 01 to 12 */ var jsMonth = String(jsDate.getMonth() + 1); result[i] = (jsMonth.length > 1) ? jsMonth : "0" + jsMonth; break; case "M": /* A short textual representation of a month, three letters; Jan a Dez */ result[i] = this._months(jsDate.getMonth()).substring(0,3); break; case "n": /* Numeric representation of a month, without leading zeros; 1 a 12 */ result[i] = jsDate.getMonth() + 1; break; case "t": /* Number of days in the given month; ex: 28 */ result[i] = this._daysInMonth(jsDate.getMonth()+1,jsDate.getYear()); break; /* YEAR */ case "L": /* Whether it's a leap year; 1 if it is a leap year, 0 otherwise. */ var jsYear = jsDate.getFullYear(); result[i] = (jsYear % 4) ? false : ( (jsYear % 100) ? true : ( (jsYear % 400) ? false : true ) ); break; case "o": /* ISO-8601 year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. */ throw '"o" not implemented!'; case "Y": /* A full numeric representation of a year, 4 digits; 1999 */ result[i] = jsDate.getFullYear(); break; case "y": /* A two digit representation of a year; 99 */ result[i] = String(jsDate.getFullYear()).substring(2); break; /* TIME */ case "a": /* Lowercase Ante meridiem and Post meridiem; am or pm */ result[i] = (jsDate.getHours() < 12) ? "am" : "pm"; break; case "A": /* Uppercase Ante meridiem and Post meridiem; AM or PM */ result[i] = (jsDate.getHours < 12) ? "AM" : "PM"; break; case "B": /* Swatch Internet time; 000 through 999 */ throw '"B" not implemented!'; case "g": /* 12-hour format of an hour without leading zeros; 1 to 12 */ jsHour = jsDate.getHours(); result[i] = (jsHour <= 12) ? jsHour : (jsHour - 12); break; case "G": /* 24-hour format of an hour without leading zeros; 1 to 23 */ result[i] = String(jsDate.getHours()); break; case "h": /* 12-hour format of an hour with leading zeros; 01 to 12 */ jsHour = String(jsDate.getHours()); jsHour = (jsHour <= 12) ? jsHour : (jsHour - 12); result[i] = (jsHour.length > 1) ? jsHour : "0" + jsHour; break; case "H": /* 24-hour format of an hour with leading zeros; 01 to 24 */ jsHour = String(jsDate.getHours()); result[i] = (jsHour.length > 1) ? jsHour : "0" + jsHour; break; case "i": /* Minutes with leading zeros; 00 to 59 */ var jsMinute = String(jsDate.getMinutes()); result[i] = (jsMinute.length > 1) ? jsMinute : "0" + jsMinute; break; case "s": /* Seconds with leading zeros; 00 to 59; */ var jsSecond = String(jsDate.getSeconds()); result[i] = (jsSecond.length > 1) ? jsSecond : "0" + jsSecond; break; case "u": /* Microseconds */ throw '"u" not implemented!'; /* TIMEZONE */ case "e": /* Timezone identifier */ throw '"e" not implemented!'; case "I": /* "1" if Daylight Savings Time, "0" otherwise. Works only on the northern hemisphere */ jsFirstDay = new Date(jsDate.getFullYear(), 0, 1); result[i] = (jsDate.getTimezoneOffset() !== jsFirstDay.getTimezoneOffset()) ? (1) : (0); break; case "O": /* Difference to Greenwich time (GMT) in hours */ var jsMinZone = jsDate.getTimezoneOffset(); var jsMinutes = jsMinZone % 60; jsHour = String(((jsMinZone - jsMinutes) / 60) * -1); if (jsHour.charAt(0) !== "-") { jsHour = "+" + jsHour; } jsHour = (jsHour.length === 3) ? (jsHour) : (jsHour.replace(/([+\-])(\d)/, "$1" + 0 + "$2")); result[i] = jsHour + jsMinutes + "0"; break; case "P": /* Difference to Greenwich time (GMT) with colon between hours and minutes */ throw '"P" not implemented!'; case "T": /* Timezone abbreviation */ throw '"T" not implemented!'; case "Z": /* Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. */ result[i] = jsDate.getTimezoneOffset() * 60; break; /* FULL DATE/TIME */ case "c": /* ISO 8601 date */ throw '"c" not implemented!'; case "r": /* RFC 2822 formatted date */ var jsDayName = this._wDays(jsDate.getDay()).substr(0, 3); var jsMonthName = this._months(jsDate.getMonth()).substr(0, 3); result[i] = jsDayName + ", " + jsDate.getDate() + " " + jsMonthName + this.get(" Y H:i:s O",jsDate); break; case "U": /* Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) */ result[i] = Math.floor(jsDate.getTime() / 1000); break; default: result[i] = iFormat[i]; } } return result.join(''); }, /** * Functions that works like php date() function but return a date based on the formatted string * Works like PHP 5.2.2 <a href="http://php.net/manual/en/function.date.php" target="_blank">PHP Date function</a> * * @method set * @param {String} [format] As the string in which the date it will be formatted. By default is 'Y-m-d' * @param {String} str_date The date formatted - Mandatory. * @return {Date} Date object based on the formatted date * @public * @static */ set : function( format , str_date ) { if ( typeof str_date === 'undefined' ) { return ; } if ( typeof format === 'undefined' || format === '' ) { format = "Y-m-d"; } var iFormat = format.split(""); var result = new Array( iFormat.length ); var escapeChar = "\\"; var mList; var objIndex = { year : undefined , month : undefined , day : undefined , dayY : undefined , dayW : undefined , week : undefined , hour : undefined , hourD : undefined , min : undefined , sec : undefined , msec : undefined , ampm : undefined , diffM : undefined , diffH : undefined , date : undefined }; var matches = 0; /* This switch is presented in the same order as in php date function (PHP 5.2.2) */ for ( var i = 0; i < iFormat.length; i++) { switch( iFormat[ i ] ) { case escapeChar: result[i] = iFormat[ i + 1 ]; i++; break; /* DAY */ case "d": /* Day of the month, 2 digits with leading zeros; ex: 01 to 31 */ result[ i ] = '(\\d{2})'; objIndex.day = { original : i , match : matches++ }; break; case "j": /* Day of the month without leading zeros; ex: 1 to 31 */ result[ i ] = '(\\d{1,2})'; objIndex.day = { original : i , match : matches++ }; break; case "D": /* A textual representation of a day, three letters; Seg to Dom */ result[ i ] = '([\\wá]{3})'; objIndex.dayW = { original : i , match : matches++ }; break; case "l": /* A full textual representation of the day of the week; Domingo to Sabado */ result[i] = '([\\wá]{5,7})'; objIndex.dayW = { original : i , match : matches++ }; break; case "N": /* ISO-8601 numeric representation of the day of the week; 1 (Segunda) to 7 (Domingo) */ result[ i ] = '(\\d)'; objIndex.dayW = { original : i , match : matches++ }; break; case "w": /* Numeric representation of the day of the week; 0 (for Sunday) through 6 (for Saturday) */ result[ i ] = '(\\d)'; objIndex.dayW = { original : i , match : matches++ }; break; case "S": /* English ordinal suffix for the day of the month, 2 characters; st, nd, rd or th. Works well with j */ result[ i ] = '\\w{2}'; break; case "z": /* The day of the year (starting from 0); 0 to 365 */ result[ i ] = '(\\d{1,3})'; objIndex.dayY = { original : i , match : matches++ }; break; /* WEEK */ case "W": /* ISO-8601 week number of year, weeks starting on Monday; ex: 42 (the 42nd week in the year) */ result[ i ] = '(\\d{1,2})'; objIndex.week = { original : i , match : matches++ }; break; /* MONTH */ case "F": /* A full textual representation of a month, such as Janeiro or Marco; Janeiro a Dezembro */ result[ i ] = '([\\wç]{4,9})'; objIndex.month = { original : i , match : matches++ }; break; case "M": /* A short textual representation of a month, three letters; Jan a Dez */ result[ i ] = '(\\w{3})'; objIndex.month = { original : i , match : matches++ }; break; case "m": /* Numeric representation of a month, with leading zeros; 01 to 12 */ result[ i ] = '(\\d{2})'; objIndex.month = { original : i , match : matches++ }; break; case "n": /* Numeric representation of a month, without leading zeros; 1 a 12 */ result[ i ] = '(\\d{1,2})'; objIndex.month = { original : i , match : matches++ }; break; case "t": /* Number of days in the given month; ex: 28 */ result[ i ] = '\\d{2}'; break; /* YEAR */ case "L": /* Whether it's a leap year; 1 if it is a leap year, 0 otherwise. */ result[ i ] = '\\w{4,5}'; break; case "o": /* ISO-8601 year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. */ throw '"o" not implemented!'; case "Y": /* A full numeric representation of a year, 4 digits; 1999 */ result[ i ] = '(\\d{4})'; objIndex.year = { original : i , match : matches++ }; break; case "y": /* A two digit representation of a year; 99 */ result[ i ] = '(\\d{2})'; if ( typeof objIndex.year === 'undefined' || iFormat[ objIndex.year.original ] !== 'Y' ) { objIndex.year = { original : i , match : matches++ }; } break; /* TIME */ case "a": /* Lowercase Ante meridiem and Post meridiem; am or pm */ result[ i ] = '(am|pm)'; objIndex.ampm = { original : i , match : matches++ }; break; case "A": /* Uppercase Ante meridiem and Post meridiem; AM or PM */ result[ i ] = '(AM|PM)'; objIndex.ampm = { original : i , match : matches++ }; break; case "B": /* Swatch Internet time; 000 through 999 */ throw '"B" not implemented!'; case "g": /* 12-hour format of an hour without leading zeros; 1 to 12 */ result[ i ] = '(\\d{1,2})'; objIndex.hourD = { original : i , match : matches++ }; break; case "G": /* 24-hour format of an hour without leading zeros; 1 to 23 */ result[ i ] = '(\\d{1,2})'; objIndex.hour = { original : i , match : matches++ }; break; case "h": /* 12-hour format of an hour with leading zeros; 01 to 12 */ result[ i ] = '(\\d{2})'; objIndex.hourD = { original : i , match : matches++ }; break; case "H": /* 24-hour format of an hour with leading zeros; 01 to 24 */ result[ i ] = '(\\d{2})'; objIndex.hour = { original : i , match : matches++ }; break; case "i": /* Minutes with leading zeros; 00 to 59 */ result[ i ] = '(\\d{2})'; objIndex.min = { original : i , match : matches++ }; break; case "s": /* Seconds with leading zeros; 00 to 59; */ result[ i ] = '(\\d{2})'; objIndex.sec = { original : i , match : matches++ }; break; case "u": /* Microseconds */ throw '"u" not implemented!'; /* TIMEZONE */ case "e": /* Timezone identifier */ throw '"e" not implemented!'; case "I": /* "1" if Daylight Savings Time, "0" otherwise. Works only on the northern hemisphere */ result[i] = '\\d'; break; case "O": /* Difference to Greenwich time (GMT) in hours */ result[ i ] = '([-+]\\d{4})'; objIndex.diffH = { original : i , match : matches++ }; break; case "P": /* Difference to Greenwich time (GMT) with colon between hours and minutes */ throw '"P" not implemented!'; case "T": /* Timezone abbreviation */ throw '"T" not implemented!'; case "Z": /* Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. */ result[ i ] = '(\\-?\\d{1,5})'; objIndex.diffM = { original : i , match : matches++ }; break; /* FULL DATE/TIME */ case "c": /* ISO 8601 date */ throw '"c" not implemented!'; case "r": /* RFC 2822 formatted date */ result[ i ] = '([\\wá]{3}, \\d{1,2} \\w{3} \\d{4} \\d{2}:\\d{2}:\\d{2} [+\\-]\\d{4})'; objIndex.date = { original : i , match : matches++ }; break; case "U": /* Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) */ result[ i ] = '(\\d{1,13})'; objIndex.date = { original : i , match : matches++ }; break; default: result[ i ] = iFormat[ i ]; } } var pattr = new RegExp( result.join('') ); try { mList = str_date.match( pattr ); if ( !mList ) { return; } } catch ( e ) { return ; } var _haveDatetime = typeof objIndex.date !== 'undefined'; var _haveYear = typeof objIndex.year !== 'undefined'; var _haveYDay = typeof objIndex.dayY !== 'undefined'; var _haveDay = typeof objIndex.day !== 'undefined'; var _haveMonth = typeof objIndex.month !== 'undefined'; var _haveMonthDay = _haveMonth && _haveDay; var _haveOnlyDay = !_haveMonth && _haveDay; var _haveWDay = typeof objIndex.dayW !== 'undefined'; var _haveWeek = typeof objIndex.week !== 'undefined'; var _haveWeekWDay = _haveWeek && _haveWDay; var _haveOnlyWDay = !_haveWeek && _haveWDay; var _validDate = _haveYDay || _haveMonthDay || !_haveYear && _haveOnlyDay || _haveWeekWDay || !_haveYear && _haveOnlyWDay; var _noDate = !_haveYear && !_haveYDay && !_haveDay && !_haveMonth && !_haveWDay && !_haveWeek; var _haveHour12 = typeof objIndex.hourD !== 'undefined' && typeof objIndex.ampm !== 'undefined'; var _haveHour24 = typeof objIndex.hour !== 'undefined'; var _haveHour = _haveHour12 || _haveHour24; var _haveMin = typeof objIndex.min !== 'undefined'; var _haveSec = typeof objIndex.sec !== 'undefined'; var _haveMSec = typeof objIndex.msec !== 'undefined'; var _haveMoreM = !_noDate || _haveHour; var _haveMoreS = _haveMoreM || _haveMin; var _haveDiffM = typeof objIndex.diffM !== 'undefined'; var _haveDiffH = typeof objIndex.diffH !== 'undefined'; //var _haveGMT = _haveDiffM || _haveDiffH; var hour; var min; if ( _haveDatetime ) { if ( iFormat[ objIndex.date.original ] === 'U' ) { return new Date( +mList[ objIndex.date.match + 1 ] * 1000 ); } var dList = mList[ objIndex.date.match + 1 ].match( /\w{3}, (\d{1,2}) (\w{3}) (\d{4}) (\d{2}):(\d{2}):(\d{2}) ([+\-]\d{4})/ ); hour = +dList[ 4 ] + ( +dList[ 7 ].slice( 0 , 3 ) ); min = +dList[ 5 ] + ( dList[ 7 ].slice( 0 , 1 ) + dList[ 7 ].slice( 3 ) ) / 100 * 60; return new Date( dList[ 3 ] , this._iMonth( dList[ 2 ] ) , dList[ 1 ] , hour , min , dList[ 6 ] ); } var _d = new Date( ); var year; var month; var day; var sec; var msec; var gmt; if ( !_validDate && !_noDate ) { return ; } if ( _validDate ) { if ( _haveYear ) { var _y = _d.getFullYear( ) - 50 + ''; year = mList[ objIndex.year.match + 1 ]; if ( iFormat[ objIndex.year.original ] === 'y' ) { year = +_y.slice( 0 , 2 ) + ( year >= ( _y ).slice( 2 ) ? 0 : 1 ) + year; } } else { year = _d.getFullYear(); } if ( _haveYDay ) { month = 0; day = mList[ objIndex.dayY.match + 1 ]; } else if ( _haveDay ) { if ( _haveMonth ) { month = this._iMonth( mList[ objIndex.month.match + 1 ] ); } else { month = _d.getMonth( ); } day = mList[ objIndex.day.match + 1 ]; } else { month = 0; var week; if ( _haveWeek ) { week = mList[ objIndex.week.match + 1 ]; } else { week = this.get( 'W' , _d ); } day = ( week - 2 ) * 7 + ( 8 - ( ( new Date( year , 0 , 1 ) ).getDay( ) || 7 ) ) + this._iWeek( mList[ objIndex.week.match + 1 ] ); } if ( month === 0 && day > 31 ) { var aux = new Date( year , month , day ); month = aux.getMonth( ); day = aux.getDate( ); } } else { year = _d.getFullYear( ); month = _d.getMonth( ); day = _d.getDate( ); } if ( _haveHour12 ) { hour = +mList[ objIndex.hourD.match + 1 ] + ( mList[ objIndex.ampm.match + 1 ] === 'pm' ? 12 : 0 ); } else if ( _haveHour24 ) { hour = mList[ objIndex.hour.match + 1 ]; } else if ( _noDate ) { hour = _d.getHours( ); } else { hour = '00'; } if ( _haveMin ) { min = mList[ objIndex.min.match + 1 ]; } else if ( !_haveMoreM ) { min = _d.getMinutes( ); } else { min = '00'; } if ( _haveSec ) { sec = mList[ objIndex.sec.match + 1 ]; } else if ( !_haveMoreS ) { sec = _d.getSeconds( ); } else { sec = '00'; } if ( _haveMSec ) { msec = mList[ objIndex.msec.match + 1 ]; } else { msec = '000'; } if ( _haveDiffH ) { gmt = mList[ objIndex.diffH.match + 1 ]; } else if ( _haveDiffM ) { gmt = String( -1 * mList[ objIndex.diffM.match + 1 ] / 60 * 100 ).replace( /^(\d)/ , '+$1' ).replace( /(^[\-+])(\d{3}$)/ , '$10$2' ); } else { gmt = '+0000'; } return new Date( year, month, day, hour, min, sec ); } }; return InkDate; }); /** * @module Ink.Util.Dumper_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.Util.Dumper', '1', [], function() { 'use strict'; /** * Dump/Profiling Utilities * * @class Ink.Util.Dumper * @version 1 * @static */ var Dumper = { /** * Hex code for the 'tab' * * @property _tab * @type {String} * @private * @readOnly * @static * */ _tab: '\xA0\xA0\xA0\xA0', /** * Function that returns the argument passed formatted * * @method _formatParam * @param {Mixed} param * @return {String} The argument passed formatted * @private * @static */ _formatParam: function(param) { var formated = ''; switch(typeof(param)) { case 'string': formated = '(string) '+param; break; case 'number': formated = '(number) '+param; break; case 'boolean': formated = '(boolean) '+param; break; case 'object': if(param !== null) { if(param.constructor === Array) { formated = 'Array \n{\n' + this._outputFormat(param, 0) + '\n}'; } else { formated = 'Object \n{\n' + this._outputFormat(param, 0) + '\n}'; } } else { formated = 'null'; } break; default: formated = false; } return formated; }, /** * Function that returns the tabs concatenated * * @method _getTabs * @param {Number} numberOfTabs Number of Tabs * @return {String} Tabs concatenated * @private * @static */ _getTabs: function(numberOfTabs) { var tabs = ''; for(var _i = 0; _i < numberOfTabs; _i++) { tabs += this._tab; } return tabs; }, /** * Function that formats the parameter to display * * @method _outputFormat * @param {Any} param * @param {Number} dim * @return {String} The parameter passed formatted to displat * @private * @static */ _outputFormat: function(param, dim) { var formated = ''; //var _strVal = false; var _typeof = false; for(var key in param) { if(param[key] !== null) { if(typeof(param[key]) === 'object' && (param[key].constructor === Array || param[key].constructor === Object)) { if(param[key].constructor === Array) { _typeof = 'Array'; } else if(param[key].constructor === Object) { _typeof = 'Object'; } formated += this._tab + this._getTabs(dim) + '[' + key + '] => <b>'+_typeof+'</b>\n'; formated += this._tab + this._getTabs(dim) + '{\n'; formated += this._outputFormat(param[key], dim + 1) + this._tab + this._getTabs(dim) + '}\n'; } else if(param[key].constructor === Function) { continue; } else { formated = formated + this._tab + this._getTabs(dim) + '[' + key + '] => ' + param[key] + '\n'; } } else { formated = formated + this._tab + this._getTabs(dim) + '[' + key + '] => null \n'; } } return formated; }, /** * Print variable structure. Can be passed an output target * * @method printDump * @param {Object|String|Boolean} param * @param {optional String|Object} target (can be an element ID or an element) * @public * @static */ printDump: function(param, target) { /*jshint evil:true */ if(!target || typeof(target) === 'undefined') { document.write('<pre>'+this._formatParam(param)+'</pre>'); } else { if(typeof(target) === 'string') { document.getElementById(target).innerHTML = '<pre>' + this._formatParam(param) + '</pre>'; } else if(typeof(target) === 'object') { target.innerHTML = '<pre>'+this._formatParam(param)+'</pre>'; } else { throw "TARGET must be an element or an element ID"; } } }, /** * Function that returns the variable's structure * * @method returnDump * @param {Object|String|Boolean} param * @return {String} The variable structure * @public * @static */ returnDump: function(param) { return this._formatParam(param); }, /** * Function that alerts the variable structure * * @method alertDump * @param {Object|String|Boolean} param * @public * @static */ alertDump: function(param) { window.alert(this._formatParam(param).replace(/(<b>)(Array|Object)(<\/b>)/g, "$2")); }, /** * Print to new window the variable structure * * @method windowDump * @param {Object|String|Boolean} param * @public * @static */ windowDump: function(param) { var dumperwindow = 'dumperwindow_'+(Math.random() * 10000); var win = window.open('', dumperwindow, 'width=400,height=300,left=50,top=50,status,menubar,scrollbars,resizable' ); win.document.open(); win.document.write('<pre>'+this._formatParam(param)+'</pre>'); win.document.close(); win.focus(); } }; return Dumper; }); /** * @module Ink.Util.I18n_1 * @author inkdev AT sapo.pt */ Ink.createModule('Ink.Util.I18n', '1', [], function () { 'use strict'; var pattrText = /\{(?:(\{.*?})|(?:%s:)?(\d+)|(?:%s)?|([\w-]+))}/g; var funcOrVal = function( ret , args ) { if ( typeof ret === 'function' ) { return ret.apply(this, args); } else if (typeof ret !== undefined) { return ret; } else { return ''; } }; /** * Creates a new internationalization helper object * * @class Ink.Util.I18n * @constructor * * @param {Object} dict object mapping language codes (in the form of `pt_PT`, `pt_BR`, `fr`, `en_US`, etc.) to their Object dictionaries. * @param {Object} dict.(dictionaries...) * @param {String} [lang='pt_PT'] language code of the target language * * @example * var dictionaries = { // This could come from a JSONP request from your server * 'pt_PT': { * 'hello': 'olá', * 'me': 'eu', * 'i have a {} for you': 'tenho um {} para ti' // Old syntax using `{%s}` tokens still available * }, * 'pt_BR': { * 'hello': 'oi', * 'me': 'eu', * 'i have a {} for you': 'tenho um {} para você' * } * }; * Ink.requireModules(['Ink.Util.I18n_1'], function (I18n) { * var i18n = new I18n(dictionaries, 'pt_PT'); * i18n.text('hello'); // returns 'olá' * i18n.text('i have a {} for you', 'IRON SWORD'); // returns 'tenho um IRON SWORD' para ti * * i18n.lang('pt_BR'); // Changes language. pt_BR dictionary is loaded * i18n.text('hello'); // returns 'oi' * * i18n.lang('en_US'); // Missing language. * i18n.text('hello'); // returns 'hello'. If testMode is on, returns '[hello]' * }); * * @example * // The old {%s} syntax from libsapo's i18n is still supported * i18n.text('hello, {%s}!', 'someone'); // -> 'olá, someone!' */ var I18n = function( dict , lang , testMode ) { if ( !( this instanceof I18n ) ) { return new I18n( dict , lang , testMode ); } this.reset( ) .lang( lang ) .testMode( testMode ) .append( dict || { } , lang ); }; I18n.prototype = { reset: function( ) { this._dicts = [ ]; this._dict = { }; this._testMode = false; this._lang = this._gLang; return this; }, /** * Adds translation strings for this helper to use. * * @method append * @param {Object} dict object containing language objects identified by their language code * @example * var i18n = new I18n({}, 'pt_PT'); * i18n.append({'pt_PT': { * 'sfraggles': 'braggles' * }}); * i18n.text('sfraggles') // -> 'braggles' */ append: function( dict ) { this._dicts.push( dict ); this._dict = Ink.extendObj(this._dict , dict[ this._lang ] ); return this; }, /** * Get the language code * * @returns {String} the language code for this instance * @method {String} lang */ /** * Set the language. If there are more dictionaries available in cache, they will be loaded. * * @method lang * @param lang {String} Language code to set this instance to. */ lang: function( lang ) { if ( !arguments.length ) { return this._lang; } if ( lang && this._lang !== lang ) { this._lang = lang; this._dict = { }; for ( var i = 0, l = this._dicts.length; i < l; i++ ) { this._dict = Ink.extendObj( this._dict , this._dicts[ i ][ lang ] || { } ); } } return this; }, /** * Get the testMode * * @returns {Boolean} the testMode for this instance * @method {Boolean} testMode */ /** * Sets or unsets test mode. In test mode, unknown strings are wrapped * in `[ ... ]`. This is useful for debugging your application and * making sure all your translation keys are in place. * * @method testMode * @param {Boolean} bool boolean value to set the test mode to. */ testMode: function( bool ) { if ( !arguments.length ) { return !!this._testMode; } if ( bool !== undefined ) { this._testMode = !!bool; } return this; }, /** * Return an arbitrary key from the current language dictionary * * @method getKey * @param {String} key * @return {Any} The object which happened to be in the current language dictionary on the given key. * * @example * _.getKey('astring'); // -> 'a translated string' * _.getKey('anobject'); // -> {'a': 'translated object'} * _.getKey('afunction'); // -> function () { return 'this is a localized function' } */ getKey: function( key ) { var ret; var gLang = this._gLang; var lang = this._lang; if ( key in this._dict ) { ret = this._dict[ key ]; } else { I18n.lang( lang ); ret = this._gDict[ key ]; I18n.lang( gLang ); } return ret; }, /** * Given a translation key, return a translated string, with replaced parameters. * When a translated string is not available, the original string is returned unchanged. * * @method {String} text * @param {String} str key to look for in i18n dictionary (which is returned verbatim if unknown) * @param {Object} [namedParms] named replacements. Replaces {named} with values in this object. * @param {String} [arg1] replacement #1 (replaces first {} and all {1}) * @param {String} [arg2] replacement #2 (replaces second {} and all {2}) * @param {String} [argn...] replacement #n (replaces nth {} and all {n}) * * @example * _('Gosto muito de {} e o céu é {}.', 'carros', 'azul'); * // returns 'Gosto muito de carros e o céu é azul.' * * @example * _('O {1} é {2} como {2} é a cor do {3}.', 'carro', 'azul', 'FCP'); * // returns 'O carro é azul como azul é o FCP.' * * @example * _('O {person1} dava-se com a {person2}', {person1: 'coisinho', person2: 'coisinha'}); * // -> 'O coisinho dava-se com a coisinha' * * @example * // This is a bit more complex * var i18n = make().lang('pt_PT').append({ * pt_PT: { * array: [1, 2], * object: {'a': '-a-', 'b': '-b-'}, * func: function (a, b) {return '[[' + a + ',' + b + ']]';} * } * }); * i18n.text('array', 0); // -> '1' * i18n.text('object', 'a'); // -> '-a-' * i18n.text('func', 'a', 'b'); // -> '[[a,b]]' */ text: function( str /*, replacements...*/ ) { if ( typeof str !== 'string' ) { return; } // Backwards-compat var pars = Array.prototype.slice.call( arguments , 1 ); var idx = 0; var isObj = typeof pars[ 0 ] === 'object'; var original = this.getKey( str ); if ( original === undefined ) { original = this._testMode ? '[' + str + ']' : str; } if ( typeof original === 'number' ) { original += ''; } if (typeof original === 'string') { original = original.replace( pattrText , function( m , $1 , $2 , $3 ) { var ret = $1 ? $1 : $2 ? pars[ $2 - ( isObj ? 0 : 1 ) ] : $3 ? pars[ 0 ][ $3 ] || '' : pars[ (idx++) + ( isObj ? 1 : 0 ) ]; return funcOrVal( ret , [idx].concat(pars) ); }); return original; } return ( typeof original === 'function' ? original.apply( this , pars ) : original instanceof Array ? funcOrVal( original[ pars[ 0 ] ] , pars ) : typeof original === 'object' ? funcOrVal( original[ pars[ 0 ] ] , pars ) : ''); }, /** * Given a singular string, a plural string, and a number, translates * either the singular or plural string. * * @method ntext * @return {String} * * @param {String} strSin word to use when count is 1 * @param {String} strPlur word to use otherwise * @param {Number} count number which defines which word to use * @param [...] extra arguments, to be passed to `text()` * * @example * i18n.ntext('platypus', 'platypuses', 1); // returns 'ornitorrinco' * i18n.ntext('platypus', 'platypuses', 2); // returns 'ornitorrincos' * * @example * // The "count" argument is passed to text() * i18n.ntext('{} platypus', '{} platypuses', 1); // returns '1 ornitorrinco' * i18n.ntext('{} platypus', '{} platypuses', 2); // returns '2 ornitorrincos' */ ntext: function( strSin , strPlur , count ) { var pars = Array.prototype.slice.apply( arguments ); var original; if ( pars.length === 2 && typeof strPlur === 'number' ) { original = this.getKey( strSin ); if ( !( original instanceof Array ) ) { return ''; } pars.splice( 0 , 1 ); original = original[ strPlur === 1 ? 0 : 1 ]; } else { pars.splice( 0 , 2 ); original = count === 1 ? strSin : strPlur; } return this.text.apply( this , [ original ].concat( pars ) ); }, /** * Returns the ordinal suffix of `num` (For example, 1 > 'st', 2 > 'nd', 5 > 'th', ...). * * This works by using transforms (in the form of Objects or Functions) passed into the * function or found in the special key `_ordinals` in the active language dictionary. * * @method ordinal * * @param {Number} num Input number * * @param {Object|Function} [options={}] * * Maps for translating. Each of these options' fallback is found in the current * language's dictionary. The lookup order is the following: * * 1. `exceptions` * 2. `byLastDigit` * 3. `default` * * Each of these may be either an `Object` or a `Function`. If it's a function, it * is called (with `number` and `digit` for any function except for byLastDigit, * which is called with the `lastDigit` of the number in question), and if the * function returns a string, that is used. If it's an object, the property is * looked up using `[...]`. If what is found is a string, it is used. * * @param {Object|Function} [options.byLastDigit={}] * If the language requires the last digit to be considered, mappings of last digits * to ordinal suffixes can be created here. * * @param {Object|Function} [options.exceptions={}] * Map unique, special cases to their ordinal suffixes. * * @returns {String} Ordinal suffix for `num`. * * @example * var i18n = new I18n({ * pt_PT: { // 1º, 2º, 3º, 4º, ... * _ordinal: { // The _ordinals key each translation dictionary is special. * 'default': "º" // Usually the suffix is "º" in portuguese... * } * }, * fr: { // 1er, 2e, 3e, 4e, ... * _ordinal: { // The _ordinals key is special. * 'default': "e", // Usually the suffix is "e" in french... * exceptions: { * 1: "er" // ... Except for the number one. * } * } * }, * en_US: { // 1st, 2nd, 3rd, 4th, ..., 11th, 12th, ... 21st, 22nd... * _ordinal: { * 'default': "th",// Usually the digit is "th" in english... * byLastDigit: { * 1: "st", // When the last digit is 1, use "th"... * 2: "nd", // When the last digit is 2, use "nd"... * 3: "rd" // When the last digit is 3, use "rd"... * }, * exceptions: { // But these numbers are special * 0: "", * 11: "th", * 12: "th", * 13: "th" * } * } * } * }, 'pt_PT'); * * i18n.ordinal(1); // returns 'º' * i18n.ordinal(2); // returns 'º' * i18n.ordinal(11); // returns 'º' * * i18n.lang('fr'); * i18n.ordinal(1); // returns 'er' * i18n.ordinal(2); // returns 'e' * i18n.ordinal(11); // returns 'e' * * i18n.lang('en_US'); * i18n.ordinal(1); // returns 'st' * i18n.ordinal(2); // returns 'nd' * i18n.ordinal(12); // returns 'th' * i18n.ordinal(22); // returns 'nd' * i18n.ordinal(3); // returns 'rd' * i18n.ordinal(4); // returns 'th' * i18n.ordinal(5); // returns 'th' * **/ ordinal: function( num ) { if ( num === undefined ) { return ''; } var lastDig = +num.toString( ).slice( -1 ); var ordDict = this.getKey( '_ordinals' ); if ( ordDict === undefined ) { return ''; } if ( typeof ordDict === 'string' ) { return ordDict; } var ret; if ( typeof ordDict === 'function' ) { ret = ordDict( num , lastDig ); if ( typeof ret === 'string' ) { return ret; } } if ( 'exceptions' in ordDict ) { ret = typeof ordDict.exceptions === 'function' ? ordDict.exceptions( num , lastDig ) : num in ordDict.exceptions ? funcOrVal( ordDict.exceptions[ num ] , [num , lastDig] ) : undefined; if ( typeof ret === 'string' ) { return ret; } } if ( 'byLastDigit' in ordDict ) { ret = typeof ordDict.byLastDigit === 'function' ? ordDict.byLastDigit( lastDig , num ) : lastDig in ordDict.byLastDigit ? funcOrVal( ordDict.byLastDigit[ lastDig ] , [lastDig , num] ) : undefined; if ( typeof ret === 'string' ) { return ret; } } if ( 'default' in ordDict ) { ret = funcOrVal( ordDict['default'] , [ num , lastDig ] ); if ( typeof ret === 'string' ) { return ret; } } return ''; }, /** * Returns an alias to `text()`, for convenience. The resulting function is * traditionally assigned to "_". * * @method alias * @returns {Function} an alias to `text()`. You can also access the rest of the translation API through this alias. * * @example * var i18n = new I18n({ * 'pt_PT': { * 'hi': 'olá', * '{} day': '{} dia', * '{} days': '{} dias', * '_ordinals': { * 'default': 'º' * } * } * }, 'pt_PT'); * var _ = i18n.alias(); * _('hi'); // -> 'olá' * _('{} days', 3); // -> '3 dias' * _.ntext('{} day', '{} days', 2); // -> '2 dias' * _.ntext('{} day', '{} days', 1); // -> '1 dia' * _.ordinal(3); // -> 'º' */ alias: function( ) { var ret = Ink.bind( I18n.prototype.text , this ); ret.ntext = Ink.bind( I18n.prototype.ntext , this ); ret.append = Ink.bind( I18n.prototype.append , this ); ret.ordinal = Ink.bind( I18n.prototype.ordinal , this ); ret.testMode = Ink.bind( I18n.prototype.testMode , this ); return ret; } }; /** * @static * @method I18n.reset * * Reset I18n global state (global dictionaries, and default language for instances) **/ I18n.reset = function( ) { I18n.prototype._gDicts = [ ]; I18n.prototype._gDict = { }; I18n.prototype._gLang = 'pt_PT'; }; I18n.reset( ); /** * @static * @method I18n.append * * @param dict {Object} Dictionary to be added * @param lang {String} Language to be added to * * Add a dictionary to be used in all I18n instances for the corresponding language */ I18n.append = function( dict , lang ) { if ( lang ) { if ( !( lang in dict ) ) { var obj = { }; obj[ lang ] = dict; dict = obj; } if ( lang !== I18n.prototype._gLang ) { I18n.lang( lang ); } } I18n.prototype._gDicts.push( dict ); Ink.extendObj( I18n.prototype._gDict , dict[ I18n.prototype._gLang ] ); }; /** * @static * @method I18n.lang * * @param lang {String} String in the format `"pt_PT"`, `"fr"`, etc. * * Set global default language of I18n instances to `lang` */ /** * @static * @method I18n.lang * * Get the current default language of I18n instances. * * @return {String} language code */ I18n.lang = function( lang ) { if ( !arguments.length ) { return I18n.prototype._gLang; } if ( lang && I18n.prototype._gLang !== lang ) { I18n.prototype._gLang = lang; I18n.prototype._gDict = { }; for ( var i = 0, l = I18n.prototype._gDicts.length; i < l; i++ ) { Ink.extendObj( I18n.prototype._gDict , I18n.prototype._gDicts[ i ][ lang ] || { } ); } } }; return I18n; }); /** * @module Ink.Util.Json_1 * * @author inkdev AT sapo.pt */ Ink.createModule('Ink.Util.Json', '1', [], function() { 'use strict'; var function_call = Function.prototype.call; var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; function twoDigits(n) { var r = '' + n; if (r.length === 1) { return '0' + r; } else { return r; } } var dateToISOString = Date.prototype.toISOString ? Ink.bind(function_call, Date.prototype.toISOString) : function(date) { // Adapted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString return date.getUTCFullYear() + '-' + twoDigits( date.getUTCMonth() + 1 ) + '-' + twoDigits( date.getUTCDate() ) + 'T' + twoDigits( date.getUTCHours() ) + ':' + twoDigits( date.getUTCMinutes() ) + ':' + twoDigits( date.getUTCSeconds() ) + '.' + String( (date.getUTCMilliseconds()/1000).toFixed(3) ).slice( 2, 5 ) + 'Z'; }; /** * Use this class to convert JSON strings to JavaScript objects * `(Json.parse)` and also to do the opposite operation `(Json.stringify)`. * Internally, the standard JSON implementation is used if available * Otherwise, the functions mimic the standard implementation. * * Here's how to produce JSON from an existing object: * * Ink.requireModules(['Ink.Util.Json_1'], function (Json) { * var obj = { * key1: 'value1', * key2: 'value2', * keyArray: ['arrayValue1', 'arrayValue2', 'arrayValue3'] * }; * Json.stringify(obj); // The above object as a JSON string * }); * * And here is how to parse JSON: * * Ink.requireModules(['Ink.Util.Json_1'], function (Json) { * var source = '{"key": "value", "array": [true, null, false]}'; * Json.parse(source); // The above JSON string as an object * }); * @class Ink.Util.Json * @static * */ var InkJson = { _nativeJSON: window.JSON || null, _convertToUnicode: false, // Escape characters so as to embed them in JSON strings _escape: function (theString) { var _m = { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"': '\\"', '\\': '\\\\' }; if (/["\\\x00-\x1f]/.test(theString)) { theString = theString.replace(/([\x00-\x1f\\"])/g, function(a, b) { var c = _m[b]; if (c) { return c; } c = b.charCodeAt(); return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); }); } return theString; }, // A character conversion map _toUnicode: function (theString) { if(!this._convertToUnicode) { return this._escape(theString); } else { var unicodeString = ''; var inInt = false; var theUnicode = false; var i = 0; var total = theString.length; while(i < total) { inInt = theString.charCodeAt(i); if( (inInt >= 32 && inInt <= 126) || //(inInt >= 48 && inInt <= 57) || //(inInt >= 65 && inInt <= 90) || //(inInt >= 97 && inInt <= 122) || inInt === 8 || inInt === 9 || inInt === 10 || inInt === 12 || inInt === 13 || inInt === 32 || inInt === 34 || inInt === 47 || inInt === 58 || inInt === 92) { if(inInt === 34 || inInt === 92 || inInt === 47) { theUnicode = '\\'+theString.charAt(i); } else if(inInt === 8) { theUnicode = '\\b'; } else if(inInt === 9) { theUnicode = '\\t'; } else if(inInt === 10) { theUnicode = '\\n'; } else if(inInt === 12) { theUnicode = '\\f'; } else if(inInt === 13) { theUnicode = '\\r'; } else { theUnicode = theString.charAt(i); } } else { if(this._convertToUnicode) { theUnicode = theString.charCodeAt(i).toString(16)+''.toUpperCase(); while (theUnicode.length < 4) { theUnicode = '0' + theUnicode; } theUnicode = '\\u' + theUnicode; } else { theUnicode = theString.charAt(i); } } unicodeString += theUnicode; i++; } return unicodeString; } }, _stringifyValue: function(param) { if (typeof param === 'string') { return '"' + this._toUnicode(param) + '"'; } else if (typeof param === 'number' && (isNaN(param) || !isFinite(param))) { // Unusable numbers go null return 'null'; } else if (typeof param === 'undefined' || param === null) { // And so does undefined return 'null'; } else if (typeof param.toJSON === 'function') { var t = param.toJSON(); if (typeof t === 'string') { return '"' + this._escape(t) + '"'; } else { return this._escape(t.toString()); } } else if (typeof param === 'number' || typeof param === 'boolean') { // These ones' toString methods return valid JSON. return '' + param; } else if (typeof param === 'function') { return 'null'; // match JSON.stringify } else if (param.constructor === Date) { return '"' + this._escape(dateToISOString(param)) + '"'; } else if (param.constructor === Array) { var arrayString = ''; for (var i = 0, len = param.length; i < len; i++) { if (i > 0) { arrayString += ','; } arrayString += this._stringifyValue(param[i]); } return '[' + arrayString + ']'; } else { // Object var objectString = ''; for (var k in param) { if ({}.hasOwnProperty.call(param, k)) { if (objectString !== '') { objectString += ','; } objectString += '"' + this._escape(k) + '": ' + this._stringifyValue(param[k]); } } return '{' + objectString + '}'; } }, /** * serializes a JSON object into a string. * * @method stringify * @param {Object} input Data to be serialized into JSON * @param {Boolean} convertToUnicode When `true`, converts string contents to unicode \uXXXX * @return {String} serialized string * * @example * Json.stringify({a:1.23}); // -> string: '{"a": 1.23}' */ stringify: function(input, convertToUnicode) { this._convertToUnicode = !!convertToUnicode; if(!this._convertToUnicode && this._nativeJSON) { return this._nativeJSON.stringify(input); } return this._stringifyValue(input); // And recurse. }, /** * @method parse * @param text {String} Input string * @param reviver {Function} Function receiving `(key, value)`, and `this`=(containing object), used to walk objects. * * @example * Simple example: * * Json.parse('{"a": "3","numbers":false}', * function (key, value) { * if (!this.numbers && key === 'a') { * return "NO NUMBERS"; * } else { * return value; * } * }); // -> object: {a: 'NO NUMBERS', numbers: false} */ /* From https://github.com/douglascrockford/JSON-js/blob/master/json.js */ parse: function (text, reviver) { /*jshint evil:true*/ // The parse method takes a text and an optional reviver function, and returns // a JavaScript value if the text is a valid JSON text. var j; function walk(holder, key) { // The walk method is used to recursively walk the resulting structure so // that modifications can be made. var k, v, value = holder[key]; if (value && typeof value === 'object') { for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v; } else { delete value[k]; } } } } return reviver.call(holder, key, value); } // Parsing happens in four stages. In the first stage, we replace certain // Unicode characters with escape sequences. JavaScript handles many characters // incorrectly, either silently deleting them, or treating them as line endings. text = String(text); cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function (a) { return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }); } // In the second stage, we run the text against regular expressions that look // for non-JSON patterns. We are especially concerned with '()' and 'new' // because they can cause invocation, and '=' because it can cause mutation. // But just to be safe, we want to reject all unexpected forms. // We split the second stage into 4 regexp operations in order to work around // crippling inefficiencies in IE's and Safari's regexp engines. First we // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we // replace all simple value tokens with ']' characters. Third, we delete all // open brackets that follow a colon or comma or that begin the text. Finally, // we look to see that the remaining characters are only whitespace or ']' or // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. if (/^[\],:{}\s]*$/ .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { // In the third stage we use the eval function to compile the text into a // JavaScript structure. The '{' operator is subject to a syntactic ambiguity // in JavaScript: it can begin a block or an object literal. We wrap the text // in parens to eliminate the ambiguity. j = eval('(' + text + ')'); // In the optional fourth stage, we recursively walk the new structure, passing // each name/value pair to a reviver function for possible transformation. return typeof reviver === 'function' ? walk({'': j}, '') : j; } // If the text is not JSON parseable, then a SyntaxError is thrown. throw new SyntaxError('JSON.parse'); } }; return InkJson; }); /** * @module Ink.Util.String_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.Util.String', '1', [], function() { 'use strict'; /** * String Manipulation Utilities * * @class Ink.Util.String * @version 1 * @static */ var InkUtilString = { /** * List of special chars * * @property _chars * @type {Array} * @private * @readOnly * @static */ _chars: ['&','à','á','â','ã','ä','å','æ','ç','è','é', 'ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô', 'õ','ö','ø','ù','ú','û','ü','ý','þ','ÿ','À', 'Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë', 'Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö', 'Ø','Ù','Ú','Û','Ü','Ý','Þ','€','\"','ß','<', '>','¢','£','¤','¥','¦','§','¨','©','ª','«', '¬','\xad','®','¯','°','±','²','³','´','µ','¶', '·','¸','¹','º','»','¼','½','¾'], /** * List of the special characters' html entities * * @property _entities * @type {Array} * @private * @readOnly * @static */ _entities: ['amp','agrave','aacute','acirc','atilde','auml','aring', 'aelig','ccedil','egrave','eacute','ecirc','euml','igrave', 'iacute','icirc','iuml','eth','ntilde','ograve','oacute', 'ocirc','otilde','ouml','oslash','ugrave','uacute','ucirc', 'uuml','yacute','thorn','yuml','Agrave','Aacute','Acirc', 'Atilde','Auml','Aring','AElig','Ccedil','Egrave','Eacute', 'Ecirc','Euml','Igrave','Iacute','Icirc','Iuml','ETH','Ntilde', 'Ograve','Oacute','Ocirc','Otilde','Ouml','Oslash','Ugrave', 'Uacute','Ucirc','Uuml','Yacute','THORN','euro','quot','szlig', 'lt','gt','cent','pound','curren','yen','brvbar','sect','uml', 'copy','ordf','laquo','not','shy','reg','macr','deg','plusmn', 'sup2','sup3','acute','micro','para','middot','cedil','sup1', 'ordm','raquo','frac14','frac12','frac34'], /** * List of accented chars * * @property _accentedChars * @type {Array} * @private * @readOnly * @static */ _accentedChars:['à','á','â','ã','ä','å', 'è','é','ê','ë', 'ì','í','î','ï', 'ò','ó','ô','õ','ö', 'ù','ú','û','ü', 'ç','ñ', 'À','Á','Â','Ã','Ä','Å', 'È','É','Ê','Ë', 'Ì','Í','Î','Ï', 'Ò','Ó','Ô','Õ','Ö', 'Ù','Ú','Û','Ü', 'Ç','Ñ'], /** * List of the accented chars (above), but without the accents * * @property _accentedRemovedChars * @type {Array} * @private * @readOnly * @static */ _accentedRemovedChars:['a','a','a','a','a','a', 'e','e','e','e', 'i','i','i','i', 'o','o','o','o','o', 'u','u','u','u', 'c','n', 'A','A','A','A','A','A', 'E','E','E','E', 'I','I','I','I', 'O','O','O','O','O', 'U','U','U','U', 'C','N'], /** * Object that contains the basic HTML unsafe chars, as keys, and their HTML entities as values * * @property _htmlUnsafeChars * @type {Object} * @private * @readOnly * @static */ _htmlUnsafeChars:{'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;',"'":'&apos;'}, /** * Convert first letter of a word to upper case <br /> * If param as more than one word, it converts first letter of all words that have more than 2 letters * * @method ucFirst * @param {String} string * @param {Boolean} [firstWordOnly=false] capitalize only first word. * @return {String} string camel cased * @public * @static * * @example * InkString.ucFirst('hello world'); // -> 'Hello World' * InkString.ucFirst('hello world', true); // -> 'Hello world' */ ucFirst: function(string, firstWordOnly) { var replacer = firstWordOnly ? /(^|\s)(\w)(\S{2,})/ : /(^|\s)(\w)(\S{2,})/g; return string ? String(string).replace(replacer, function(_, $1, $2, $3){ return $1 + $2.toUpperCase() + $3.toLowerCase(); }) : string; }, /** * Remove spaces and new line from biggin and ends of string * * @method trim * @param {String} string * @return {String} string trimmed * @public * @static */ trim: function(string) { if (typeof string === 'string') { return string.replace(/^\s+|\s+$|\n+$/g, ''); } return string; }, /** * Removes HTML tags of string * * @method stripTags * @param {String} string * @param {String} allowed * @return {String} String stripped from HTML tags, leaving only the allowed ones (if any) * @public * @static * @example * <script> * var myvar='isto e um texto <b>bold</b> com imagem <img src=""> e br <br /> um <p>paragrafo</p>'; * SAPO.Utility.String.stripTags(myvar, 'b,u'); * </script> */ stripTags: function(string, allowed) { if (allowed && typeof allowed === 'string') { var aAllowed = InkUtilString.trim(allowed).split(','); var aNewAllowed = []; var cleanedTag = false; for(var i=0; i < aAllowed.length; i++) { if(InkUtilString.trim(aAllowed[i]) !== '') { cleanedTag = InkUtilString.trim(aAllowed[i].replace(/(<|\>)/g, '').replace(/\s/, '')); aNewAllowed.push('(<'+cleanedTag+'\\s[^>]+>|<(\\s|\\/)?(\\s|\\/)?'+cleanedTag+'>)'); } } var strAllowed = aNewAllowed.join('|'); var reAllowed = new RegExp(strAllowed, "i"); var aFoundTags = string.match(new RegExp("<[^>]*>", "g")); for(var j=0; j < aFoundTags.length; j++) { if(!aFoundTags[j].match(reAllowed)) { string = string.replace((new RegExp(aFoundTags[j], "gm")), ''); } } return string; } else { return string.replace(/<[^\>]+\>/g, ''); } }, /** * Convert listed characters to HTML entities * * @method htmlEntitiesEncode * @param {String} string * @return {String} string encoded * @public * @static */ htmlEntitiesEncode: function(string) { if (string && string.replace) { var re = false; for (var i = 0; i < InkUtilString._chars.length; i++) { re = new RegExp(InkUtilString._chars[i], "gm"); string = string.replace(re, '&' + InkUtilString._entities[i] + ';'); } } return string; }, /** * Convert listed HTML entities to character * * @method htmlEntitiesDecode * @param {String} string * @return {String} string decoded * @public * @static */ htmlEntitiesDecode: function(string) { if (string && string.replace) { var re = false; for (var i = 0; i < InkUtilString._entities.length; i++) { re = new RegExp("&"+InkUtilString._entities[i]+";", "gm"); string = string.replace(re, InkUtilString._chars[i]); } string = string.replace(/&#[^;]+;?/g, function($0){ if ($0.charAt(2) === 'x') { return String.fromCharCode(parseInt($0.substring(3), 16)); } else { return String.fromCharCode(parseInt($0.substring(2), 10)); } }); } return string; }, /** * Encode a string to UTF8 * * @method utf8Encode * @param {String} string * @return {String} string utf8 encoded * @public * @static */ utf8Encode: function(string) { /*jshint bitwise:false*/ string = string.replace(/\r\n/g,"\n"); var utfstring = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utfstring += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utfstring += String.fromCharCode((c >> 6) | 192); utfstring += String.fromCharCode((c & 63) | 128); } else { utfstring += String.fromCharCode((c >> 12) | 224); utfstring += String.fromCharCode(((c >> 6) & 63) | 128); utfstring += String.fromCharCode((c & 63) | 128); } } return utfstring; }, /** * Make a string shorter without cutting words * * @method shortString * @param {String} str * @param {Number} n - number of chars of the short string * @return {String} string shortened * @public * @static */ shortString: function(str,n) { var words = str.split(' '); var resultstr = ''; for(var i = 0; i < words.length; i++ ){ if((resultstr + words[i] + ' ').length>=n){ resultstr += '&hellip;'; break; } resultstr += words[i] + ' '; } return resultstr; }, /** * Truncates a string, breaking words and adding ... at the end * * @method truncateString * @param {String} str * @param {Number} length - length limit for the string. String will be * at most this big, ellipsis included. * @return {String} string truncated * @public * @static */ truncateString: function(str, length) { if(str.length - 1 > length) { return str.substr(0, length - 1) + "\u2026"; } else { return str; } }, /** * Decode a string from UTF8 * * @method utf8Decode * @param {String} string * @return {String} string utf8 decoded * @public * @static */ utf8Decode: function(utfstring) { /*jshint bitwise:false*/ var string = ""; var i = 0, c = 0, c2 = 0, c3 = 0; while ( i < utfstring.length ) { c = utfstring.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if((c > 191) && (c < 224)) { c2 = utfstring.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utfstring.charCodeAt(i+1); c3 = utfstring.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; }, /** * Convert all accented chars to char without accent. * * @method removeAccentedChars * @param {String} string * @return {String} string without accented chars * @public * @static */ removeAccentedChars: function(string) { var newString = string; var re = false; for (var i = 0; i < InkUtilString._accentedChars.length; i++) { re = new RegExp(InkUtilString._accentedChars[i], "gm"); newString = newString.replace(re, '' + InkUtilString._accentedRemovedChars[i] + ''); } return newString; }, /** * Count the number of occurrences of a specific needle in a haystack * * @method substrCount * @param {String} haystack * @param {String} needle * @return {Number} Number of occurrences * @public * @static */ substrCount: function(haystack,needle) { return haystack ? haystack.split(needle).length - 1 : 0; }, /** * Eval a JSON string to a JS object * * @method evalJSON * @param {String} strJSON * @param {Boolean} sanitize * @return {Object} JS Object * @public * @static */ evalJSON: function(strJSON, sanitize) { /* jshint evil:true */ if( (typeof sanitize === 'undefined' || sanitize === null) || InkUtilString.isJSON(strJSON)) { try { if(typeof(JSON) !== "undefined" && typeof(JSON.parse) !== 'undefined'){ return JSON.parse(strJSON); } return eval('('+strJSON+')'); } catch(e) { throw new Error('ERROR: Bad JSON string...'); } } }, /** * Checks if a string is a valid JSON object (string encoded) * * @method isJSON * @param {String} str * @return {Boolean} * @public * @static */ isJSON: function(str) { str = str.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); }, /** * Escapes unsafe html chars to their entities * * @method htmlEscapeUnsafe * @param {String} str String to escape * @return {String} Escaped string * @public * @static */ htmlEscapeUnsafe: function(str){ var chars = InkUtilString._htmlUnsafeChars; return str !== null ? String(str).replace(/[<>&'"]/g,function(c){return chars[c];}) : str; }, /** * Normalizes whitespace in string. * String is trimmed and sequences of many * Whitespaces are collapsed. * * @method normalizeWhitespace * @param {String} str String to normalize * @return {String} string normalized * @public * @static */ normalizeWhitespace: function(str){ return str !== null ? InkUtilString.trim(String(str).replace(/\s+/g,' ')) : str; }, /** * Converts string to unicode * * @method toUnicode * @param {String} str * @return {String} string unicoded * @public * @static */ toUnicode: function(str) { if (typeof str === 'string') { var unicodeString = ''; var inInt = false; var theUnicode = false; var total = str.length; var i=0; while(i < total) { inInt = str.charCodeAt(i); if( (inInt >= 32 && inInt <= 126) || inInt === 8 || inInt === 9 || inInt === 10 || inInt === 12 || inInt === 13 || inInt === 32 || inInt === 34 || inInt === 47 || inInt === 58 || inInt === 92) { /* if(inInt == 34 || inInt == 92 || inInt == 47) { theUnicode = '\\'+str.charAt(i); } else { } */ if(inInt === 8) { theUnicode = '\\b'; } else if(inInt === 9) { theUnicode = '\\t'; } else if(inInt === 10) { theUnicode = '\\n'; } else if(inInt === 12) { theUnicode = '\\f'; } else if(inInt === 13) { theUnicode = '\\r'; } else { theUnicode = str.charAt(i); } } else { theUnicode = str.charCodeAt(i).toString(16)+''.toUpperCase(); while (theUnicode.length < 4) { theUnicode = '0' + theUnicode; } theUnicode = '\\u' + theUnicode; } unicodeString += theUnicode; i++; } return unicodeString; } }, /** * Escapes a unicode character. returns \xXX if hex smaller than 0x100, otherwise \uXXXX * * @method escape * @param {String} c Char * @return {String} escaped char * @public * @static */ /** * @param {String} c char */ escape: function(c) { var hex = (c).charCodeAt(0).toString(16).split(''); if (hex.length < 3) { while (hex.length < 2) { hex.unshift('0'); } hex.unshift('x'); } else { while (hex.length < 4) { hex.unshift('0'); } hex.unshift('u'); } hex.unshift('\\'); return hex.join(''); }, /** * Unescapes a unicode character escape sequence * * @method unescape * @param {String} es Escape sequence * @return {String} String des-unicoded * @public * @static */ unescape: function(es) { var idx = es.lastIndexOf('0'); idx = idx === -1 ? 2 : Math.min(idx, 2); //console.log(idx); var hexNum = es.substring(idx); //console.log(hexNum); var num = parseInt(hexNum, 16); return String.fromCharCode(num); }, /** * Escapes a string to unicode characters * * @method escapeText * @param {String} txt * @param {Array} [whiteList] * @return {String} Escaped to Unicoded string * @public * @static */ escapeText: function(txt, whiteList) { if (whiteList === undefined) { whiteList = ['[', ']', '\'', ',']; } var txt2 = []; var c, C; for (var i = 0, f = txt.length; i < f; ++i) { c = txt[i]; C = c.charCodeAt(0); if (C < 32 || C > 126 && whiteList.indexOf(c) === -1) { c = InkUtilString.escape(c); } txt2.push(c); } return txt2.join(''); }, /** * Regex to check escaped strings * * @property escapedCharRegex * @type {Regex} * @public * @readOnly * @static */ escapedCharRegex: /(\\x[0-9a-fA-F]{2})|(\\u[0-9a-fA-F]{4})/g, /** * Unescapes a string * * @method unescapeText * @param {String} txt * @return {String} Unescaped string * @public * @static */ unescapeText: function(txt) { /*jshint boss:true */ var m; while (m = InkUtilString.escapedCharRegex.exec(txt)) { m = m[0]; txt = txt.replace(m, InkUtilString.unescape(m)); InkUtilString.escapedCharRegex.lastIndex = 0; } return txt; }, /** * Compares two strings * * @method strcmp * @param {String} str1 * @param {String} str2 * @return {Number} * @public * @static */ strcmp: function(str1, str2) { return ((str1 === str2) ? 0 : ((str1 > str2) ? 1 : -1)); }, /** * Splits long string into string of, at most, maxLen (that is, all but last have length maxLen, * last can measure maxLen or less) * * @method packetize * @param {String} string string to divide * @param {Number} maxLen packet size * @return {Array} string divided * @public * @static */ packetize: function(str, maxLen) { var len = str.length; var parts = new Array( Math.ceil(len / maxLen) ); var chars = str.split(''); var sz, i = 0; while (len) { sz = Math.min(maxLen, len); parts[i++] = chars.splice(0, sz).join(''); len -= sz; } return parts; } }; return InkUtilString; }); /** * @module Ink.Util.Url_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.Util.Url', '1', [], function() { 'use strict'; /** * Utility functions to use with URLs * * @class Ink.Util.Url * @version 1 * @static */ var Url = { /** * Auxiliary string for encoding * * @property _keyStr * @type {String} * @readOnly * @private */ _keyStr : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', /** * Get current URL of page * * @method getUrl * @return {String} Current URL * @public * @static * @example * Ink.requireModules(['Ink.Util.Url_1'], function( InkUrl ){ * console.log( InkUrl.getUrl() ); // Will return it's window URL * }); */ getUrl: function() { return window.location.href; }, /** * Generates an uri with query string based on the parameters object given * * @method genQueryString * @param {String} uri * @param {Object} params * @return {String} URI with query string set * @public * @static * @example * Ink.requireModules(['Ink.Util.Url_1'], function( InkUrl ){ * var queryString = InkUrl.genQueryString( 'http://www.sapo.pt/', { * 'param1': 'valueParam1', * 'param2': 'valueParam2' * }); * * console.log( queryString ); // Result: http://www.sapo.pt/?param1=valueParam1&param2=valueParam2 * }); */ genQueryString: function(uri, params) { var hasQuestionMark = uri.indexOf('?') !== -1; var sep, pKey, pValue, parts = [uri]; for (pKey in params) { if (params.hasOwnProperty(pKey)) { if (!hasQuestionMark) { sep = '?'; hasQuestionMark = true; } else { sep = '&'; } pValue = params[pKey]; if (typeof pValue !== 'number' && !pValue) { pValue = ''; } parts = parts.concat([sep, encodeURIComponent(pKey), '=', encodeURIComponent(pValue)]); } } return parts.join(''); }, /** * Get query string of current or passed URL * * @method getQueryString * @param {String} [str] URL String. When not specified it uses the current URL. * @return {Object} Key-Value object with the pairs variable: value * @public * @static * @example * Ink.requireModules(['Ink.Util.Url_1'], function( InkUrl ){ * var queryStringParams = InkUrl.getQueryString( 'http://www.sapo.pt/?var1=valueVar1&var2=valueVar2' ); * console.log( queryStringParams ); * // Result: * // { * // var1: 'valueVar1', * // var2: 'valueVar2' * // } * }); */ getQueryString: function(str) { var url; if(str && typeof(str) !== 'undefined') { url = str; } else { url = this.getUrl(); } var aParams = {}; if(url.match(/\?(.+)/i)) { var queryStr = url.replace(/^(.*)\?([^\#]+)(\#(.*))?/g, "$2"); if(queryStr.length > 0) { var aQueryStr = queryStr.split(/[;&]/); for(var i=0; i < aQueryStr.length; i++) { var pairVar = aQueryStr[i].split('='); aParams[decodeURIComponent(pairVar[0])] = (typeof(pairVar[1]) !== 'undefined' && pairVar[1]) ? decodeURIComponent(pairVar[1]) : false; } } } return aParams; }, /** * Get URL hash * * @method getAnchor * @param {String} [str] URL String. If not set, it will get the current URL. * @return {String|Boolean} Hash in the URL. If there's no hash, returns false. * @public * @static * @example * Ink.requireModules(['Ink.Util.Url_1'], function( InkUrl ){ * var anchor = InkUrl.getAnchor( 'http://www.sapo.pt/page.php#TEST' ); * console.log( anchor ); // Result: TEST * }); */ getAnchor: function(str) { var url; if(str && typeof(str) !== 'undefined') { url = str; } else { url = this.getUrl(); } var anchor = false; if(url.match(/#(.+)/)) { anchor = url.replace(/([^#]+)#(.*)/, "$2"); } return anchor; }, /** * Get anchor string of current or passed URL * * @method getAnchorString * @param {String} [string] If not provided it uses the current URL. * @return {Object} Returns a key-value object of the 'variables' available in the hashtag of the URL * @public * @static * @example * Ink.requireModules(['Ink.Util.Url_1'], function( InkUrl ){ * var hashParams = InkUrl.getAnchorString( 'http://www.sapo.pt/#var1=valueVar1&var2=valueVar2' ); * console.log( hashParams ); * // Result: * // { * // var1: 'valueVar1', * // var2: 'valueVar2' * // } * }); */ getAnchorString: function(string) { var url; if(string && typeof(string) !== 'undefined') { url = string; } else { url = this.getUrl(); } var aParams = {}; if(url.match(/#(.+)/i)) { var anchorStr = url.replace(/^([^#]+)#(.*)?/g, "$2"); if(anchorStr.length > 0) { var aAnchorStr = anchorStr.split(/[;&]/); for(var i=0; i < aAnchorStr.length; i++) { var pairVar = aAnchorStr[i].split('='); aParams[decodeURIComponent(pairVar[0])] = (typeof(pairVar[1]) !== 'undefined' && pairVar[1]) ? decodeURIComponent(pairVar[1]) : false; } } } return aParams; }, /** * Parse passed URL * * @method parseUrl * @param {String} url URL to be parsed * @return {Object} Parsed URL as a key-value object. * @public * @static * @example * Ink.requireModules(['Ink.Util.Url_1'], function( InkUrl ){ * var parsedURL = InkUrl.parseUrl( 'http://www.sapo.pt/index.html?var1=value1#anchor' ) * console.log( parsedURL ); * // Result: * // { * // 'scheme' => 'http', * // 'host' => 'www.sapo.pt', * // 'path' => '/index.html', * // 'query' => 'var1=value1', * // 'fragment' => 'anchor' * // } * }); * */ parseUrl: function(url) { var aURL = {}; if(url && typeof url === 'string') { if(url.match(/^([^:]+):\/\//i)) { var re = /^([^:]+):\/\/([^\/]*)\/?([^\?#]*)\??([^#]*)#?(.*)/i; if(url.match(re)) { aURL.scheme = url.replace(re, "$1"); aURL.host = url.replace(re, "$2"); aURL.path = '/'+url.replace(re, "$3"); aURL.query = url.replace(re, "$4") || false; aURL.fragment = url.replace(re, "$5") || false; } } else { var re1 = new RegExp("^([^\\?]+)\\?([^#]+)#(.*)", "i"); var re2 = new RegExp("^([^\\?]+)\\?([^#]+)#?", "i"); var re3 = new RegExp("^([^\\?]+)\\??", "i"); if(url.match(re1)) { aURL.scheme = false; aURL.host = false; aURL.path = url.replace(re1, "$1"); aURL.query = url.replace(re1, "$2"); aURL.fragment = url.replace(re1, "$3"); } else if(url.match(re2)) { aURL.scheme = false; aURL.host = false; aURL.path = url.replace(re2, "$1"); aURL.query = url.replace(re2, "$2"); aURL.fragment = false; } else if(url.match(re3)) { aURL.scheme = false; aURL.host = false; aURL.path = url.replace(re3, "$1"); aURL.query = false; aURL.fragment = false; } } if(aURL.host) { var regPort = /^(.*?)\\:(\\d+)$/i; // check for port if(aURL.host.match(regPort)) { var tmpHost1 = aURL.host; aURL.host = tmpHost1.replace(regPort, "$1"); aURL.port = tmpHost1.replace(regPort, "$2"); } else { aURL.port = false; } // check for user and pass if(aURL.host.match(/@/i)) { var tmpHost2 = aURL.host; aURL.host = tmpHost2.split('@')[1]; var tmpUserPass = tmpHost2.split('@')[0]; if(tmpUserPass.match(/\:/)) { aURL.user = tmpUserPass.split(':')[0]; aURL.pass = tmpUserPass.split(':')[1]; } else { aURL.user = tmpUserPass; aURL.pass = false; } } } } return aURL; }, /** * Take a URL object from Ink.Util.Url.parseUrl or a window.location * object and returns a URL string. * * @method format * @param urlObj window.location, a.href, or parseUrl object to format * @return {String} Full URL. */ format: function (urlObj) { var protocol = ''; var host = ''; var path = ''; var frag = ''; var query = ''; if (typeof urlObj.protocol === 'string') { protocol = urlObj.protocol + '//'; // here it comes with the colon } else if (typeof urlObj.scheme === 'string') { protocol = urlObj.scheme + '://'; } host = urlObj.host || urlObj.hostname || ''; path = urlObj.path || ''; if (typeof urlObj.query === 'string') { query = urlObj.query; } else if (typeof urlObj.search === 'string') { query = urlObj.search.replace(/^\?/, ''); } if (typeof urlObj.fragment === 'string') { frag = urlObj.fragment; } else if (typeof urlObj.hash === 'string') { frag = urlObj.hash.replace(/#$/, ''); } return [ protocol, host, path, query && '?' + query, frag && '#' + frag ].join(''); }, /** * Get last loaded script element * * @method currentScriptElement * @param {String} [match] String to match against the script src attribute * @return {DOMElement|Boolean} Returns the <script> DOM Element or false if unable to find it. * @public * @static */ currentScriptElement: function(match) { var aScripts = document.getElementsByTagName('script'); if(typeof(match) === 'undefined') { if(aScripts.length > 0) { return aScripts[(aScripts.length - 1)]; } else { return false; } } else { var curScript = false; var re = new RegExp(""+match+"", "i"); for(var i=0, total = aScripts.length; i < total; i++) { curScript = aScripts[i]; if(re.test(curScript.src)) { return curScript; } } return false; } }, /* base64Encode: function(string) { /** * --function {String} ? * --Convert a string to BASE 64 * @param {String} string - string to convert * @return base64 encoded string * * if(!SAPO.Utility.String || typeof(SAPO.Utility.String) === 'undefined') { throw "SAPO.Utility.Url.base64Encode depends of SAPO.Utility.String, which has not been referred."; } var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; var input = SAPO.Utility.String.utf8Encode(string); while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); } return output; }, base64Decode: function(string) { * --function {String} ? * Decode a BASE 64 encoded string * --param {String} string base64 encoded string * --return string decoded if(!SAPO.Utility.String || typeof(SAPO.Utility.String) === 'undefined') { throw "SAPO.Utility.Url.base64Decode depends of SAPO.Utility.String, which has not been referred."; } var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; var input = string.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) { enc1 = this._keyStr.indexOf(input.charAt(i++)); enc2 = this._keyStr.indexOf(input.charAt(i++)); enc3 = this._keyStr.indexOf(input.charAt(i++)); enc4 = this._keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 !== 64) { output = output + String.fromCharCode(chr2); } if (enc4 !== 64) { output = output + String.fromCharCode(chr3); } } output = SAPO.Utility.String.utf8Decode(output); return output; }, */ /** * Debug function ? * * @method _debug * @private * @static */ _debug: function() {} }; return Url; }); /** * @module Ink.Util.Validator_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.Util.Validator', '1', [], function() { 'use strict'; /** * Set of functions to provide validation * * @class Ink.Util.Validator * @version 1 * @static */ var Validator = { /** * List of country codes avaible for isPhone function * * @property _countryCodes * @type {Array} * @private * @static * @readOnly */ _countryCodes : [ 'AO', 'CV', 'MZ', 'PT' ], /** * International number for portugal * * @property _internacionalPT * @type {Number} * @private * @static * @readOnly * */ _internacionalPT: 351, /** * List of all portuguese number prefixes * * @property _indicativosPT * @type {Object} * @private * @static * @readOnly * */ _indicativosPT: { 21: 'lisboa', 22: 'porto', 231: 'mealhada', 232: 'viseu', 233: 'figueira da foz', 234: 'aveiro', 235: 'arganil', 236: 'pombal', 238: 'seia', 239: 'coimbra', 241: 'abrantes', 242: 'ponte de sôr', 243: 'santarém', 244: 'leiria', 245: 'portalegre', 249: 'torres novas', 251: 'valença', 252: 'vila nova de famalicão', 253: 'braga', 254: 'peso da régua', 255: 'penafiel', 256: 'são joão da madeira', 258: 'viana do castelo', 259: 'vila real', 261: 'torres vedras', 262: 'caldas da raínha', 263: 'vila franca de xira', 265: 'setúbal', 266: 'évora', 268: 'estremoz', 269: 'santiago do cacém', 271: 'guarda', 272: 'castelo branco', 273: 'bragança', 274: 'proença-a-nova', 275: 'covilhã', 276: 'chaves', 277: 'idanha-a-nova', 278: 'mirandela', 279: 'moncorvo', 281: 'tavira', 282: 'portimão', 283: 'odemira', 284: 'beja', 285: 'moura', 286: 'castro verde', 289: 'faro', 291: 'funchal, porto santo', 292: 'corvo, faial, flores, horta, pico', 295: 'angra do heroísmo, graciosa, são jorge, terceira', 296: 'ponta delgada, são miguel, santa maria', 91 : 'rede móvel 91 (Vodafone / Yorn)', 93 : 'rede móvel 93 (Optimus)', 96 : 'rede móvel 96 (TMN)', 92 : 'rede móvel 92 (TODOS)', //925 : 'rede móvel 925 (TMN 925)', //926 : 'rede móvel 926 (TMN 926)', //927 : 'rede móvel 927 (TMN 927)', //922 : 'rede móvel 922 (Phone-ix)', 707: 'número único', 760: 'número único', 800: 'número grátis', 808: 'chamada local', 30: 'voip' }, /** * International number for Cabo Verde * * @property _internacionalCV * @type {Number} * @private * @static * @readOnly */ _internacionalCV: 238, /** * List of all Cabo Verde number prefixes * * @property _indicativosCV * @type {Object} * @private * @static * @readOnly */ _indicativosCV: { 2: 'fixo', 91: 'móvel 91', 95: 'móvel 95', 97: 'móvel 97', 98: 'móvel 98', 99: 'móvel 99' }, /** * International number for angola * * @property _internacionalAO * @type {Number} * @private * @static * @readOnly */ _internacionalAO: 244, /** * List of all Angola number prefixes * * @property _indicativosAO * @type {Object} * @private * @static * @readOnly */ _indicativosAO: { 2: 'fixo', 91: 'móvel 91', 92: 'móvel 92' }, /** * International number for mozambique * * @property _internacionalMZ * @type {Number} * @private * @static * @readOnly */ _internacionalMZ: 258, /** * List of all Mozambique number prefixes * * @property _indicativosMZ * @type {Object} * @private * @static * @readOnly */ _indicativosMZ: { 2: 'fixo', 82: 'móvel 82', 84: 'móvel 84' }, /** * International number for Timor * * @property _internacionalTL * @type {Number} * @private * @static * @readOnly */ _internacionalTL: 670, /** * List of all Timor number prefixes * * @property _indicativosTL * @type {Object} * @private * @static * @readOnly */ _indicativosTL: { 3: 'fixo', 7: 'móvel 7' }, /** * Regular expression groups for several groups of characters * * http://en.wikipedia.org/wiki/C0_Controls_and_Basic_Latin * http://en.wikipedia.org/wiki/Plane_%28Unicode%29#Basic_Multilingual_Plane * http://en.wikipedia.org/wiki/ISO_8859-1 * * @property _characterGroups * @type {Object} * @private * @static * @readOnly */ _characterGroups: { numbers: ['0-9'], asciiAlpha: ['a-zA-Z'], latin1Alpha: ['a-zA-Z', '\u00C0-\u00FF'], unicodeAlpha: ['a-zA-Z', '\u00C0-\u00FF', '\u0100-\u1FFF', '\u2C00-\uD7FF'], /* whitespace characters */ space: [' '], dash: ['-'], underscore: ['_'], nicknamePunctuation: ['_.-'], singleLineWhitespace: ['\t '], newline: ['\n'], whitespace: ['\t\n\u000B\f\r\u00A0 '], asciiPunctuation: ['\u0021-\u002F', '\u003A-\u0040', '\u005B-\u0060', '\u007B-\u007E'], latin1Punctuation: ['\u0021-\u002F', '\u003A-\u0040', '\u005B-\u0060', '\u007B-\u007E', '\u00A1-\u00BF', '\u00D7', '\u00F7'], unicodePunctuation: ['\u0021-\u002F', '\u003A-\u0040', '\u005B-\u0060', '\u007B-\u007E', '\u00A1-\u00BF', '\u00D7', '\u00F7', '\u2000-\u206F', '\u2E00-\u2E7F', '\u3000-\u303F'] }, /** * Create a regular expression for several character groups. * * @method createRegExp * * @param Groups... {Object} * Groups to build regular expressions for. Possible keys are: * * - **numbers**: 0-9 * - **asciiAlpha**: a-z, A-Z * - **latin1Alpha**: asciiAlpha, plus printable characters in latin-1 * - **unicodeAlpha**: unicode alphanumeric characters. * - **space**: ' ', the space character. * - **dash**: dash character. * - **underscore**: underscore character. * - **nicknamePunctuation**: dash, dot, underscore * - **singleLineWhitespace**: space and tab (whitespace which only spans one line). * - **newline**: newline character ('\n') * - **whitespace**: whitespace characters in the ASCII character set. * - **asciiPunctuation**: punctuation characters in the ASCII character set. * - **latin1Punctuation**: punctuation characters in latin-1. * - **unicodePunctuation**: punctuation characters in unicode. * */ createRegExp: function (groups) { var re = '^['; for (var key in groups) if (groups.hasOwnProperty(key)) { if (!(key in Validator._characterGroups)) { throw new Error('group ' + key + ' is not a valid character group'); } else if (groups[key]) { re += Validator._characterGroups[key].join(''); } } return new RegExp(re + ']*?$'); }, /** * Checks if a field has the required groups. Takes an options object for further configuration. * * @method checkCharacterGroups * @param {String} s The validation string * @param {Object} [groups={}] What groups are included. * @param [options.*] See createRegexp */ checkCharacterGroups: function (s, groups) { return Validator.createRegExp(groups).test(s); }, /** * Checks whether a field contains unicode printable characters. Takes an * options object for further configuration * * @method unicode * @param {String} s The validation string * @param {Object} [options={}] Optional configuration object * @param [options.*] See createRegexp */ unicode: function (s, options) { return Validator.checkCharacterGroups(s, Ink.extendObj({ unicodeAlpha: true}, options)); }, /** * Checks that a field only contains only latin-1 alphanumeric * characters. Takes options for allowing singleline whitespace, * cross-line whitespace and punctuation. * * @method latin1 * * @param {String} s The validation string * @param {Object} [options={}] Optional configuration object * @param [options.*] See createRegexp */ latin1: function (s, options) { return Validator.checkCharacterGroups(s, Ink.extendObj({ latin1Alpha: true}, options)); }, /** * Checks that a field only contains only ASCII alphanumeric * characters. Takes options for allowing singleline whitespace, * cross-line whitespace and punctuation. * * @method ascii * * @param {String} s The validation string * @param {Object} [options={}] Optional configuration object * @param [options.*] See createRegexp */ ascii: function (s, options) { return Validator.checkCharacterGroups(s, Ink.extendObj({ asciiAlpha: true}, options)); }, /** * Checks that the number is a valid number * * @method number * @param {String} numb The number * @param {Object} [options] Further options * @param [options.decimalSep='.'] Allow decimal separator. * @param [options.thousandSep=","] Strip this character from the number. * @param [options.negative=false] Allow negative numbers. * @param [options.decimalPlaces=null] Maximum number of decimal places. Use `0` for an integer number. * @param [options.max=null] Maximum number * @param [options.min=null] Minimum number * @param [options.returnNumber=false] When this option is true, return the number itself when the value is valid. */ number: function (numb, inOptions) { numb = numb + ''; var options = Ink.extendObj({ decimalSep: '.', thousandSep: '', negative: true, decimalPlaces: null, maxDigits: null, max: null, min: null, returnNumber: false }, inOptions || {}); // smart recursion thing sets up aliases for options. if (options.thousandSep) { numb = numb.replace(new RegExp('\\' + options.thousandSep, 'g'), ''); options.thousandSep = ''; return Validator.number(numb, options); } if (options.negative === false) { options.min = 0; options.negative = true; return Validator.number(numb, options); } if (options.decimalSep !== '.') { numb = numb.replace(new RegExp('\\' + options.decimalSep, 'g'), '.'); } if (!/^(-)?(\d+)?(\.\d+)?$/.test(numb) || numb === '') { return false; // forbidden character found } var split; if (options.decimalSep && numb.indexOf(options.decimalSep) !== -1) { split = numb.split(options.decimalSep); if (options.decimalPlaces !== null && split[1].length > options.decimalPlaces) { return false; } } else { split = ['' + numb, '']; } if (options.maxDigits!== null) { if (split[0].replace(/-/g, '').length > options.maxDigits) { return split; } } // Now look at the actual float var ret = parseFloat(numb); if (options.maxExcl !== null && ret >= options.maxExcl || options.minExcl !== null && ret <= options.minExcl) { return false; } if (options.max !== null && ret > options.max || options.min !== null && ret < options.min) { return false; } if (options.returnNumber) { return ret; } else { return true; } }, /** * Checks if a year is Leap "Bissexto" * * @method _isLeapYear * @param {Number} year Year to be checked * @return {Boolean} True if it is a leap year. * @private * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator._isLeapYear( 2004 ) ); // Result: true * console.log( InkValidator._isLeapYear( 2006 ) ); // Result: false * }); */ _isLeapYear: function(year){ var yearRegExp = /^\d{4}$/; if(yearRegExp.test(year)){ return ((year%4) ? false: ((year%100) ? true : ((year%400)? false : true)) ); } return false; }, /** * Object with the date formats available for validation * * @property _dateParsers * @type {Object} * @private * @static * @readOnly */ _dateParsers: { 'yyyy-mm-dd': {day:5, month:3, year:1, sep: '-', parser: /^(\d{4})(\-)(\d{1,2})(\-)(\d{1,2})$/}, 'yyyy/mm/dd': {day:5, month:3, year:1, sep: '/', parser: /^(\d{4})(\/)(\d{1,2})(\/)(\d{1,2})$/}, 'yy-mm-dd': {day:5, month:3, year:1, sep: '-', parser: /^(\d{2})(\-)(\d{1,2})(\-)(\d{1,2})$/}, 'yy/mm/dd': {day:5, month:3, year:1, sep: '/', parser: /^(\d{2})(\/)(\d{1,2})(\/)(\d{1,2})$/}, 'dd-mm-yyyy': {day:1, month:3, year:5, sep: '-', parser: /^(\d{1,2})(\-)(\d{1,2})(\-)(\d{4})$/}, 'dd/mm/yyyy': {day:1, month:3, year:5, sep: '/', parser: /^(\d{1,2})(\/)(\d{1,2})(\/)(\d{4})$/}, 'dd-mm-yy': {day:1, month:3, year:5, sep: '-', parser: /^(\d{1,2})(\-)(\d{1,2})(\-)(\d{2})$/}, 'dd/mm/yy': {day:1, month:3, year:5, sep: '/', parser: /^(\d{1,2})(\/)(\d{1,2})(\/)(\d{2})$/} }, /** * Calculates the number of days in a given month of a given year * * @method _daysInMonth * @param {Number} _m - month (1 to 12) * @param {Number} _y - year * @return {Number} Returns the number of days in a given month of a given year * @private * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator._daysInMonth( 2, 2004 ) ); // Result: 29 * console.log( InkValidator._daysInMonth( 2, 2006 ) ); // Result: 28 * }); */ _daysInMonth: function(_m,_y){ var nDays=0; _m = parseInt(_m, 10); _y = parseInt(_y, 10); if(_m===1 || _m===3 || _m===5 || _m===7 || _m===8 || _m===10 || _m===12) { nDays= 31; } else if ( _m===4 || _m===6 || _m===9 || _m===11) { nDays = 30; } else if (_m===2) { if((_y%400===0) || (_y%4===0 && _y%100!==0)) { nDays = 29; } else { nDays = 28; } } return nDays; }, /** * Checks if a date is valid * * @method _isValidDate * @param {Number} year * @param {Number} month * @param {Number} day * @return {Boolean} True if it's a valid date * @private * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator._isValidDate( 2004, 2, 29 ) ); // Result: true * console.log( InkValidator._isValidDate( 2006, 2, 29 ) ); // Result: false * }); */ _isValidDate: function(year, month, day){ var yearRegExp = /^\d{4}$/; var validOneOrTwo = /^\d{1,2}$/; if(yearRegExp.test(year) && validOneOrTwo.test(month) && validOneOrTwo.test(day)){ if(month>=1 && month<=12 && day>=1 && this._daysInMonth(month,year)>=day){ return true; } } return false; }, /** * Checks if a email is valid * * @method mail * @param {String} email * @return {Boolean} True if it's a valid e-mail * @public * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator.email( 'agfsdfgfdsgdsf' ) ); // Result: false * console.log( InkValidator.email( 'inkdev\u0040sapo.pt' ) ); // Result: true (where \u0040 is at sign) * }); */ email: function(email) { var emailValido = new RegExp("^[_a-z0-9-]+((\\.|\\+)[_a-z0-9-]+)*@([\\w]*-?[\\w]*\\.)+[a-z]{2,4}$", "i"); if(!emailValido.test(email)) { return false; } else { return true; } }, /** * Deprecated. Alias for email(). Use it instead. * * @method mail * @public * @static */ mail: function (mail) { return Validator.email(mail); }, /** * Checks if a url is valid * * @method url * @param {String} url URL to be checked * @param {Boolean} [full] If true, validates a full URL (one that should start with 'http') * @return {Boolean} True if the given URL is valid * @public * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator.url( 'www.sapo.pt' ) ); // Result: true * console.log( InkValidator.url( 'http://www.sapo.pt', true ) ); // Result: true * console.log( InkValidator.url( 'meh' ) ); // Result: false * }); */ url: function(url, full) { if(typeof full === "undefined" || full === false) { var reHTTP = new RegExp("(^(http\\:\\/\\/|https\\:\\/\\/)(.+))", "i"); if(reHTTP.test(url) === false) { url = 'http://'+url; } } var reUrl = new RegExp("^(http:\\/\\/|https:\\/\\/)([\\w]*(-?[\\w]*)*\\.)+[a-z]{2,4}", "i"); if(reUrl.test(url) === false) { return false; } else { return true; } }, /** * Checks if a phone is valid in Portugal * * @method isPTPhone * @param {Number} phone Phone number to be checked * @return {Boolean} True if it's a valid Portuguese Phone * @public * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator.isPTPhone( '213919264' ) ); // Result: true * console.log( InkValidator.isPTPhone( '00351213919264' ) ); // Result: true * console.log( InkValidator.isPTPhone( '+351213919264' ) ); // Result: true * console.log( InkValidator.isPTPhone( '1' ) ); // Result: false * }); */ isPTPhone: function(phone) { phone = phone.toString(); var aInd = []; for(var i in this._indicativosPT) { if(typeof(this._indicativosPT[i]) === 'string') { aInd.push(i); } } var strInd = aInd.join('|'); var re351 = /^(00351|\+351)/; if(re351.test(phone)) { phone = phone.replace(re351, ""); } var reSpecialChars = /(\s|\-|\.)+/g; phone = phone.replace(reSpecialChars, ''); //var reInt = new RegExp("\\d", "i"); var reInt = /[\d]{9}/i; if(phone.length === 9 && reInt.test(phone)) { var reValid = new RegExp("^("+strInd+")"); if(reValid.test(phone)) { return true; } } return false; }, /** * Alias function for isPTPhone * * @method isPortuguesePhone * @param {Number} phone Phone number to be checked * @return {Boolean} True if it's a valid Portuguese Phone * @public * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator.isPortuguesePhone( '213919264' ) ); // Result: true * console.log( InkValidator.isPortuguesePhone( '00351213919264' ) ); // Result: true * console.log( InkValidator.isPortuguesePhone( '+351213919264' ) ); // Result: true * console.log( InkValidator.isPortuguesePhone( '1' ) ); // Result: false * }); */ isPortuguesePhone: function(phone) { return this.isPTPhone(phone); }, /** * Checks if a phone is valid in Cabo Verde * * @method isCVPhone * @param {Number} phone Phone number to be checked * @return {Boolean} True if it's a valid Cape Verdean Phone * @public * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator.isCVPhone( '2610303' ) ); // Result: true * console.log( InkValidator.isCVPhone( '002382610303' ) ); // Result: true * console.log( InkValidator.isCVPhone( '+2382610303' ) ); // Result: true * console.log( InkValidator.isCVPhone( '1' ) ); // Result: false * }); */ isCVPhone: function(phone) { phone = phone.toString(); var aInd = []; for(var i in this._indicativosCV) { if(typeof(this._indicativosCV[i]) === 'string') { aInd.push(i); } } var strInd = aInd.join('|'); var re238 = /^(00238|\+238)/; if(re238.test(phone)) { phone = phone.replace(re238, ""); } var reSpecialChars = /(\s|\-|\.)+/g; phone = phone.replace(reSpecialChars, ''); //var reInt = new RegExp("\\d", "i"); var reInt = /[\d]{7}/i; if(phone.length === 7 && reInt.test(phone)) { var reValid = new RegExp("^("+strInd+")"); if(reValid.test(phone)) { return true; } } return false; }, /** * Checks if a phone is valid in Angola * * @method isAOPhone * @param {Number} phone Phone number to be checked * @return {Boolean} True if it's a valid Angolan Phone * @public * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator.isAOPhone( '244222396385' ) ); // Result: true * console.log( InkValidator.isAOPhone( '00244222396385' ) ); // Result: true * console.log( InkValidator.isAOPhone( '+244222396385' ) ); // Result: true * console.log( InkValidator.isAOPhone( '1' ) ); // Result: false * }); */ isAOPhone: function(phone) { phone = phone.toString(); var aInd = []; for(var i in this._indicativosAO) { if(typeof(this._indicativosAO[i]) === 'string') { aInd.push(i); } } var strInd = aInd.join('|'); var re244 = /^(00244|\+244)/; if(re244.test(phone)) { phone = phone.replace(re244, ""); } var reSpecialChars = /(\s|\-|\.)+/g; phone = phone.replace(reSpecialChars, ''); //var reInt = new RegExp("\\d", "i"); var reInt = /[\d]{9}/i; if(phone.length === 9 && reInt.test(phone)) { var reValid = new RegExp("^("+strInd+")"); if(reValid.test(phone)) { return true; } } return false; }, /** * Checks if a phone is valid in Mozambique * * @method isMZPhone * @param {Number} phone Phone number to be checked * @return {Boolean} True if it's a valid Mozambican Phone * @public * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator.isMZPhone( '21426861' ) ); // Result: true * console.log( InkValidator.isMZPhone( '0025821426861' ) ); // Result: true * console.log( InkValidator.isMZPhone( '+25821426861' ) ); // Result: true * console.log( InkValidator.isMZPhone( '1' ) ); // Result: false * }); */ isMZPhone: function(phone) { phone = phone.toString(); var aInd = []; for(var i in this._indicativosMZ) { if(typeof(this._indicativosMZ[i]) === 'string') { aInd.push(i); } } var strInd = aInd.join('|'); var re258 = /^(00258|\+258)/; if(re258.test(phone)) { phone = phone.replace(re258, ""); } var reSpecialChars = /(\s|\-|\.)+/g; phone = phone.replace(reSpecialChars, ''); //var reInt = new RegExp("\\d", "i"); var reInt = /[\d]{8,9}/i; if((phone.length === 9 || phone.length === 8) && reInt.test(phone)) { var reValid = new RegExp("^("+strInd+")"); if(reValid.test(phone)) { if(phone.indexOf('2') === 0 && phone.length === 8) { return true; } else if(phone.indexOf('8') === 0 && phone.length === 9) { return true; } } } return false; }, /** * Checks if a phone is valid in Timor * * @method isTLPhone * @param {Number} phone Phone number to be checked * @return {Boolean} True if it's a valid phone from Timor-Leste * @public * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator.isTLPhone( '6703331234' ) ); // Result: true * console.log( InkValidator.isTLPhone( '006703331234' ) ); // Result: true * console.log( InkValidator.isTLPhone( '+6703331234' ) ); // Result: true * console.log( InkValidator.isTLPhone( '1' ) ); // Result: false * }); */ isTLPhone: function(phone) { phone = phone.toString(); var aInd = []; for(var i in this._indicativosTL) { if(typeof(this._indicativosTL[i]) === 'string') { aInd.push(i); } } var strInd = aInd.join('|'); var re670 = /^(00670|\+670)/; if(re670.test(phone)) { phone = phone.replace(re670, ""); } var reSpecialChars = /(\s|\-|\.)+/g; phone = phone.replace(reSpecialChars, ''); //var reInt = new RegExp("\\d", "i"); var reInt = /[\d]{7}/i; if(phone.length === 7 && reInt.test(phone)) { var reValid = new RegExp("^("+strInd+")"); if(reValid.test(phone)) { return true; } } return false; }, /** * Validates the function in all country codes available or in the ones set in the second param * * @method isPhone * @param {String} phone number * @param {optional String|Array} country or array of countries to validate * @return {Boolean} True if it's a valid phone in any country available * @public * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator.isPhone( '6703331234' ) ); // Result: true * }); */ isPhone: function(){ var index; if(arguments.length===0){ return false; } var phone = arguments[0]; if(arguments.length>1){ if(arguments[1].constructor === Array){ var func; for(index=0; index<arguments[1].length; index++ ){ if(typeof(func=this['is' + arguments[1][index].toUpperCase() + 'Phone'])==='function'){ if(func(phone)){ return true; } } else { throw "Invalid Country Code!"; } } } else if(typeof(this['is' + arguments[1].toUpperCase() + 'Phone'])==='function'){ return this['is' + arguments[1].toUpperCase() + 'Phone'](phone); } else { throw "Invalid Country Code!"; } } else { for(index=0; index<this._countryCodes.length; index++){ if(this['is' + this._countryCodes[index] + 'Phone'](phone)){ return true; } } } return false; }, /** * Validates if a zip code is valid in Portugal * * @method codPostal * @param {Number|String} cp1 * @param {optional Number|String} cp2 * @param {optional Boolean} returnBothResults * @return {Boolean} True if it's a valid zip code * @public * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator.codPostal( '1069', '300' ) ); // Result: true * console.log( InkValidator.codPostal( '1069', '300', true ) ); // Result: [true, true] * }); * */ codPostal: function(cp1,cp2,returnBothResults){ var cPostalSep = /^(\s*\-\s*|\s+)$/; var trim = /^\s+|\s+$/g; var cPostal4 = /^[1-9]\d{3}$/; var cPostal3 = /^\d{3}$/; var parserCPostal = /^(.{4})(.*)(.{3})$/; returnBothResults = !!returnBothResults; cp1 = cp1.replace(trim,''); if(typeof(cp2)!=='undefined'){ cp2 = cp2.replace(trim,''); if(cPostal4.test(cp1) && cPostal3.test(cp2)){ if( returnBothResults === true ){ return [true, true]; } else { return true; } } } else { if(cPostal4.test(cp1) ){ if( returnBothResults === true ){ return [true,false]; } else { return true; } } var cPostal = cp1.match(parserCPostal); if(cPostal!==null && cPostal4.test(cPostal[1]) && cPostalSep.test(cPostal[2]) && cPostal3.test(cPostal[3])){ if( returnBothResults === true ){ return [true,false]; } else { return true; } } } if( returnBothResults === true ){ return [false,false]; } else { return false; } }, /** * Checks is a date is valid in a given format * * @method isDate * @param {String} format - defined in _dateParsers * @param {String} dateStr - date string * @return {Boolean} True if it's a valid date and in the specified format * @public * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator.isDate( 'yyyy-mm-dd', '2012-05-21' ) ); // Result: true * }); */ isDate: function(format, dateStr){ if(typeof(this._dateParsers[format])==='undefined'){ return false; } var yearIndex = this._dateParsers[format].year; var monthIndex = this._dateParsers[format].month; var dayIndex = this._dateParsers[format].day; var dateParser = this._dateParsers[format].parser; var separator = this._dateParsers[format].sep; /* Trim Deactivated * var trim = /^\w+|\w+$/g; * dateStr = dateStr.replace(trim,""); */ var data = dateStr.match(dateParser); if(data!==null){ /* Trim Deactivated * for(i=1;i<=data.length;i++){ * data[i] = data[i].replace(trim,""); *} */ if(data[2]===data[4] && data[2]===separator){ var _y = ((data[yearIndex].length===2) ? "20" + data[yearIndex].toString() : data[yearIndex] ); if(this._isValidDate(_y,data[monthIndex].toString(),data[dayIndex].toString())){ return true; } } } return false; }, /** * Checks if a string is a valid color * * @method isColor * @param {String} str Color string to be checked * @return {Boolean} True if it's a valid color string * @public * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator.isColor( '#FF00FF' ) ); // Result: true * console.log( InkValidator.isColor( 'amdafasfs' ) ); // Result: false * }); */ isColor: function(str){ var match, valid = false, keyword = /^[a-zA-Z]+$/, hexa = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, rgb = /^rgb\(\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*\)$/, rgba = /^rgba\(\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*,\s*(1(\.0)?|0(\.[0-9])?)\s*\)$/, hsl = /^hsl\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*\)$/, hsla = /^hsla\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*,\s*(1(\.0)?|0(\.[0-9])?)\s*\)$/; // rgb(123, 123, 132) 0 to 255 // rgb(123%, 123%, 123%) 0 to 100 // rgba( 4 vals) last val: 0 to 1.0 // hsl(0 to 360, %, %) // hsla( ..., 0 to 1.0) if( keyword.test(str) || hexa.test(str) ){ return true; } var i; // rgb range check if((match = rgb.exec(str)) !== null || (match = rgba.exec(str)) !== null){ i = match.length; while(i--){ // check percentage values if((i===2 || i===4 || i===6) && typeof match[i] !== "undefined" && match[i] !== ""){ if(typeof match[i-1] !== "undefined" && match[i-1] >= 0 && match[i-1] <= 100){ valid = true; } else { return false; } } // check 0 to 255 values if(i===1 || i===3 || i===5 && (typeof match[i+1] === "undefined" || match[i+1] === "")){ if(typeof match[i] !== "undefined" && match[i] >= 0 && match[i] <= 255){ valid = true; } else { return false; } } } } // hsl range check if((match = hsl.exec(str)) !== null || (match = hsla.exec(str)) !== null){ i = match.length; while(i--){ // check percentage values if(i===3 || i===5){ if(typeof match[i-1] !== "undefined" && typeof match[i] !== "undefined" && match[i] !== "" && match[i-1] >= 0 && match[i-1] <= 100){ valid = true; } else { return false; } } // check 0 to 360 value if(i===1){ if(typeof match[i] !== "undefined" && match[i] >= 0 && match[i] <= 360){ valid = true; } else { return false; } } } } return valid; }, /** * Checks if the value is a valid IP. Supports ipv4 and ipv6 * * @method validationFunctions.ip * @param {String} value Value to be checked * @param {String} ipType Type of IP to be validated. The values are: ipv4, ipv6. By default is ipv4. * @return {Boolean} True if the value is a valid IP address. False if not. */ isIP: function( value, ipType ){ if( typeof value !== 'string' ){ return false; } ipType = (ipType || 'ipv4').toLowerCase(); switch( ipType ){ case 'ipv4': return (/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/).test(value); case 'ipv6': return (/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/).test(value); default: return false; } }, /** * Credit Card specifications, to be used in the credit card verification. * * @property _creditCardSpecs * @type {Object} * @private */ _creditCardSpecs: { 'default': { 'length': '13,14,15,16,17,18,19', 'prefix': /^.+/, 'luhn': true }, 'american express': { 'length': '15', 'prefix': /^3[47]/, 'luhn' : true }, 'diners club': { 'length': '14,16', 'prefix': /^36|55|30[0-5]/, 'luhn' : true }, 'discover': { 'length': '16', 'prefix': /^6(?:5|011)/, 'luhn' : true }, 'jcb': { 'length': '15,16', 'prefix': /^3|1800|2131/, 'luhn' : true }, 'maestro': { 'length': '16,18', 'prefix': /^50(?:20|38)|6(?:304|759)/, 'luhn' : true }, 'mastercard': { 'length': '16', 'prefix': /^5[1-5]/, 'luhn' : true }, 'visa': { 'length': '13,16', 'prefix': /^4/, 'luhn' : true } }, /** * Luhn function, to be used when validating credit cards * */ _luhn: function (num){ num = parseInt(num,10); if ( (typeof num !== 'number') && (num % 1 !== 0) ){ // Luhn can only be used on nums! return false; } num = num+''; // Check num length var length = num.length; // Checksum of the card num var i, checksum = 0 ; for (i = length - 1; i >= 0; i -= 2) { // Add up every 2nd digit, starting from the right checksum += parseInt(num.substr(i, 1),10); } for (i = length - 2; i >= 0; i -= 2) { // Add up every 2nd digit doubled, starting from the right var dbl = parseInt(num.substr(i, 1) * 2,10); // Subtract 9 from the dbl where value is greater than 10 checksum += (dbl >= 10) ? (dbl - 9) : dbl; } // If the checksum is a multiple of 10, the number is valid return (checksum % 10 === 0); }, /** * Validates if a number is of a specific credit card * * @param {String} num Number to be validates * @param {String|Array} creditCardType Credit card type. See _creditCardSpecs for the list of supported values. * @return {Boolean} */ isCreditCard: function(num, creditCardType){ if ( /\d+/.test(num) === false ){ return false; } if ( typeof creditCardType === 'undefined' ){ creditCardType = 'default'; } else if ( creditCardType instanceof Array ){ var i, ccLength = creditCardType.length; for ( i=0; i < ccLength; i++ ){ // Test each type for validity if (this.isCreditCard(num, creditCardType[i]) ){ return true; } } return false; } // Check card type creditCardType = creditCardType.toLowerCase(); if ( typeof this._creditCardSpecs[creditCardType] === 'undefined' ){ return false; } // Check card number length var length = num.length+''; // Validate the card length by the card type if ( this._creditCardSpecs[creditCardType]['length'].split(",").indexOf(length) === -1 ){ return false; } // Check card number prefix if ( !this._creditCardSpecs[creditCardType]['prefix'].test(num) ){ return false; } // No Luhn check required if (this._creditCardSpecs[creditCardType]['luhn'] === false){ return true; } return this._luhn(num); } }; return Validator; }); /** * @module Ink.UI.Animate_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.Animate', 1, ['Ink.UI.Common_1', 'Ink.Dom.Event_1', 'Ink.Dom.Css_1'], function (Common, InkEvent, Css) { 'use strict'; var animationPrefix = (function (el) { return ('animationName' in el.style) ? 'animation' : ('oAnimationName' in el.style) ? 'oAnimation' : ('msAnimationName' in el.style) ? 'msAnimation' : ('webkitAnimationName' in el.style) ? 'webkitAnimation' : null; }(document.createElement('div'))); var animationEndEventName = { animation: 'animationend', oAnimation: 'oanimationend', msAnimation: 'MSAnimationEnd', webkitAnimation: 'webkitAnimationEnd' }[animationPrefix]; /** * @class Ink.UI.Animate_1 * @constructor * * @param element {DOMElement} animated element * @param options {Object} options object * @param options.animation {String} animation name * @param [options.duration=medium] {String|Number} duration name (fast|medium|slow) or duration in ms * @param [options.removeClass=true] {Boolean} Whether to remove the `animation` class when finished animating * @param [options.onEnd=null] {Function} callback for animation end * * @example * * <button id="animate-me" class="ink-button">Animate me!</button> * <span class="ink-label info ink-animate" * id="animated" * data-trigger="#animate-me" * data-animation="fadeOut" * data-removeClass="false">Hi!</span> * * <script type="text/javascript"> * // Note: this step is not necessary if you are using autoload.js * Ink.requireModules(['Ink.UI.Animate_1'], function (Animate) { * new Animate('#animated'); * }); * </script> * **/ function Animate(elOrSelector, options) { this._element = Common.elOrSelector(elOrSelector); this._options = Common.options({ trigger: ['Element', null], duration: ['String', 'slow'], // Actually a string with a duration name, or a number of ms animation: ['String'], removeClass: ['Boolean', true], onEnd: ['Function', function () {}] }, options || {}, this._element); if (!isNaN(parseInt(this._options.duration, 10))) { this._options.duration = parseInt(this._options.duration, 10); } if (this._options.trigger) { InkEvent.observe(this._options.trigger, 'click', Ink.bind(function () { this.animate(); }, this)); // later } else { this.animate(); } } Animate.prototype.animate = function () { Animate.animate(this._element, this._options.animation, this._options); }; Ink.extendObj(Animate, { /** * Prefix for CSS animation-related properties in this browser. * * @property _animationPrefix * @private **/ _animationPrefix: animationPrefix, /** * Whether CSS3 animation is supported in this browser. * * @property {Boolean} animationSupported **/ animationSupported: !!animationPrefix, /** * The correct event for the animationend event in this browser, with the correct prefix * * @property {String} animationEndEventName **/ animationEndEventName: animationEndEventName, /** * Animate a div using one of the animate.css classes * * **Note: This is a utility method inside the `Animate` class, which you can access through `Animate.animate()`. Do not mix these up.** * * @example * * Animate.animate(myDiv, 'shake', { * onEnd: function () { * alert('Finished shaking!'); * } * }); * * @static * @method animate * @param element {DOMElement} animated element * @param animation {String} animation name * @param [options] {Object} * @param [options.onEnd=null] {Function} callback for animation end * @param [options.removeClass=false] {Boolean} whether to remove the Css class when finished * @param [options.duration=medium] {String|Number} duration name (fast|medium|slow) or duration in ms **/ animate: function (element, animation, options) { element = Common.elOrSelector(element); if (typeof options === 'number' || typeof options === 'string') { options = { duration: options }; } if (typeof arguments[3] === 'function') { options.onEnd = arguments[3]; } if (typeof options.duration !== 'number' && typeof options.duration !== 'string') { options.duration = 400; } if (!Animate.animationSupported) { if (options.onEnd) { setTimeout(function () { options.onEnd(null); }, 0); } return; } if (typeof options.duration === 'number') { element.style[animationPrefix + 'Duration'] = options.duration + 'ms'; } else if (typeof options.duration === 'string') { Css.addClassName(element, options.duration); } Css.addClassName(element, ['animated', animation]); function onAnimationEnd(event) { if (event.target !== element) { return; } if (event.animationName !== animation) { return; } if (options.onEnd) { options.onEnd(event); } if (options.removeClass) { Css.removeClassName(element, animation); } if (typeof options.duration === 'string') { Css.removeClassName(element, options.duration); } element.removeEventListener(animationEndEventName, onAnimationEnd, false); } element.addEventListener(animationEndEventName, onAnimationEnd, false); } }); return Animate; }); /** * @module Ink.UI.Carousel_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.Carousel', '1', ['Ink.UI.Common_1', 'Ink.Dom.Event_1', 'Ink.Dom.Css_1', 'Ink.Dom.Element_1', 'Ink.UI.Pagination_1', 'Ink.Dom.Browser_1', 'Ink.Dom.Selector_1'], function(Common, InkEvent, Css, InkElement, Pagination, Browser/*, Selector*/) { 'use strict'; /* * TODO: * keyboardSupport */ function limitRange(n, min, max) { return Math.min(max, Math.max(min, n)); } var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (cb) {return setTimeout(cb, 1000 / 30); }; /** * @class Ink.UI.Carousel_1 * @constructor * * @param {String|DOMElement} selector * @param {Object} [options] * @param {Integer} [autoAdvance=0] The number of milliseconds to wait between auto-advancing pages. Set to 0 to disable auto-advance. * @param {String} [options.axis='x'] Can be `'x'` or `'y'`, for a horizontal or vertical carousel * @param {Boolean} [options.center=false] Center the carousel. * @param {Number} [options.initialPage=0] When initialized, set the page to this. * @TODO @param {Boolean} [options.keyboardSupport=false] Enable keyboard support * @param {Boolean} [options.swipe=true] Enable swipe support where available * @param {String|DOMElement|Ink.UI.Pagination_1} [options.pagination] Either an `<ul>` element to add pagination markup to, or an `Ink.UI.Pagination` instance to use. * @param {Function} [options.onChange] Callback for when the page is changed. */ var Carousel = function(selector, options) { this._handlers = { paginationChange: Ink.bindMethod(this, '_onPaginationChange'), windowResize: InkEvent.throttle(Ink.bindMethod(this, 'refit'), 200) }; InkEvent.observe(window, 'resize', this._handlers.windowResize); var element = this._element = Common.elOrSelector(selector, '1st argument'); var opts = this._options = Common.options({ autoAdvance: ['Integer', 0], axis: ['String', 'x'], initialPage: ['Integer', 0], hideLast: ['Boolean', false], center: ['Boolean', false], keyboardSupport:['Boolean', false], pagination: ['String', null], onChange: ['Function', null], swipe: ['Boolean', true] // TODO exponential swipe // TODO specify break point for next page when moving finger }, options || {}, element, this); this._isY = (opts.axis === 'y'); var ulEl = Ink.s('ul.stage', element); this._ulEl = ulEl; InkElement.removeTextNodeChildren(ulEl); this.refit(); // recalculate this._numPages if (this._isY) { // Override white-space: no-wrap which is only necessary to make sure horizontal stuff stays horizontal, but breaks stuff intended to be vertical. this._ulEl.style.whiteSpace = 'normal'; } if (opts.swipe) { InkEvent.observe(element, 'touchstart', Ink.bindMethod(this, '_onTouchStart')); InkEvent.observe(element, 'touchmove', Ink.bindMethod(this, '_onTouchMove')); InkEvent.observe(element, 'touchend', Ink.bindMethod(this, '_onTouchEnd')); } this._setUpPagination(); this._setUpAutoAdvance(); this._setUpHider(); }; Carousel.prototype = { /** * Measure the carousel once again, adjusting the involved elements' * sizes. Called automatically when the window resizes, in order to * cater for changes from responsive media queries, for instance. * * @method refit * @public */ refit: function() { var _isY = this._isY; var size = function (elm, perpendicular) { if (!perpendicular) { return InkElement.outerDimensions(elm)[_isY ? 1 : 0]; } else { return InkElement.outerDimensions(elm)[_isY ? 0 : 1]; } }; this._liEls = Ink.ss('li.slide', this._ulEl); var numSlides = this._liEls.length; var contRect = this._ulEl.getBoundingClientRect(); this._ctnLength = _isY ? contRect.bottom - contRect.top : contRect.right - contRect.left; this._elLength = size(this._liEls[0]); this._slidesPerPage = Math.floor( this._ctnLength / this._elLength ) || 1; var numPages = Math.ceil( numSlides / this._slidesPerPage ); var numPagesChanged = this._numPages !== numPages; this._numPages = numPages; this._deltaLength = this._slidesPerPage * this._elLength; this._center(); this._updateHider(); this._IE7(); if (this._pagination && numPagesChanged) { this._pagination.setSize(this._numPages); } this.setPage(limitRange(this.getPage(), 1, this._numPages)); }, _setUpPagination: function () { if (this._options.pagination) { if (Common.isDOMElement(this._options.pagination) || typeof this._options.pagination === 'string') { // if dom element or css selector string... this._pagination = new Pagination(this._options.pagination, { size: this._numPages, onChange: this._handlers.paginationChange }); } else { // assumes instantiated pagination this._pagination = this._options.pagination; this._pagination._options.onChange = this._handlers.paginationChange; this._pagination.setSize(this._numPages); } this._pagination.setCurrent(this._options.initialPage || 0); } else { this._currentPage = this._options.initialPage || 0; } }, _setUpAutoAdvance: function () { if (!this._options.autoAdvance) { return; } var self = this; setTimeout(function autoAdvance() { self.nextPage(true /* wrap */); setTimeout(autoAdvance, self._options.autoAdvance); }, this._options.autoAdvance); }, _setUpHider: function () { if (this._options.hideLast) { var hiderEl = InkElement.create('div', { className: 'hider', insertBottom: this._element }); hiderEl.style.position = 'absolute'; hiderEl.style[ this._isY ? 'left' : 'top' ] = '0'; // fix to top.. hiderEl.style[ this._isY ? 'right' : 'bottom' ] = '0'; // and bottom... hiderEl.style[ this._isY ? 'bottom' : 'right' ] = '0'; // and move to the end. this._hiderEl = hiderEl; } }, _center: function() { if (!this._options.center) { return; } var gap = Math.floor( (this._ctnLength - (this._elLength * this._slidesPerPage) ) / 2 ); var pad; if (this._isY) { pad = [gap, 'px 0']; } else { pad = ['0 ', gap, 'px']; } this._ulEl.style.padding = pad.join(''); }, _updateHider: function() { if (!this._hiderEl) { return; } if ((!this._pagination) || this._pagination.getCurrent() === 0) { var gap = Math.floor( this._ctnLength - (this._elLength * this._slidesPerPage) ); if (this._options.center) { gap /= 2; } this._hiderEl.style[ this._isY ? 'height' : 'width' ] = gap + 'px'; } else { this._hiderEl.style[ this._isY ? 'height' : 'width' ] = '0px'; } }, /** * Refit stuff for IE7 because it won't support inline-block. * * @method _IE7 * @private */ _IE7: function () { if (Browser.IE && '' + Browser.version.split('.')[0] === '7') { // var numPages = this._numPages; var slides = Ink.ss('li.slide', this._ulEl); var stl = function (prop, val) {slides[i].style[prop] = val; }; for (var i = 0, len = slides.length; i < len; i++) { stl('position', 'absolute'); stl(this._isY ? 'top' : 'left', (i * this._elLength) + 'px'); } } }, _onTouchStart: function (event) { if (event.touches.length > 1) { return; } this._swipeData = { x: InkEvent.pointerX(event), y: InkEvent.pointerY(event), lastUlPos: null }; var ulRect = this._ulEl.getBoundingClientRect(); this._swipeData.inUlX = this._swipeData.x - ulRect.left; this._swipeData.inUlY = this._swipeData.y - ulRect.top; setTransitionProperty(this._ulEl, 'none'); this._touchMoveIsFirstTouchMove = true; // event.preventDefault(); event.stopPropagation(); }, _onTouchMove: function (event) { if (event.touches.length > 1) { return; /* multitouch event, not my problem. */ } var pointerX = InkEvent.pointerX(event); var pointerY = InkEvent.pointerY(event); var deltaY = Math.abs(pointerY - this._swipeData.y); var deltaX = Math.abs(pointerX - this._swipeData.x); if (this._touchMoveIsFirstTouchMove) { this._touchMoveIsFirstTouchMove = undefined; this._scrolling = this._isY ? deltaX > deltaY : deltaY > deltaX ; if (!this._scrolling) { this._onAnimationFrame(); } } if (!this._scrolling && this._swipeData) { event.preventDefault(); this._swipeData.pointerPos = this._isY ? pointerY : pointerX; } event.stopPropagation(); }, _onAnimationFrame: function () { var swipeData = this._swipeData; if (!swipeData || this._scrolling || this._touchMoveIsFirstTouchMove) { return; } var elRect = this._element.getBoundingClientRect(); var newPos; if (!this._isY) { newPos = swipeData.pointerPos - swipeData.inUlX - elRect.left; } else { newPos = swipeData.pointerPos - swipeData.inUlY - elRect.top; } this._ulEl.style[this._isY ? 'top' : 'left'] = newPos + 'px'; swipeData.lastUlPos = newPos; requestAnimationFrame(Ink.bindMethod(this, '_onAnimationFrame')); }, _onTouchEnd: function (event) { if (this._swipeData && this._swipeData.pointerPos && !this._scrolling && !this._touchMoveIsFirstTouchMove) { var snapToNext = 0.1; // swipe 10% of the way to change page var progress = - this._swipeData.lastUlPos; var curPage = this._pagination.getCurrent(); var estimatedPage = progress / this._elLength / this._slidesPerPage; if (Math.round(estimatedPage) === curPage) { var diff = estimatedPage - curPage; if (Math.abs(diff) > snapToNext) { diff = diff > 0 ? 1 : -1; curPage += diff; } } else { curPage = Math.round(estimatedPage); } this.setPage(curPage); event.stopPropagation(); // event.preventDefault(); } setTransitionProperty(this._ulEl, null /* transition: left, top */); this._swipeData = null; this._touchMoveIsFirstTouchMove = undefined; this._scrolling = undefined; }, _onPaginationChange: function(pgn) { this._setPage(pgn.getCurrent()); }, /** * Get the currently displayed page. * @method getPage **/ getPage: function () { if (this._pagination) { return this._pagination.getCurrent(); } else { return this._currentPage; } }, /** * Set the current page to `page` * @method setPage * @param page * @param [wrap=false] Wrap over the first and last pages. (For example, going to the 5th page when there are only 4 pages goes to the 1st page) **/ setPage: function (page, wrap) { if (wrap) { // Pages outside the range [0..this._numPages] are wrapped. page = page % this._numPages; if (page < 0) { page = this._numPages - page; } } page = limitRange(page, 0, this._numPages - 1); if (this._pagination) { this._pagination.setCurrent(page); } else { this._setPage(page); } }, _setPage: function (page) { this._ulEl.style[ this._isY ? 'top' : 'left'] = ['-', page * this._deltaLength, 'px'].join(''); if (this._options.onChange) { this._options.onChange.call(this, page); } this._currentPage = page; this._updateHider(); }, /** * Change to the next page * @method nextPage * @param {Boolean} [wrap=false] If true, going to the page after the last page takes you to the first page. **/ nextPage: function (wrap) { this.setPage(this.getPage() + 1, wrap); }, /** * Change to the previous page * @method previousPage * @param {Boolean} [wrap=false] If true, going to the page after the last page takes you to the first page. **/ previousPage: function (wrap) { this.setPage(this.getPage() - 1, wrap); } }; function setTransitionProperty(el, newTransition) { el.style.transitionProperty = el.style.oTransitionProperty = el.style.msTransitionProperty = el.style.mozTransitionProperty = el.style.webkitTransitionProperty = newTransition; } return Carousel; }); /** * @module Ink.UI.Close_1 * @author inkdev AT sapo.pt */ Ink.createModule('Ink.UI.Close', '1', ['Ink.Dom.Event_1','Ink.Dom.Element_1'], function(InkEvent, InkElement) { 'use strict'; /** * Subscribes clicks on the document.body. If and only if you clicked on an element * having class "ink-close" or "ink-dismiss", will go up the DOM hierarchy looking for an element with any * of the following classes: "ink-alert", "ink-alert-block". * If it is found, it is removed from the DOM. * * One should call close once per page (full page refresh). * * @class Ink.UI.Close * @constructor * @example * <script> * Ink.requireModules(['Ink.UI.Close_1'],function( Close ){ * new Close(); * }); * </script> */ var Close = function() { InkEvent.observe(document.body, 'click', function(ev) { var el = InkEvent.element(ev); el = InkElement.findUpwardsByClass(el, 'ink-close') || InkElement.findUpwardsByClass(el, 'ink-dismiss'); if (!el) { return; // ink-close or ink-dismiss class not found } var toRemove = el; toRemove = InkElement.findUpwardsByClass(el, 'ink-alert') || InkElement.findUpwardsByClass(el, 'ink-alert-block'); if (toRemove) { InkEvent.stop(ev); InkElement.remove(toRemove); } }); }; return Close; }); /** * @module Ink.UI.Common_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.Common', '1', ['Ink.Dom.Element_1', 'Ink.Net.Ajax_1','Ink.Dom.Css_1','Ink.Dom.Selector_1','Ink.Util.Url_1'], function(InkElement, Ajax,Css,Selector,Url) { 'use strict'; var instances = {}; var lastIdNum = 0; var nothing = {} /* a marker, for reference comparison. */; var keys = Object.keys || function (obj) { var ret = []; for (var k in obj) if (obj.hasOwnProperty(k)) { ret.push(k); } return ret; }; /** * The Common class provides auxiliar methods to ease some of the most common/repetitive UI tasks. * * @class Ink.UI.Common * @version 1 * @static */ var Common = { /** * Supported Ink Layouts * * @property Layouts * @type Object * @readOnly */ Layouts: { SMALL: 'small', MEDIUM: 'medium', LARGE: 'large' }, /** * Method to check if an item is a valid DOM Element. * * @method isDOMElement * @static * @param {Mixed} o The object to be checked. * @return {Boolean} True if it's a valid DOM Element. * @example * var el = Ink.s('#element'); * if( Ink.UI.Common.isDOMElement( el ) === true ){ * // It is a DOM Element. * } else { * // It is NOT a DOM Element. * } */ isDOMElement: function(o) { return o && typeof o === 'object' && 'nodeType' in o && o.nodeType === 1; }, /** * Method to check if an item is a valid integer. * * @method isInteger * @static * @param {Mixed} n The value to be checked. * @return {Boolean} True if 'n' is a valid integer. * @example * var value = 1; * if( Ink.UI.Common.isInteger( value ) === true ){ * // It is an integer. * } else { * // It is NOT an integer. * } */ isInteger: function(n) { return (typeof n === 'number' && n % 1 === 0); }, /** * Method to get a DOM Element. The first parameter should be either a DOM Element or a valid CSS Selector. * If not, then it will throw an exception. Otherwise, it returns a DOM Element. * * @method elOrSelector * @static * @param {DOMElement|String} elOrSelector DOM Element or CSS Selector * @param {String} fieldName This field is used in the thrown Exception to identify the parameter. * @return {DOMElement} Returns the DOMElement passed or the first result of the CSS Selector. Otherwise it throws an exception. * @example * // In case there are several .myInput, it will retrieve the first found * var el = Ink.UI.Common.elOrSelector('.myInput','My Input'); */ elOrSelector: function(elOrSelector, fieldName) { if (!this.isDOMElement(elOrSelector)) { var t = Selector.select(elOrSelector); if (t.length === 0) { throw new TypeError(fieldName + ' must either be a DOM Element or a selector expression!\nThe script element must also be after the DOM Element itself.'); } return t[0]; } return elOrSelector; }, /** * Does the same as `elOrSelector` but returns an array of elements. * * see elOrSelector * * @method elsOrSelector * * @static * * @param ... (See elOrSelector's params) * @param {Boolean} required If true, accept an empty array as output. * @return {Array} The selected DOM Elements. * @example * var elements = Ink.UI.Common.elsOrSelector('input.my-inputs', 'My Input'); */ elsOrSelector: function(elsOrSelector, fieldName, required) { var ret; if (typeof elsOrSelector === 'string') { ret = Selector.select(elsOrSelector); } else if (Common.isDOMElement(elsOrSelector)) { ret = [elsOrSelector]; } else if (elsOrSelector && typeof elsOrSelector === 'object' && typeof elsOrSelector.length === 'number') { ret = elsOrSelector; } if (ret && ret.length) { return ret; } else { if (required || arguments.length === 2) { throw new TypeError(fieldName + ' must either be a DOM Element, an Array of elements, or a selector expression!\nThe script element must also be after the DOM Element itself.'); } else { return []; } } }, /** * Get options from an "options" object and the Element's data attributes. * * The element's data attributes take precedence. * * Values from the element's data-atrributes are coerced into the required type. * * Mainly for Ink UI.* modules * * @method options * * @param {Object} [fieldId=''] Tag used in thrown exceptions: "<fieldId>: ..." * @param {Object} defaults Object with arrays of option defaults * @param {Object} overrides Object containing options given from user through JavaScript * @param {DOMElement} [element] Element with data-attributes * * @example * * this._options = Ink.UI.Common.options('MyComponent', { * 'anobject': ['Object', null], // Defaults to null * 'target': ['Element', null], * 'stuff': ['Number', 0.1], * 'stuff2': ['Integer', 0], * 'doKickFlip': ['Boolean', false], * 'targets': ['Elements'], // Required option since no default was given * 'onClick': ['Function', null] * }, options || {}, elm) * * @example * * ### Note about booleans * * Here is how options are read from the markup * data-attributes, for several values`data-a-boolean`. * * Options considered true: * * - `data-a-boolean="true"` * - (Every other value which is not on the list below.) * * Options considered false: * * - `data-a-boolean="false"` * - `data-a-boolean=""` * - `data-a-boolean` * * Options which go to default: * * - (no attribute). When `data-a-boolean` is ommitted, the * option is not considered true nor false, and as such * defaults to what is in the `defaults` argument. * **/ options: function (fieldId, defaults, overrides, element) { if (typeof fieldId !== 'string') { element = overrides; overrides = defaults; defaults = fieldId; fieldId = ''; } overrides = overrides || {}; var out = {}; var dataAttrs = element ? InkElement.data(element) : {}; var fromDataAttrs; var type; var lType; var defaultVal; var invalidStr = function (str) { if (fieldId) { str = fieldId + ': "' + ('' + str).replace(/"/, '\\"') + '"'; } return str; }; var quote = function (str) { return '"' + ('' + str).replace(/"/, '\\"') + '"'; }; var invalidThrow = function (str) { throw new Error(invalidStr(str)); }; var invalid = function (str) { Ink.error(invalidStr(str) + '. Ignoring option.'); }; function optionValue(key) { type = defaults[key][0]; lType = type.toLowerCase(); defaultVal = defaults[key].length === 2 ? defaults[key][1] : nothing; if (!type) { invalidThrow('Ink.UI.Common.options: Always specify a type!'); } if (!(lType in Common._coerce_funcs)) { invalidThrow('Ink.UI.Common.options: ' + defaults[key][0] + ' is not a valid type. Use one of ' + keys(Common._coerce_funcs).join(', ')); } if (!defaults[key].length || defaults[key].length > 2) { invalidThrow('the "defaults" argument must be an object mapping option names to [typestring, optional] arrays.'); } if (key in dataAttrs) { fromDataAttrs = Common._coerce_from_string(lType, dataAttrs[key], key, fieldId); // (above can return `nothing`) } else { fromDataAttrs = nothing; } if (fromDataAttrs !== nothing) { if (!Common._options_validate(fromDataAttrs, lType)) { invalid('(' + key + ' option) Invalid ' + lType + ' ' + quote(fromDataAttrs)); return defaultVal; } else { return fromDataAttrs; } } else if (key in overrides) { return overrides[key]; } else if (defaultVal !== nothing) { return defaultVal; } else { invalidThrow('Option ' + key + ' is required!'); } } for (var key in defaults) { if (defaults.hasOwnProperty(key)) { out[key] = optionValue(key); } } return out; }, _coerce_from_string: function (type, val, paramName, fieldId) { if (type in Common._coerce_funcs) { return Common._coerce_funcs[type](val, paramName, fieldId); } else { return val; } }, _options_validate: function (val, type) { if (type in Common._options_validate_types) { return Common._options_validate_types[type].call(Common, val); } else { // 'object' options cannot be passed through data-attributes. // Json you say? Not any good to embed in HTML. return false; } }, _coerce_funcs: (function () { var ret = { element: function (val) { return Common.elOrSelector(val, ''); }, elements: function (val) { return Common.elsOrSelector(val, '', false /*not required, so don't throw an exception now*/); }, object: function (val) { return val; }, number: function (val) { return parseFloat(val); }, 'boolean': function (val) { return !(val === 'false' || val === '' || val === null); }, string: function (val) { return val; }, 'function': function (val, paramName, fieldId) { Ink.error(fieldId + ': You cannot specify the option "' + paramName + '" through data-attributes because it\'s a function'); return nothing; } }; ret['float'] = ret.integer = ret.number; return ret; }()), _options_validate_types: (function () { var types = { string: function (val) { return typeof val === 'string'; }, number: function (val) { return typeof val === 'number' && !isNaN(val) && isFinite(val); }, integer: function (val) { return val === Math.round(val); }, element: function (val) { return Common.isDOMElement(val); }, elements: function (val) { return val && typeof val === 'object' && typeof val.length === 'number' && val.length; }, 'boolean': function (val) { return typeof val === 'boolean'; } }; types['float'] = types.number; return types; }()), /** * Method to make a deep copy (clone) of an object. * Note: The object cannot have loops. * * @method clone * @static * @param {Object} o The object to be cloned/copied. * @return {Object} Returns the result of the clone/copy. * @example * var originalObj = { * key1: 'value1', * key2: 'value2', * key3: 'value3' * }; * var cloneObj = Ink.UI.Common.clone( originalObj ); */ clone: function(o) { try { return JSON.parse( JSON.stringify(o) ); } catch (ex) { throw new Error('Given object cannot have loops!'); } }, /** * Method to return the 'nth' position that an element occupies relatively to its parent. * * @method childIndex * @static * @param {DOMElement} childEl Valid DOM Element. * @return {Number} Numerical position of an element relatively to its parent. * @example * <!-- Imagine the following HTML: --> * <ul> * <li>One</li> * <li>Two</li> * <li id="test">Three</li> * <li>Four</li> * </ul> * * <script> * var testLi = Ink.s('#test'); * Ink.UI.Common.childIndex( testLi ); // Returned value: 3 * </script> */ childIndex: function(childEl) { if( Common.isDOMElement(childEl) ){ var els = Selector.select('> *', childEl.parentNode); for (var i = 0, f = els.length; i < f; ++i) { if (els[i] === childEl) { return i; } } } throw 'not found!'; }, /** * This method provides a more convenient way to do an async AJAX request and expect a JSON response. * It offers a callback option, as third paramenter, for a better async handling. * * @method ajaxJSON * @static * @async * @param {String} endpoint Valid URL to be used as target by the request. * @param {Object} params This field is used in the thrown Exception to identify the parameter. * @example * // In case there are several .myInput, it will retrieve the first found * var el = Ink.UI.Common.elOrSelector('.myInput','My Input'); */ ajaxJSON: function(endpoint, params, cb) { new Ajax( endpoint, { evalJS: 'force', method: 'POST', parameters: params, onSuccess: function( r) { try { r = r.responseJSON; if (r.status !== 'ok') { throw 'server error: ' + r.message; } cb(null, r); } catch (ex) { cb(ex); } }, onFailure: function() { cb('communication failure'); } } ); }, /** * Method to get the current Ink layout applied. * * @method currentLayout * @static * @return {String} 'small', 'medium' or 'large' * @example * var inkLayout = Ink.UI.Common.currentLayout(); * if (inkLayout === 'small') { * // ... * } */ currentLayout: function() { var i, f, k, v, el, detectorEl = Selector.select('#ink-layout-detector')[0]; if (!detectorEl) { detectorEl = document.createElement('div'); detectorEl.id = 'ink-layout-detector'; for (k in this.Layouts) { if (this.Layouts.hasOwnProperty(k)) { v = this.Layouts[k]; el = document.createElement('div'); el.className = 'show-' + v + ' hide-all'; el.setAttribute('data-ink-layout', v); detectorEl.appendChild(el); } } document.body.appendChild(detectorEl); } var result = ''; var resultCount = 0; for (i = 0, f = detectorEl.childNodes.length; i < f; ++i) { el = detectorEl.childNodes[i]; if (Css.getStyle(el, 'display') === 'block') { result = el.getAttribute('data-ink-layout'); resultCount += 1; } } if (resultCount === 1) { return result; } else { return 'large'; } }, /** * Method to set the location's hash (window.location.hash). * * @method hashSet * @static * @param {Object} o Object with the info to be placed in the location's hash. * @example * // It will set the location's hash like: <url>#key1=value1&key2=value2&key3=value3 * Ink.UI.Common.hashSet({ * key1: 'value1', * key2: 'value2', * key3: 'value3' * }); */ hashSet: function(o) { if (typeof o !== 'object') { throw new TypeError('o should be an object!'); } var hashParams = Url.getAnchorString(); hashParams = Ink.extendObj(hashParams, o); window.location.hash = Url.genQueryString('', hashParams).substring(1); }, /** * Method to remove children nodes from a given object. * This method was initially created to help solve a problem in Internet Explorer(s) that occurred when trying * to set the innerHTML of some specific elements like 'table'. * * @method cleanChildren * @static * @param {DOMElement} parentEl Valid DOM Element * @example * <!-- Imagine the following HTML: --> * <ul id="myUl"> * <li>One</li> * <li>Two</li> * <li>Three</li> * <li>Four</li> * </ul> * * <script> * Ink.UI.Common.cleanChildren( Ink.s( '#myUl' ) ); * </script> * * <!-- After running it, the HTML changes to: --> * <ul id="myUl"></ul> */ cleanChildren: function(parentEl) { if( !Common.isDOMElement(parentEl) ){ throw 'Please provide a valid DOMElement'; } var prevEl, el = parentEl.lastChild; while (el) { prevEl = el.previousSibling; parentEl.removeChild(el); el = prevEl; } }, /** * This method stores the id and/or the classes of a given element in a given object. * * @method storeIdAndClasses * @static * @param {DOMElement} fromEl Valid DOM Element to get the id and classes from. * @param {Object} inObj Object where the id and classes will be saved. * @example * <div id="myDiv" class="aClass"></div> * * <script> * var storageObj = {}; * Ink.UI.Common.storeIdAndClasses( Ink.s('#myDiv'), storageObj ); * // storageObj changes to: * { * _id: 'myDiv', * _classes: 'aClass' * } * </script> */ storeIdAndClasses: function(fromEl, inObj) { if( !Common.isDOMElement(fromEl) ){ throw 'Please provide a valid DOMElement as first parameter'; } var id = fromEl.id; if (id) { inObj._id = id; } var classes = fromEl.className; if (classes) { inObj._classes = classes; } }, /** * This method sets the id and className properties of a given DOM Element based on a given similar object * resultant of the previous function 'storeIdAndClasses'. * * @method restoreIdAndClasses * @static * @param {DOMElement} toEl Valid DOM Element to set the id and classes on. * @param {Object} inObj Object where the id and classes to be set are. * @example * <div></div> * * <script> * var storageObj = { * _id: 'myDiv', * _classes: 'aClass' * }; * * Ink.UI.Common.storeIdAndClasses( Ink.s('div'), storageObj ); * </script> * * <!-- After the code runs the div element changes to: --> * <div id="myDiv" class="aClass"></div> */ restoreIdAndClasses: function(toEl, inObj) { if( !Common.isDOMElement(toEl) ){ throw 'Please provide a valid DOMElement as first parameter'; } if (inObj._id && toEl.id !== inObj._id) { toEl.id = inObj._id; } if (inObj._classes && toEl.className.indexOf(inObj._classes) === -1) { if (toEl.className) { toEl.className += ' ' + inObj._classes; } else { toEl.className = inObj._classes; } } if (inObj._instanceId && !toEl.getAttribute('data-instance')) { toEl.setAttribute('data-instance', inObj._instanceId); } }, /** * This method saves a component's instance reference for later retrieval. * * @method registerInstance * @static * @param {Object} inst Object that holds the instance. * @param {DOMElement} el DOM Element to associate with the object. * @param {Object} [optionalPrefix] Defaults to 'instance' */ registerInstance: function(inst, el, optionalPrefix) { if (inst._instanceId) { return; } if (typeof inst !== 'object') { throw new TypeError('1st argument must be a JavaScript object!'); } if (inst._options && inst._options.skipRegister) { return; } if (!this.isDOMElement(el)) { throw new TypeError('2nd argument must be a DOM element!'); } if (optionalPrefix !== undefined && typeof optionalPrefix !== 'string') { throw new TypeError('3rd argument must be a string!'); } var id = (optionalPrefix || 'instance') + (++lastIdNum); instances[id] = inst; inst._instanceId = id; var dataInst = el.getAttribute('data-instance'); dataInst = (dataInst !== null) ? [dataInst, id].join(' ') : id; el.setAttribute('data-instance', dataInst); }, /** * This method deletes/destroy an instance with a given id. * * @method unregisterInstance * @static * @param {String} id Id of the instance to be destroyed. */ unregisterInstance: function(id) { delete instances[id]; }, /** * This method retrieves the registered instance(s) of a given element or instance id. * * @method getInstance * @static * @param {String|DOMElement} instanceIdOrElement Instance's id or DOM Element from which we want the instances. * @return {Object|Object[]} Returns an instance or a collection of instances. */ getInstance: function(instanceIdOrElement) { var ids; if (this.isDOMElement(instanceIdOrElement)) { ids = instanceIdOrElement.getAttribute('data-instance'); if (ids === null) { throw new Error('argument is not a DOM instance element!'); } } else { ids = instanceIdOrElement; } ids = ids.split(' '); var inst, id, i, l = ids.length; var res = []; for (i = 0; i < l; ++i) { id = ids[i]; if (!id) { throw new Error('Element is not a JS instance!'); } inst = instances[id]; if (!inst) { throw new Error('Instance "' + id + '" not found!'); } res.push(inst); } return (l === 1) ? res[0] : res; }, /** * This method retrieves the registered instance(s) of an element based on the given selector. * * @method getInstanceFromSelector * @static * @param {String} selector CSS selector to define the element from which it'll get the instance(s). * @return {Object|Object[]} Returns an instance or a collection of instances. */ getInstanceFromSelector: function(selector) { var el = Selector.select(selector)[0]; if (!el) { throw new Error('Element not found!'); } return this.getInstance(el); }, /** * This method retrieves the registered instances' ids of all instances. * * @method getInstanceIds * @static * @return {String[]} Id or collection of ids of all existing instances. */ getInstanceIds: function() { var res = []; for (var id in instances) { if (instances.hasOwnProperty(id)) { res.push( id ); } } return res; }, /** * This method retrieves all existing instances. * * @method getInstances * @static * @return {Object[]} Collection of existing instances. */ getInstances: function() { var res = []; for (var id in instances) { if (instances.hasOwnProperty(id)) { res.push( instances[id] ); } } return res; }, /** * This method is not to supposed to be invoked by the Common component. * Components should copy this method as its destroy method. * * @method destroyComponent * @static */ destroyComponent: function() { Common.unregisterInstance(this._instanceId); this._element.parentNode.removeChild(this._element); } }; return Common; }); /** * @module Ink.UI.DatePicker_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.DatePicker', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1','Ink.Util.Array_1','Ink.Util.Date_1', 'Ink.Dom.Browser_1'], function(Common, Event, Css, InkElement, Selector, InkArray, InkDate ) { 'use strict'; // Repeat a string. Long version of (new Array(n)).join(str); function strRepeat(n, str) { var ret = ''; for (var i = 0; i < n; i++) { ret += str; } return ret; } // Clamp a number into a min/max limit function clamp(n, min, max) { if (n > max) { n = max; } if (n < min) { n = min; } return n; } function dateishFromYMDString(YMD) { var split = YMD.split('-'); return dateishFromYMD(+split[0], +split[1] - 1, +split[2]); } function dateishFromYMD(year, month, day) { return {_year: year, _month: month, _day: day}; } function dateishFromDate(date) { return {_year: date.getFullYear(), _month: date.getMonth(), _day: date.getDate()}; } /** * @class Ink.UI.DatePicker * @constructor * @version 1 * * @param {String|DOMElement} selector * @param {Object} [options] Options * @param {Boolean} [options.autoOpen=false] set to `true` to automatically open the datepicker. * @param {String} [options.cleanText] text to display on clean button. defaults to 'Limpar' * @param {String} [options.closeText] text to display on close button. defaults to 'Fechar' * @param {String} [options.cssClass] CSS class to be applied to the datepicker * @param {String} [options.dateRange] enforce limits to year, month and day for the Date, ex: '1990-08-25:2020-11' * @param {Boolean} [options.displayInSelect] whether to display the component in a select. defaults to false. * @param {String|DOMElement} [options.dayField] (if using options.displayInSelect) `<select>` field with days. * @param {String|DOMElement} [options.monthField] (if using options.displayInSelect) `<select>` field with months. * @param {String|DOMElement} [options.yearField] (if using options.displayInSelect) `<select>` field with years. * @param {String} [options.format] Date format string * @param {String} [options.instance] unique id for the datepicker * @param {Object} [options.month] Hash of month names. Defaults to portuguese month names. January is 1. * @param {String} [options.nextLinkText] text to display on the previous button. defaults to '«' * @param {String} [options.ofText=' of '] text to display between month and year. defaults to ' de ' * @param {Boolean} [options.onFocus=true] if the datepicker should open when the target element is focused * @param {Function} [options.onMonthSelected] callback function to execute when the month is selected * @param {Function} [options.onSetDate] callback to execute when set date * @param {Function} [options.onYearSelected] callback function to execute when the year is selected * @param {String} [options.position] position the datepicker. Accept right or bottom, default is right * @param {String} [options.prevLinkText] text to display on the previous button. defaults to '«' * @param {Boolean} [options.showClean] whether to display the clean button or not. defaults to true. * @param {Boolean} [options.showClose] whether to display the close button or not. defaults to true. * @param {Boolean} [options.shy=true] whether the datepicker starts automatically. * @param {String} [options.startDate] Date to define init month. Must be in yyyy-mm-dd format * @param {Number} [options.startWeekDay] day to use as first column on the calendar view. Defaults to Monday (1) * @param {Function} [options.validYearFn] callback function to execute when 'rendering' the month (in the month view) * @param {Function} [options.validMonthFn] callback function to execute when 'rendering' the month (in the month view) * @param {Function} [options.validDayFn] callback function to execute when 'rendering' the day (in the month view) * @param {Function} [options.nextValidDateFn] Find the next valid date, given the current Date. Necessary when the calendar has a lot of "holes", and not many dates are valid and they are separated by many months or years so it doesn't make sense to have the user click the "next" button too many times and not see any valid date. * @param {Function} [options.prevValidDateFn] See nextValidDateFn. Find the previous valid date. * @param {Object} [options.wDay] Hash of weekdays. Defaults to portuguese month names. Sunday is 0. * @param {String} [options.yearRange] enforce limits to year for the Date, ex: '1990:2020' (deprecated) * * @example * <input type="text" id="dPicker" /> * <script> * Ink.requireModules(['Ink.Dom.Selector_1','Ink.UI.DatePicker_1'],function( Selector, DatePicker ){ * var datePickerElement = Ink.s('#dPicker'); * var datePickerObj = new DatePicker( datePickerElement ); * }); * </script> */ var DatePicker = function(selector, options) { this._element = selector && Common.elOrSelector(selector, '[Ink.UI.DatePicker_1]: selector argument'); this._options = Common.options('Ink.UI.DatePicker_1', { autoOpen: ['Boolean', false], cleanText: ['String', 'Clear'], closeText: ['String', 'Close'], containerElement:['Element', null], cssClass: ['String', 'ink-calendar bottom'], dateRange: ['String', null], // use this in a <select> displayInSelect: ['Boolean', false], dayField: ['Element', null], monthField: ['Element', null], yearField: ['Element', null], format: ['String', 'yyyy-mm-dd'], instance: ['String', 'scdp_' + Math.round(99999 * Math.random())], nextLinkText: ['String', '»'], ofText: ['String', ' of '], onFocus: ['Boolean', true], onMonthSelected: ['Function', null], onSetDate: ['Function', null], onYearSelected: ['Function', null], position: ['String', 'right'], prevLinkText: ['String', '«'], showClean: ['Boolean', true], showClose: ['Boolean', true], shy: ['Boolean', true], startDate: ['String', null], // format yyyy-mm-dd, startWeekDay: ['Number', 1], // Validation validDayFn: ['Function', null], validMonthFn: ['Function', null], validYearFn: ['Function', null], nextValidDateFn: ['Function', null], prevValidDateFn: ['Function', null], yearRange: ['String', null], // Text month: ['Object', { 1:'January', 2:'February', 3:'March', 4:'April', 5:'May', 6:'June', 7:'July', 8:'August', 9:'September', 10:'October', 11:'November', 12:'December' }], wDay: ['Object', { 0:'Sunday', 1:'Monday', 2:'Tuesday', 3:'Wednesday', 4:'Thursday', 5:'Friday', 6:'Saturday' }] }, options || {}, this._element); this._options.format = this._dateParsers[ this._options.format ] || this._options.format; this._hoverPicker = false; this._picker = this._options.pickerField && Common.elOrSelector(this._options.pickerField, 'pickerField'); this._setMinMax( this._options.dateRange || this._options.yearRange ); if(this._options.startDate) { this.setDate( this._options.startDate ); } else if (this._element && this._element.value) { this.setDate( this._element.value ); } else { var today = new Date(); this._day = today.getDate( ); this._month = today.getMonth( ); this._year = today.getFullYear( ); } if(this._options.displayInSelect && !(this._options.dayField && this._options.monthField && this._options.yearField)){ throw new Error( 'Ink.UI.DatePicker: displayInSelect option enabled.'+ 'Please specify dayField, monthField and yearField selectors.'); } this._init(); }; DatePicker.prototype = { version: '0.1', /** * Initialization function. Called by the constructor and * receives the same parameters. * * @method _init * @private */ _init: function(){ Ink.extendObj(this._options,this._lang || {}); this._render(); this._listenToContainerObjectEvents(); Common.registerInstance(this, this._containerObject, 'datePicker'); }, /** * Renders the DatePicker's markup * * @method _render * @private */ _render: function() { this._containerObject = document.createElement('div'); this._containerObject.id = this._options.instance; this._containerObject.className = this._options.cssClass + ' ink-datepicker-calendar hide-all'; this._renderSuperTopBar(); var calendarTop = document.createElement("div"); calendarTop.className = 'ink-calendar-top'; this._monthDescContainer = document.createElement("div"); this._monthDescContainer.className = 'ink-calendar-month_desc'; this._monthPrev = document.createElement('div'); this._monthPrev.className = 'ink-calendar-prev'; this._monthPrev.innerHTML ='<a href="#prev" class="change_month_prev">' + this._options.prevLinkText + '</a>'; this._monthNext = document.createElement('div'); this._monthNext.className = 'ink-calendar-next'; this._monthNext.innerHTML ='<a href="#next" class="change_month_next">' + this._options.nextLinkText + '</a>'; calendarTop.appendChild(this._monthPrev); calendarTop.appendChild(this._monthDescContainer); calendarTop.appendChild(this._monthNext); this._monthContainer = document.createElement("div"); this._monthContainer.className = 'ink-calendar-month'; this._containerObject.appendChild(calendarTop); this._containerObject.appendChild(this._monthContainer); this._monthSelector = this._renderMonthSelector(); this._containerObject.appendChild(this._monthSelector); this._yearSelector = document.createElement('ul'); this._yearSelector.className = 'ink-calendar-year-selector'; this._containerObject.appendChild(this._yearSelector); if(!this._options.onFocus || this._options.displayInSelect){ if(!this._options.pickerField){ this._picker = document.createElement('a'); this._picker.href = '#open_cal'; this._picker.innerHTML = 'open'; this._element.parentNode.appendChild(this._picker); this._picker.className = 'ink-datepicker-picker-field'; } else { this._picker = Common.elOrSelector(this._options.pickerField, 'pickerField'); } } this._appendDatePickerToDom(); this._renderMonth(); this._monthChanger = document.createElement('a'); this._monthChanger.href = '#monthchanger'; this._monthChanger.className = 'ink-calendar-link-month'; this._monthChanger.innerHTML = this._options.month[this._month + 1]; this._ofText = document.createElement('span'); this._ofText.innerHTML = this._options.ofText; this._yearChanger = document.createElement('a'); this._yearChanger.href = '#yearchanger'; this._yearChanger.className = 'ink-calendar-link-year'; this._yearChanger.innerHTML = this._year; this._monthDescContainer.innerHTML = ''; this._monthDescContainer.appendChild(this._monthChanger); this._monthDescContainer.appendChild(this._ofText); this._monthDescContainer.appendChild(this._yearChanger); if (!this._options.inline) { this._addOpenCloseEvents(); } else { this.show(); } this._addDateChangeHandlersToInputs(); }, _addDateChangeHandlersToInputs: function () { var fields = this._element; if (this._options.displayInSelect) { fields = [ this._options.dayField, this._options.monthField, this._options.yearField]; } Event.observeMulti(fields ,'change', Ink.bindEvent(function(){ this._updateDate( ); this._showDefaultView( ); this.setDate( ); if ( !this._inline && !this._hoverPicker ) { this._hide(true); } },this)); }, /** * Shows the calendar * * @method show **/ show: function () { this._updateDate(); this._renderMonth(); Css.removeClassName(this._containerObject, 'hide-all'); }, _addOpenCloseEvents: function () { var opener = this._picker || this._element; Event.observe(opener, 'click', Ink.bindEvent(function(e){ Event.stop(e); this.show(); },this)); if (this._options.autoOpen) { this.show(); } if(!this._options.displayInSelect){ Event.observe(opener, 'blur', Ink.bindEvent(function() { if ( !this._hoverPicker ) { this._hide(true); } },this)); } if (this._options.shy) { // Close the picker when clicking elsewhere. Event.observe(document,'click',Ink.bindEvent(function(e){ var target = Event.element(e); // "elsewhere" is outside any of these elements: var cannotBe = [ this._options.dayField, this._options.monthField, this._options.yearField, this._picker, this._element ]; for (var i = 0, len = cannotBe.length; i < len; i++) { if (cannotBe[i] && InkElement.descendantOf(cannotBe[i], target)) { return; } } this._hide(true); },this)); } }, /** * Create the markup of the view with months. * * @method _renderMonthSelector * @private */ _renderMonthSelector: function () { var selector = document.createElement('ul'); selector.className = 'ink-calendar-month-selector'; var ulSelector = document.createElement('ul'); for(var mon=1; mon<=12; mon++){ ulSelector.appendChild(this._renderMonthButton(mon)); if (mon % 4 === 0) { selector.appendChild(ulSelector); ulSelector = document.createElement('ul'); } } return selector; }, /** * Render a single month button. */ _renderMonthButton: function (mon) { var liMonth = document.createElement('li'); var aMonth = document.createElement('a'); aMonth.setAttribute('data-cal-month', mon); aMonth.innerHTML = this._options.month[mon].substring(0,3); liMonth.appendChild(aMonth); return liMonth; }, _appendDatePickerToDom: function () { if(this._options.containerElement) { var appendTarget = Ink.i(this._options.containerElement) || // [2.3.0] maybe id; small backwards compatibility thing Common.elOrSelector(this._options.containerElement); appendTarget.appendChild(this._containerObject); } if (InkElement.findUpwardsBySelector(this._element, '.ink-form .control-group .control') === this._element.parentNode) { // [3.0.0] Check if the <input> must be a direct child of .control, and if not, remove this block. this._wrapper = this._element.parentNode; this._wrapperIsControl = true; } else { this._wrapper = InkElement.create('div', { className: 'ink-datepicker-wrapper' }); InkElement.wrap(this._element, this._wrapper); } InkElement.insertAfter(this._containerObject, this._element); }, /** * Render the topmost bar with the "close" and "clear" buttons. */ _renderSuperTopBar: function () { if((!this._options.showClose) || (!this._options.showClean)){ return; } this._superTopBar = document.createElement("div"); this._superTopBar.className = 'ink-calendar-top-options'; if(this._options.showClean){ this._superTopBar.appendChild(InkElement.create('a', { className: 'clean', setHTML: this._options.cleanText })); } if(this._options.showClose){ this._superTopBar.appendChild(InkElement.create('a', { className: 'close', setHTML: this._options.closeText })); } this._containerObject.appendChild(this._superTopBar); }, _listenToContainerObjectEvents: function () { Event.observe(this._containerObject,'mouseover',Ink.bindEvent(function(e){ Event.stop( e ); this._hoverPicker = true; },this)); Event.observe(this._containerObject,'mouseout',Ink.bindEvent(function(e){ Event.stop( e ); this._hoverPicker = false; },this)); Event.observe(this._containerObject,'click',Ink.bindEvent(this._onClick, this)); }, _onClick: function(e){ var elem = Event.element(e); if (Css.hasClassName(elem, 'ink-calendar-off')) { Event.stopDefault(e); return null; } Event.stop(e); // Relative changers this._onRelativeChangerClick(elem); // Absolute changers this._onAbsoluteChangerClick(elem); // Mode changers if (Css.hasClassName(elem, 'ink-calendar-link-month')) { this._showMonthSelector(); } else if (Css.hasClassName(elem, 'ink-calendar-link-year')) { this._showYearSelector(); } else if(Css.hasClassName(elem, 'clean')){ this._clean(); } else if(Css.hasClassName(elem, 'close')){ this._hide(false); } this._updateDescription(); }, /** * Handle click events on a changer (« ») for next/prev year/month * @method _onChangerClick * @private **/ _onRelativeChangerClick: function (elem) { var changeYear = { change_year_next: 1, change_year_prev: -1 }; var changeMonth = { change_month_next: 1, change_month_prev: -1 }; if( elem.className in changeMonth ) { this._updateCal(changeMonth[elem.className]); } else if( elem.className in changeYear ) { this._showYearSelector(changeYear[elem.className]); } }, /** * Handle click events on an atom-changer (day button, month button, year button) * * @method _onAbsoluteChangerClick * @private */ _onAbsoluteChangerClick: function (elem) { var elemData = InkElement.data(elem); if( Number(elemData.calDay) ){ this.setDate( [this._year, this._month + 1, elemData.calDay].join('-') ); this._hide(); } else if( Number(elemData.calMonth) ) { this._month = Number(elemData.calMonth) - 1; this._showDefaultView(); this._updateCal(); } else if( Number(elemData.calYear) ){ this._changeYear(Number(elemData.calYear)); } }, _changeYear: function (year) { year = +year; if(year){ this._year = year; if( typeof this._options.onYearSelected === 'function' ){ this._options.onYearSelected(this, { 'year': this._year }); } this._showMonthSelector(); } }, _clean: function () { if(this._options.displayInSelect){ this._options.yearField.selectedIndex = 0; this._options.monthField.selectedIndex = 0; this._options.dayField.selectedIndex = 0; } else { this._element.value = ''; } }, /** * Hides the DatePicker. If the component is shy (options.shy), behaves differently. * * @method _hide * @param [blur=true] Set to false to indicate this is not just a blur and force hiding even if the component is shy. */ _hide: function(blur) { blur = blur === undefined ? true : blur; if (blur === false || (blur && this._options.shy)) { Css.addClassName(this._containerObject, 'hide-all'); } }, /** * Sets the range of dates allowed to be selected in the Date Picker * * @method _setMinMax * @param {String} dateRange Two dates separated by a ':'. Example: 2013-01-01:2013-12-12 * @private */ _setMinMax: function( dateRange ) { var self = this; var noMinLimit = { _year: -Number.MAX_VALUE, _month: 0, _day: 1 }; var noMaxLimit = { _year: Number.MAX_VALUE, _month: 11, _day: 31 }; function noLimits() { self._min = noMinLimit; self._max = noMaxLimit; } if (!dateRange) { return noLimits(); } var dates = dateRange.split( ':' ); var rDate = /^(\d{4})((\-)(\d{1,2})((\-)(\d{1,2}))?)?$/; InkArray.each([ {name: '_min', date: dates[0], noLim: noMinLimit}, {name: '_max', date: dates[1], noLim: noMaxLimit} ], Ink.bind(function (data) { var lim = data.noLim; if ( data.date.toUpperCase() === 'NOW' ) { var now = new Date(); lim = dateishFromDate(now); } else if (data.date.toUpperCase() === 'EVER') { lim = data.noLim; } else if ( rDate.test( data.date ) ) { lim = dateishFromYMDString(data.date); lim._month = clamp(lim._month, 0, 11); lim._day = clamp(lim._day, 1, this._daysInMonth( lim._year, lim._month )); } this[data.name] = lim; }, this)); // Should be equal, or min should be smaller var valid = this._dateCmp(this._max, this._min) !== -1; if (!valid) { noLimits(); } }, /** * Checks if a date is between the valid range. * Starts by checking if the date passed is valid. If not, will fallback to the 'today' date. * Then checks if the all params are inside of the date range specified. If not, it will fallback to the nearest valid date (either Min or Max). * * @method _fitDateToRange * @param {Number} year Year with 4 digits (yyyy) * @param {Number} month Month * @param {Number} day Day * @return {Array} Array with the final processed date. * @private */ _fitDateToRange: function( date ) { if ( !this._isValidDate( date ) ) { date = dateishFromDate(new Date()); } if (this._dateCmp(date, this._min) === -1) { return Ink.extendObj({}, this._min); } else if (this._dateCmp(date, this._max) === 1) { return Ink.extendObj({}, this._max); } return Ink.extendObj({}, date); // date is okay already, just copy it. }, /** * Checks whether a date is within the valid date range * @method _dateWithinRange * @param year * @param month * @param day * @return {Boolean} * @private */ _dateWithinRange: function (date) { if (!arguments.length) { date = this; } return (!this._dateAboveMax(date) && (!this._dateBelowMin(date))); }, _dateAboveMax: function (date) { return this._dateCmp(date, this._max) === 1; }, _dateBelowMin: function (date) { return this._dateCmp(date, this._min) === -1; }, _dateCmp: function (self, oth) { return this._dateCmpUntil(self, oth, '_day'); }, /** * _dateCmp with varied precision. You can compare down to the day field, or, just to the month. * // the following two dates are considered equal because we asked * // _dateCmpUntil to just check up to the years. * * _dateCmpUntil({_year: 2000, _month: 10}, {_year: 2000, _month: 11}, '_year') === 0 */ _dateCmpUntil: function (self, oth, depth) { var props = ['_year', '_month', '_day']; var i = -1; do { i++; if (self[props[i]] > oth[props[i]]) { return 1; } else if (self[props[i]] < oth[props[i]]) { return -1; } } while (props[i] !== depth && self[props[i + 1]] !== undefined && oth[props[i + 1]] !== undefined); return 0; }, /** * Sets the markup in the default view mode (showing the days). * Also disables the previous and next buttons in case they don't meet the range requirements. * * @method _showDefaultView * @private */ _showDefaultView: function(){ this._yearSelector.style.display = 'none'; this._monthSelector.style.display = 'none'; this._monthPrev.childNodes[0].className = 'change_month_prev'; this._monthNext.childNodes[0].className = 'change_month_next'; if ( !this._getPrevMonth() ) { this._monthPrev.childNodes[0].className = 'action_inactive'; } if ( !this._getNextMonth() ) { this._monthNext.childNodes[0].className = 'action_inactive'; } this._monthContainer.style.display = 'block'; }, /** * Updates the date shown on the datepicker * * @method _updateDate * @private */ _updateDate: function(){ var dataParsed; if(!this._options.displayInSelect && this._element.value){ dataParsed = this._parseDate(this._element.value); } else if (this._options.displayInSelect) { dataParsed = { _year: this._options.yearField[this._options.yearField.selectedIndex].value, _month: this._options.monthField[this._options.monthField.selectedIndex].value - 1, _day: this._options.dayField[this._options.dayField.selectedIndex].value }; } if (dataParsed) { dataParsed = this._fitDateToRange(dataParsed); this._year = dataParsed._year; this._month = dataParsed._month; this._day = dataParsed._day; } this.setDate(); this._updateDescription(); this._renderMonth(); }, /** * Updates the date description shown at the top of the datepicker * * EG "12 de November" * * @method _updateDescription * @private */ _updateDescription: function(){ this._monthChanger.innerHTML = this._options.month[ this._month + 1 ]; this._ofText.innerHTML = this._options.ofText; this._yearChanger.innerHTML = this._year; }, /** * Renders the year selector view of the datepicker * * @method _showYearSelector * @private */ _showYearSelector: function(inc){ this._incrementViewingYear(inc); var firstYear = this._year - (this._year % 10); var thisYear = firstYear - 1; var str = "<li><ul>"; if (thisYear > this._min._year) { str += '<li><a href="#year_prev" class="change_year_prev">' + this._options.prevLinkText + '</a></li>'; } else { str += '<li>&nbsp;</li>'; } for (var i=1; i < 11; i++){ if (i % 4 === 0){ str+='</ul><ul>'; } thisYear = firstYear + i - 1; str += this._getYearButtonHtml(thisYear); } if( thisYear < this._max._year){ str += '<li><a href="#year_next" class="change_year_next">' + this._options.nextLinkText + '</a></li>'; } else { str += '<li>&nbsp;</li>'; } str += "</ul></li>"; this._yearSelector.innerHTML = str; this._monthPrev.childNodes[0].className = 'action_inactive'; this._monthNext.childNodes[0].className = 'action_inactive'; this._monthSelector.style.display = 'none'; this._monthContainer.style.display = 'none'; this._yearSelector.style.display = 'block'; }, /** * For the year selector. * * Update this._year, to find the next decade or use nextValidDateFn to find it. */ _incrementViewingYear: function (inc) { if (!inc) { return; } var year = +this._year + inc*10; year = year - year % 10; if ( year > this._max._year || year + 9 < this._min._year){ return; } this._year = +this._year + inc*10; }, _getYearButtonHtml: function (thisYear) { if ( this._acceptableYear({_year: thisYear}) ){ var className = (thisYear === this._year) ? ' class="ink-calendar-on"' : ''; return '<li><a href="#" data-cal-year="' + thisYear + '"' + className + '>' + thisYear +'</a></li>'; } else { return '<li><a href="#" class="ink-calendar-off">' + thisYear +'</a></li>'; } }, /** * Show the month selector (happens when you click a year, or the "month" link. * @method _showMonthSelector * @private */ _showMonthSelector: function () { this._yearSelector.style.display = 'none'; this._monthContainer.style.display = 'none'; this._monthPrev.childNodes[0].className = 'action_inactive'; this._monthNext.childNodes[0].className = 'action_inactive'; this._addMonthClassNames(); this._monthSelector.style.display = 'block'; }, /** * This function returns the given date in the dateish format * * @method _parseDate * @param {String} dateStr A date on a string. * @private */ _parseDate: function(dateStr){ var date = InkDate.set( this._options.format , dateStr ); if (date) { return dateishFromDate(date); } return null; }, /** * Checks if a date is valid * * @method _isValidDate * @param {Dateish} date * @private * @return {Boolean} True if the date is valid, false otherwise */ _isValidDate: function(date){ var yearRegExp = /^\d{4}$/; var validOneOrTwo = /^\d{1,2}$/; return ( yearRegExp.test(date._year) && validOneOrTwo.test(date._month) && validOneOrTwo.test(date._day) && +date._month + 1 >= 1 && +date._month + 1 <= 12 && +date._day >= 1 && +date._day <= this._daysInMonth(date._year, date._month + 1) ); }, /** * Checks if a given date is an valid format. * * @method _isDate * @param {String} format A date format. * @param {String} dateStr A date on a string. * @private * @return {Boolean} True if the given date is valid according to the given format */ _isDate: function(format, dateStr){ try { if (typeof format === 'undefined'){ return false; } var date = InkDate.set( format , dateStr ); if( date && this._isValidDate( dateishFromDate(date) )) { return true; } } catch (ex) {} return false; }, _acceptableDay: function (date) { return this._acceptableDateComponent(date, 'validDayFn'); }, _acceptableMonth: function (date) { return this._acceptableDateComponent(date, 'validMonthFn'); }, _acceptableYear: function (date) { return this._acceptableDateComponent(date, 'validYearFn'); }, /** DRY base for the above 2 functions */ _acceptableDateComponent: function (date, userCb) { if (this._options[userCb]) { return this._callUserCallbackBool(this._options[userCb], date); } else { return this._dateWithinRange(date); } }, /** * This method returns the date written with the format specified on the options * * @method _writeDateInFormat * @private * @return {String} Returns the current date of the object in the specified format */ _writeDateInFormat:function(){ return InkDate.get( this._options.format , this.getDate()); }, /** * This method allows the user to set the DatePicker's date on run-time. * * @method setDate * @param {String} dateString A date string in yyyy-mm-dd format. * @public */ setDate: function( dateString ) { if ( /\d{4}-\d{1,2}-\d{1,2}/.test( dateString ) ) { var auxDate = dateString.split( '-' ); this._year = +auxDate[ 0 ]; this._month = +auxDate[ 1 ] - 1; this._day = +auxDate[ 2 ]; } this._setDate( ); }, /** * Get the current date as a JavaScript date. * * @method getDate */ getDate: function () { if (!this._day) { throw 'Ink.UI.DatePicker: Still picking a date. Cannot getDate now!'; } return new Date(this._year, this._month, this._day); }, /** * Sets the chosen date on the target input field * * @method _setDate * @param {DOMElement} objClicked Clicked object inside the DatePicker's calendar. * @private */ _setDate : function( objClicked ) { if (objClicked) { var data = InkElement.data(objClicked); this._day = (+data.calDay) || this._day; } var dt = this._fitDateToRange(this); this._year = dt._year; this._month = dt._month; this._day = dt._day; if(!this._options.displayInSelect){ this._element.value = this._writeDateInFormat(); } else { this._options.dayField.value = this._day; this._options.monthField.value = this._month + 1; this._options.yearField.value = this._year; } if(this._options.onSetDate) { this._options.onSetDate( this , { date : this.getDate() } ); } }, /** * Makes the necessary work to update the calendar * when choosing a different month * * @method _updateCal * @param {Number} inc Indicates previous or next month * @private */ _updateCal: function(inc){ if( typeof this._options.onMonthSelected === 'function' ){ this._options.onMonthSelected(this, { 'year': this._year, 'month' : this._month }); } if (inc && this._updateMonth(inc) === null) { return; } this._renderMonth(); }, /** * Function that returns the number of days on a given month on a given year * * @method _daysInMonth * @param {Number} _y - year * @param {Number} _m - month * @private * @return {Number} The number of days on a given month on a given year */ _daysInMonth: function(_y,_m){ var exceptions = { 2: ((_y % 400 === 0) || (_y % 4 === 0 && _y % 100 !== 0)) ? 29 : 28, 4: 30, 6: 30, 9: 30, 11: 30 }; return exceptions[_m] || 31; }, /** * Updates the calendar when a different month is chosen * * @method _updateMonth * @param {Number} incValue - indicates previous or next month * @private */ _updateMonth: function(incValue){ var date; if (incValue > 0) { date = this._getNextMonth(); } else if (incValue < 0) { date = this._getPrevMonth(); } if (!date) { return null; } this._year = date._year; this._month = date._month; this._day = date._day; }, /** * Get the next month we can show. */ _getNextMonth: function (date) { return this._tryLeap( date, 'Month', 'next', function (d) { d._month += 1; if (d._month > 11) { d._month = 0; d._year += 1; } return d; }); }, /** * Get the previous month we can show. */ _getPrevMonth: function (date) { return this._tryLeap( date, 'Month', 'prev', function (d) { d._month -= 1; if (d._month < 0) { d._month = 11; d._year -= 1; } return d; }); }, /** * Get the next year we can show. */ _getPrevYear: function (date) { return this._tryLeap( date, 'Year', 'prev', function (d) { d._year -= 1; return d; }); }, /** * Get the next year we can show. */ _getNextYear: function (date) { return this._tryLeap( date, 'Year', 'next', function (d) { d._year += 1; return d; }); }, /** * DRY base for a function which tries to get the next or previous valid year or month. * * It checks if we can go forward by using _dateCmp with atomic * precision (this means, {_year} for leaping years, and * {_year, month} for leaping months), then it tries to get the * result from the user-supplied callback (nextDateFn or prevDateFn), * and when this is not present, advance the date forward using the * `advancer` callback. */ _tryLeap: function (date, atomName, directionName, advancer) { date = date || { _year: this._year, _month: this._month, _day: this._day }; var maxOrMin = directionName === 'prev' ? '_min' : '_max'; var boundary = this[maxOrMin]; // Check if we're by the boundary of min/max year/month if (this._dateCmpUntil(date, boundary, atomName) === 0) { return null; // We're already at the boundary. Bail. } var leapUserCb = this._options[directionName + 'ValidDateFn']; if (leapUserCb) { return this._callUserCallbackDate(leapUserCb, date); } else { date = advancer(date); } date = this._fitDateToRange(date); return this['_acceptable' + atomName](date) ? date : null; }, _getNextDecade: function (date) { date = date || { _year: this._year, _month: this._month, _day: this._day }; var decade = this._getCurrentDecade(date); if (decade + 10 > this._max._year) { return null; } return decade + 10; }, _getPrevDecade: function (date) { date = date || { _year: this._year, _month: this._month, _day: this._day }; var decade = this._getCurrentDecade(date); if (decade - 10 < this._min._year) { return null; } return decade - 10; }, /** Returns the decade given a date or year*/ _getCurrentDecade: function (year) { year = year ? (year._year || year) : this._year; return Math.floor(year / 10) * 10; // Round to first place }, _callUserCallbackBase: function (cb, date) { return cb.call(this, date._year, date._month + 1, date._day); }, _callUserCallbackBool: function (cb, date) { return !!this._callUserCallbackBase(cb, date); }, _callUserCallbackDate: function (cb, date) { var ret = this._callUserCallbackBase(cb, date); return ret ? dateishFromDate(ret) : null; }, /** * Key-value object that (for a given key) points to the correct parsing format for the DatePicker * @property _dateParsers * @type {Object} * @readOnly */ _dateParsers: { 'yyyy-mm-dd' : 'Y-m-d' , 'yyyy/mm/dd' : 'Y/m/d' , 'yy-mm-dd' : 'y-m-d' , 'yy/mm/dd' : 'y/m/d' , 'dd-mm-yyyy' : 'd-m-Y' , 'dd/mm/yyyy' : 'd/m/Y' , 'dd-mm-yy' : 'd-m-y' , 'dd/mm/yy' : 'd/m/y' , 'mm/dd/yyyy' : 'm/d/Y' , 'mm-dd-yyyy' : 'm-d-Y' }, /** * Renders the current month * * @method _renderMonth * @private */ _renderMonth: function(){ var month = this._month; var year = this._year; // Week day of the first day in the month var wDayFirst = (new Date( year , month , 1 )).getDay(); var startWeekDay = this._options.startWeekDay || 0; this._showDefaultView(); if(startWeekDay > wDayFirst) { wDayFirst = 7 + startWeekDay - wDayFirst; } else { wDayFirst += startWeekDay; } var html = ''; html += this._getMonthCalendarHeaderHtml(startWeekDay); var counter = 0; html+='<ul>'; var emptyHtml = '<li class="ink-calendar-empty">&nbsp;</li>'; // Add padding if the first day of the month is not monday. if(wDayFirst !== 0) { var empties = wDayFirst - startWeekDay - 1; counter += empties; html += strRepeat(empties, emptyHtml); } html += this._getDayButtonsHtml(counter, year, month); html += '</ul>'; this._monthContainer.innerHTML = html; }, _getDayButtonsHtml: function (counter, year, month) { var daysInMonth = this._daysInMonth(year, month); var ret = ''; for (var day = 1; day <= daysInMonth; day++) { if (counter === 7){ // new week counter=0; ret += '<ul>'; } ret += this._getDayButtonHtml(year, month, day); counter++; if(counter === 7){ ret += '</ul>'; } } return ret; }, /** * Get the HTML markup for a single day in month view, given year, month, day. * * @method _getDayButtonHtml * @private */ _getDayButtonHtml: function (year, month, day) { var attrs = ' '; var date = dateishFromYMD(year, month, day); if (!this._acceptableDay(date)) { attrs += 'class="ink-calendar-off"'; } else { attrs += 'data-cal-day="' + day + '"'; } if (this._day && this._dateCmp(date, this) === 0) { attrs += 'class="ink-calendar-on" data-cal-day="' + day + '"'; } return '<li><a href="#" ' + attrs + '>' + day + '</a></li>'; }, /** Write the top bar of the calendar (M T W T F S S) */ _getMonthCalendarHeaderHtml: function (startWeekDay) { var ret = '<ul class="ink-calendar-header">'; var wDay; for(var i=0; i<7; i++){ wDay = (startWeekDay + i) % 7; ret += '<li>' + this._options.wDay[wDay].substring(0,1) + '</li>'; } return ret + '</ul>'; }, /** * This method adds class names to month buttons, to visually distinguish. * * @method _addMonthClassNames * @param {DOMElement} parent DOMElement where all the months are. * @private */ _addMonthClassNames: function(parent){ InkArray.forEach( (parent || this._monthSelector).getElementsByTagName('a'), Ink.bindMethod(this, '_addMonthButtonClassNames')); }, /** * Add the ink-calendar-on className if the given button is the current month, * otherwise add the ink-calendar-off className if the given button refers to * an unacceptable month (given dateRange and validMonthFn) */ _addMonthButtonClassNames: function (btn) { var data = InkElement.data(btn); if (!data.calMonth) { throw 'not a calendar month button!'; } var month = +data.calMonth - 1; if ( month === this._month ) { Css.addClassName( btn, 'ink-calendar-on' ); // This month Css.removeClassName( btn, 'ink-calendar-off' ); } else { Css.removeClassName( btn, 'ink-calendar-on' ); // Not this month var toDisable = !this._acceptableMonth({_year: this._year, _month: month}); Css.addRemoveClassName( btn, 'ink-calendar-off', toDisable); } }, /** * Prototype's method to allow the 'i18n files' to change all objects' language at once. * @param {Object} options Object with the texts' configuration. * @param {String} closeText Text of the close anchor * @param {String} cleanText Text of the clean text anchor * @param {String} prevLinkText "Previous" link's text * @param {String} nextLinkText "Next" link's text * @param {String} ofText The text "of", present in 'May of 2013' * @param {Object} month An object with keys from 1 to 12 that have the full months' names * @param {Object} wDay An object with keys from 0 to 6 that have the full weekdays' names * @public */ lang: function( options ){ this._lang = options; }, /** * This calls the rendering of the selected month. (Deprecated: use show() instead) * * @method showMonth * @public */ showMonth: function(){ this._renderMonth(); }, /** * Returns true if the calendar sceen is in 'select day' mode * * @return {Boolean} True if the calendar sceen is in 'select day' mode * @public */ isMonthRendered: function(){ var header = Selector.select('.ink-calendar-header', this._containerObject)[0]; return ((Css.getStyle(header.parentNode,'display') !== 'none') && (Css.getStyle(header.parentNode.parentNode,'display') !== 'none') ); }, /** * Destroys this datepicker, removing it from the page. * * @public **/ destroy: function () { InkElement.unwrap(this._element); InkElement.remove(this._wrapper); InkElement.remove(this._containerObject); Common.unregisterInstance.call(this); } }; return DatePicker; }); /* * @module Ink.UI.Draggable_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule("Ink.UI.Draggable","1",["Ink.Dom.Element_1", "Ink.Dom.Event_1", "Ink.Dom.Css_1", "Ink.Dom.Browser_1", "Ink.Dom.Selector_1", "Ink.UI.Common_1"],function( InkElement, InkEvent, Css, Browser, Selector, Common) { 'use strict'; var x = 0, y = 1; // For accessing coords in [x, y] arrays // Get a value between two boundaries function between (val, min, max) { val = Math.min(val, max); val = Math.max(val, min); return val; } /** * @class Ink.UI.Draggable * @version 1 * @constructor * @param {String|DOMElement} target Target element. * @param {Object} [options] Optional object for configuring the component * @param {String} [options.constraint] Movement constraint. None by default. Can be `vertical`, `horizontal`, or `both`. * @param {String|DomElement} [options.constraintElm] Constrain dragging to be within this element. None by default. * @param {Number} [options.top,left,right,bottom] Limits for constraining draggable movement. * @param {String|DOMElement} [options.handle] if specified, this element will be used as a handle for dragging. * @param {Boolean} [options.revert] if true, reverts the draggable to the original position when dragging stops * @param {String} [options.cursor] cursor type (CSS `cursor` value) used when the mouse is over the draggable object * @param {Number} [options.zIndex] zindex applied to the draggable element while dragged * @param {Number} [options.fps] if defined, on drag will run every n frames per second only * @param {DomElement} [options.droppableProxy] if set, a shallow copy of the droppableProxy will be put on document.body with transparent bg * @param {String} [options.mouseAnchor] defaults to mouse cursor. can be 'left|center|right top|center|bottom' * @param {String} [options.dragClass='drag'] class to add when the draggable is being dragged. * @param {Function} [options.onStart] callback called when dragging starts * @param {Function} [options.onEnd] callback called when dragging stops * @param {Function} [options.onDrag] callback called while dragging, prior to position updates * @param {Function} [options.onChange] callback called while dragging, after position updates * @example * Ink.requireModules( ['Ink.UI.Draggable_1'], function( Draggable ){ * new Draggable( '#myElementId' ); * }); */ var Draggable = function(element, options) { this.init(element, options); }; Draggable.prototype = { /** * Init function called by the constructor * * @method _init * @param {String|DOMElement} element ID of the element or DOM Element. * @param {Object} [options] Options object for configuration of the module. * @private */ init: function(element, options) { var o = Ink.extendObj( { constraint: false, constraintElm: false, top: false, right: false, bottom: false, left: false, handle: options.handler /* old option name */ || false, revert: false, cursor: 'move', zindex: options.zindex /* old option name */ || 9999, dragClass: 'drag', onStart: false, onEnd: false, onDrag: false, onChange: false, droppableProxy: false, mouseAnchor: undefined, skipChildren: true, fps: 100, debug: false }, options || {}, InkElement.data(element)); this.options = o; this.element = Common.elOrSelector(element); this.constraintElm = o.constraintElm && Common.elOrSelector(o.constraintElm); this.handle = false; this.elmStartPosition = false; this.active = false; this.dragged = false; this.prevCoords = false; this.placeholder = false; this.position = false; this.zindex = false; this.firstDrag = true; if (o.fps) { this.deltaMs = 1000 / o.fps; this.lastRunAt = 0; } this.handlers = {}; this.handlers.start = Ink.bindEvent(this._onStart,this); this.handlers.dragFacade = Ink.bindEvent(this._onDragFacade,this); this.handlers.drag = Ink.bindEvent(this._onDrag,this); this.handlers.end = Ink.bindEvent(this._onEnd,this); this.handlers.selectStart = function(event) { InkEvent.stop(event); return false; }; // set handle this.handle = (this.options.handle) ? Common.elOrSelector(this.options.handle) : this.element; this.handle.style.cursor = o.cursor; InkEvent.observe(this.handle, 'touchstart', this.handlers.start); InkEvent.observe(this.handle, 'mousedown', this.handlers.start); if (Browser.IE) { InkEvent.observe(this.element, 'selectstart', this.handlers.selectStart); } }, /** * Removes the ability of the element of being dragged * * @method destroy * @public */ destroy: function() { InkEvent.stopObserving(this.handle, 'touchstart', this.handlers.start); InkEvent.stopObserving(this.handle, 'mousedown', this.handlers.start); if (Browser.IE) { InkEvent.stopObserving(this.element, 'selectstart', this.handlers.selectStart); } }, /** * Gets coordinates for a given event (with added page scroll) * * @method _getCoords * @param {Object} e window.event object. * @return {Array} Array where the first position is the x coordinate, the second is the y coordinate * @private */ _getCoords: function(e) { var ps = [InkElement.scrollWidth(), InkElement.scrollHeight()]; return { x: (e.touches ? e.touches[0].clientX : e.clientX) + ps[x], y: (e.touches ? e.touches[0].clientY : e.clientY) + ps[y] }; }, /** * Clones src element's relevant properties to dst * * @method _cloneStyle * @param {DOMElement} src Element from where we're getting the styles * @param {DOMElement} dst Element where we're placing the styles. * @private */ _cloneStyle: function(src, dst) { dst.className = src.className; dst.style.borderWidth = '0'; dst.style.padding = '0'; dst.style.position = 'absolute'; dst.style.width = InkElement.elementWidth(src) + 'px'; dst.style.height = InkElement.elementHeight(src) + 'px'; dst.style.left = InkElement.elementLeft(src) + 'px'; dst.style.top = InkElement.elementTop(src) + 'px'; dst.style.cssFloat = Css.getStyle(src, 'float'); dst.style.display = Css.getStyle(src, 'display'); }, /** * onStart event handler * * @method _onStart * @param {Object} e window.event object * @return {Boolean|void} In some cases return false. Otherwise is void * @private */ _onStart: function(e) { if (!this.active && InkEvent.isLeftClick(e) || typeof e.button === 'undefined') { var tgtEl = InkEvent.element(e); if (this.options.skipChildren && tgtEl !== this.handle) { return; } InkEvent.stop(e); Css.addClassName(this.element, this.options.dragClass); this.elmStartPosition = [ InkElement.elementLeft(this.element), InkElement.elementTop( this.element) ]; var pos = [ parseInt(Css.getStyle(this.element, 'left'), 10), parseInt(Css.getStyle(this.element, 'top'), 10) ]; var dims = InkElement.elementDimensions(this.element); this.originalPosition = [ pos[x] ? pos[x]: null, pos[y] ? pos[y] : null ]; this.delta = this._getCoords(e); // mouse coords at beginning of drag this.active = true; this.position = Css.getStyle(this.element, 'position'); this.zindex = Css.getStyle(this.element, 'zIndex'); var div = document.createElement('div'); div.style.position = this.position; div.style.width = dims[x] + 'px'; div.style.height = dims[y] + 'px'; div.style.marginTop = Css.getStyle(this.element, 'margin-top'); div.style.marginBottom = Css.getStyle(this.element, 'margin-bottom'); div.style.marginLeft = Css.getStyle(this.element, 'margin-left'); div.style.marginRight = Css.getStyle(this.element, 'margin-right'); div.style.borderWidth = '0'; div.style.padding = '0'; div.style.cssFloat = Css.getStyle(this.element, 'float'); div.style.display = Css.getStyle(this.element, 'display'); div.style.visibility = 'hidden'; this.delta2 = [ this.delta.x - this.elmStartPosition[x], this.delta.y - this.elmStartPosition[y] ]; // diff between top-left corner of obj and mouse if (this.options.mouseAnchor) { var parts = this.options.mouseAnchor.split(' '); var ad = [dims[x], dims[y]]; // starts with 'right bottom' if (parts[0] === 'left') { ad[x] = 0; } else if(parts[0] === 'center') { ad[x] = parseInt(ad[x]/2, 10); } if (parts[1] === 'top') { ad[y] = 0; } else if(parts[1] === 'center') { ad[y] = parseInt(ad[y]/2, 10); } this.applyDelta = [this.delta2[x] - ad[x], this.delta2[y] - ad[y]]; } var dragHandlerName = this.options.fps ? 'dragFacade' : 'drag'; this.placeholder = div; if (this.options.onStart) { this.options.onStart(this.element, e); } if (this.options.droppableProxy) { // create new transparent div to optimize DOM traversal during drag this.proxy = document.createElement('div'); dims = [ window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight ]; var fs = this.proxy.style; fs.width = dims[x] + 'px'; fs.height = dims[y] + 'px'; fs.position = 'fixed'; fs.left = '0'; fs.top = '0'; fs.zIndex = this.options.zindex + 1; fs.backgroundColor = '#FF0000'; Css.setOpacity(this.proxy, 0); var firstEl = document.body.firstChild; while (firstEl && firstEl.nodeType !== 1) { firstEl = firstEl.nextSibling; } document.body.insertBefore(this.proxy, firstEl); InkEvent.observe(this.proxy, 'mousemove', this.handlers[dragHandlerName]); InkEvent.observe(this.proxy, 'touchmove', this.handlers[dragHandlerName]); } else { InkEvent.observe(document, 'mousemove', this.handlers[dragHandlerName]); } this.element.style.position = 'absolute'; this.element.style.zIndex = this.options.zindex; this.element.parentNode.insertBefore(this.placeholder, this.element); this._onDrag(e); InkEvent.observe(document, 'mouseup', this.handlers.end); InkEvent.observe(document, 'touchend', this.handlers.end); return false; } }, /** * Function that gets the timestamp of the current run from time to time. (FPS) * * @method _onDragFacade * @param {Object} window.event object. * @private */ _onDragFacade: function(e) { var now = +new Date(); if (!this.lastRunAt || now > this.lastRunAt + this.deltaMs) { this.lastRunAt = now; this._onDrag(e); } }, /** * Function that handles the dragging movement * * @method _onDrag * @param {Object} window.event object. * @private */ _onDrag: function(e) { if (this.active) { InkEvent.stop(e); this.dragged = true; var mouseCoords = this._getCoords(e), mPosX = mouseCoords.x, mPosY = mouseCoords.y, o = this.options, newX = false, newY = false; if (this.prevCoords && mPosX !== this.prevCoords.x || mPosY !== this.prevCoords.y) { if (o.onDrag) { o.onDrag(this.element, e); } this.prevCoords = mouseCoords; newX = this.elmStartPosition[x] + mPosX - this.delta.x; newY = this.elmStartPosition[y] + mPosY - this.delta.y; var draggableSize = InkElement.elementDimensions(this.element); if (this.constraintElm) { var offset = InkElement.offset(this.constraintElm); var size = InkElement.elementDimensions(this.constraintElm); var constTop = offset[y] + (o.top || 0), constBottom = offset[y] + size[y] - (o.bottom || 0), constLeft = offset[x] + (o.left || 0), constRight = offset[x] + size[x] - (o.right || 0); newY = between(newY, constTop, constBottom - draggableSize[y]); newX = between(newX, constLeft, constRight - draggableSize[x]); } else if (o.constraint) { var right = o.right === false ? InkElement.pageWidth() - draggableSize[x] : o.right, left = o.left === false ? 0 : o.left, top = o.top === false ? 0 : o.top, bottom = o.bottom === false ? InkElement.pageHeight() - draggableSize[y] : o.bottom; if (o.constraint === 'horizontal' || o.constraint === 'both') { newX = between(newX, left, right); } if (o.constraint === 'vertical' || o.constraint === 'both') { newY = between(newY, top, bottom); } } var Droppable = Ink.getModule('Ink.UI.Droppable_1'); if (this.firstDrag) { if (Droppable) { Droppable.updateAll(); } /*this.element.style.position = 'absolute'; this.element.style.zIndex = this.options.zindex; this.element.parentNode.insertBefore(this.placeholder, this.element);*/ this.firstDrag = false; } if (newX) { this.element.style.left = newX + 'px'; } if (newY) { this.element.style.top = newY + 'px'; } if (Droppable) { // apply applyDelta defined on drag init var mouseCoords2 = this.options.mouseAnchor ? {x: mPosX - this.applyDelta[x], y: mPosY - this.applyDelta[y]} : mouseCoords; Droppable.action(mouseCoords2, 'drag', e, this.element); } if (o.onChange) { o.onChange(this); } } } }, /** * Function that handles the end of the dragging process * * @method _onEnd * @param {Object} window.event object. * @private */ _onEnd: function(e) { InkEvent.stopObserving(document, 'mousemove', this.handlers.drag); InkEvent.stopObserving(document, 'touchmove', this.handlers.drag); if (this.options.fps) { this._onDrag(e); } Css.removeClassName(this.element, this.options.dragClass); if (this.active && this.dragged) { if (this.options.droppableProxy) { // remove transparent div... document.body.removeChild(this.proxy); } if (this.pt) { // remove debugging element... InkElement.remove(this.pt); this.pt = undefined; } /*if (this.options.revert) { this.placeholder.parentNode.removeChild(this.placeholder); }*/ if(this.placeholder) { InkElement.remove(this.placeholder); } if (this.options.revert) { this.element.style.position = this.position; if (this.zindex !== null) { this.element.style.zIndex = this.zindex; } else { this.element.style.zIndex = 'auto'; } // restore default zindex of it had none this.element.style.left = (this.originalPosition[x]) ? this.originalPosition[x] + 'px' : ''; this.element.style.top = (this.originalPosition[y]) ? this.originalPosition[y] + 'px' : ''; } if (this.options.onEnd) { this.options.onEnd(this.element, e); } var Droppable = Ink.getModule('Ink.UI.Droppable_1'); if (Droppable) { Droppable.action(this._getCoords(e), 'drop', e, this.element); } this.position = false; this.zindex = false; this.firstDrag = true; } this.active = false; this.dragged = false; } }; return Draggable; }); /** * @module Ink.UI.Dropdown_1 * * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.Dropdown', '1', ['Ink.UI.Common_1', 'Ink.UI.Toggle_1', 'Ink.Dom.Event_1', 'Ink.Dom.Element_1'], function(Common, Toggle, InkEvent, InkElement) { 'use strict'; function Dropdown(trigger, options) { this._init(trigger, options); } Dropdown.prototype = { /** * Use this UI module to achieve a dropdown menu. * * @class Ink.UI.Dropdown * * @constructor * @param {DOMElement|String} trigger * @param {Object} options * @param {DOMElement|String} options.target Target of the dropdown action. */ _init: function(trigger, options) { this._element = Common.elOrSelector(trigger); this._options = Common.options('Ink.UI.Dropdown_1', { 'target': ['Element'], 'hoverOpen': ['Number', null], 'dismissOnInsideClick': ['Boolean', false], 'dismissOnOutsideClick': ['Boolean', true], 'dismissAfter': ['Number', null], 'onInsideClick': ['Function', null], 'onOutsideClick': ['Function', null], 'onOpen': ['Function', null], 'onDismiss': ['Function', null] }, options || {}, this._element); this._toggle = new Toggle(this._element, { target: this._options.target, closeOnInsideClick: null, closeOnClick: false, onChangeState: Ink.bind(function (newState) { return this._openOrDismiss(newState, true, true); }, this) }); // Event where we set this._dismissTimeout and clear this._openTimeout InkEvent.observeMulti([this._options.target, this._element], 'mouseout', Ink.bindMethod(this, '_onMouseOut')); // Events to keep clearing this._dismissTimeout and set this._openTimeout InkEvent.observeMulti([this._options.target, this._element], 'mouseover', Ink.bindMethod(this, '_onMouseOver')); // to call dismissOnInsideClick and onInsideClick InkEvent.observe(this._options.target, 'click', Ink.bindMethod(this, '_onInsideClick')); // to call dismissOnOutsideClick and onOutsideClick InkEvent.observe(document, 'click', Ink.bindMethod(this, '_onOutsideClick')); }, /** * Called when the mouse is over the toggler, or the dropdown. * * Deals with "hoverOpen" by setting the dropdown to open later. Also cancels "dismissAfter". * @method _onMouseOver * @private **/ _onMouseOver: function () { if (typeof this._options.hoverOpen === 'number' && this._toggle.getState() === false) { clearTimeout(this._openTimeout); this._openTimeout = setTimeout( Ink.bindMethod(this, 'open', true), this._options.hoverOpen * 1000); } if (typeof this._options.dismissAfter === 'number') { clearTimeout(this._dismissTimeout); } }, /** * Called when the mouse leaves either the toggler, or the dropdown. * * Deals with "dismissAfter" by setting the dropdown to be dismissed later. Also cancels "hoverOpen". * @method _onMouseOut * @private **/ _onMouseOut: function () { if (typeof this._options.dismissAfter === 'number' && this._toggle.getState() === true) { clearTimeout(this._dismissTimeout); this._dismissTimeout = setTimeout( Ink.bindMethod(this, 'dismiss', true), this._options.dismissAfter * 1000); } if (typeof this._options.hoverOpen === 'number') { clearTimeout(this._openTimeout); } }, /** * Handle clicks on the dropdown. * @method _onInsideClick * @private */ _onInsideClick: function (event) { var ret = this._handlerCall('onInsideClick', InkEvent.element(event)); if (ret === false) { return false; } if (this._options.dismissOnInsideClick) { this.dismiss(true); } InkEvent.stop(event); }, /** * Handle clicks outside the dropdown. * @method _onInsideClick * @private */ _onOutsideClick: function (event) { var target = InkEvent.element(event); var foundElem = InkElement.findUpwardsHaving(target, Ink.bind(function (needle) { return needle === this._element; }, this)); var foundTarget = InkElement.findUpwardsHaving(target, Ink.bind(function (needle) { return needle === this._options.target; }, this)); if (!foundElem && !foundTarget) { var ret = this._handlerCall('onOutsideClick', target); if (ret === false) { return false; } if (this._options.dismissOnOutsideClick) { this.dismiss(true); } InkEvent.stop(event); } }, /** * Dismiss the dropdown. * * @method dismiss * @param [callHandler=false] call onDismiss handler */ dismiss: function (callHandler, doNotInformToggle) { this._openOrDismiss(false, callHandler, doNotInformToggle); }, /** * Open the dropdown * * @method open * @param [callHandler=false] call onOpen handler */ open: function (callHandler, _doNotInformToggle) { this._openOrDismiss(true, callHandler, _doNotInformToggle); }, /** * DRY'ing up open() and dismiss() * * @method _openOrDismiss * @param [newState=false] * @param [callHandler=false] * @private */ _openOrDismiss: function (newState, callHandler, _doNotInformToggle) { if (this._toggle && this._toggle.getState() === newState) { return; } if (callHandler) { if (this._handlerCall(newState ? 'onOpen' : 'onDismiss') === false) { return false; // canceled by event handler } } if (!_doNotInformToggle) { this._toggle.setState(newState); } clearTimeout(this._dismissTimeout); clearTimeout(this._openTimeout); }, /** * call a method given by the user through the options * * @method _handlerCall * @params handler {String} The handler name in this._options * @params ... Arguments to pass to function */ _handlerCall: function (handler/*, ... */) { if (this._options[handler]) { return this._options[handler].call(this, [].slice.call(arguments, 1)); } } }; return Dropdown; }); /** * @module Ink.UI.Droppable_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule("Ink.UI.Droppable","1",["Ink.Dom.Element_1", "Ink.Dom.Event_1", "Ink.Dom.Css_1", "Ink.UI.Common_1", "Ink.Util.Array_1", "Ink.Dom.Selector_1"], function( InkElement, InkEvent, Css, Common, InkArray, Selector) { 'use strict'; // Higher order functions var hAddClassName = function (element) { return function (className) {return Css.addClassName(element, className);}; }; var hRemoveClassName = function (element) { return function (className) {return Css.removeClassName(element, className);}; }; /** * @class Ink.UI.Droppable * @version 1 * @static */ var Droppable = { /** * Flag that determines if it's in debug mode or not * * @property debug * @type {Boolean} * @private */ debug: false, /** * Array with the data of each element (`{element: ..., data: ..., options: ...}`) * * @property _droppables * @type {Array} * @private */ _droppables: [], /** * Array of data for each draggable. (`{element: ..., data: ...}`) * * @property _draggables * @type {Array} * @private */ _draggables: [], /** * Makes an element droppable and adds it to the stack of droppable elements. * Can consider it a constructor of droppable elements, but where no Droppable object is returned. * * In the following arguments, any events/callbacks you may pass, can be either functions or strings. If the 'move' or 'copy' strings are passed, the draggable gets moved into this droppable. If 'revert' is passed, an acceptable droppable is moved back to the element it came from. * * @method add * @param {String|DOMElement} element Target element * @param {Object} [options] options object * @param {String} [options.hoverClass] Classname(s) applied when an acceptable draggable element is hovering the element * @param {String} [options.accept] Selector for choosing draggables which can be dropped in this droppable. * @param {Function} [options.onHover] callback called when an acceptable draggable element is hovering the droppable. Gets the draggable and the droppable element as parameters. * @param {Function|String} [options.onDrop] callback called when an acceptable draggable element is dropped. Gets the draggable, the droppable and the event as parameters. * @param {Function|String} [options.onDropOut] callback called when a droppable is dropped outside this droppable. Gets the draggable, the droppable and the event as parameters. (see above for string options). * @public * * @example * * <style type="text/css"> * .hover { * border: 1px solid red; * } * .left, .right { * float: left; width: 50%; * outline: 1px solid gray; * min-height: 2em; * } * </style> * <ul class="left"> * <li>Draggable 1</li> * <li>Draggable 2</li> * <li>Draggable 3</li> * </ul> * <ul class="right"> * </ul> * <script type="text/javascript"> * Ink.requireModules(['Ink.UI.Draggable_1', 'Ink.UI.Droppable_1'], function (Draggable, Droppable) { * new Draggable('.left li:eq(0)', {}); * new Draggable('.left li:eq(1)', {}); * new Draggable('.left li:eq(2)', {}); * Droppable.add('.left', {onDrop: 'move', onDropOut: 'revert'}); * Droppable.add('.right', {onDrop: 'move', onDropOut: 'revert'}); * }) * </script> * */ add: function(element, options) { element = Common.elOrSelector(element, 'Droppable.add target element'); var opt = Ink.extendObj( { hoverClass: options.hoverclass /* old name */ || false, accept: false, onHover: false, onDrop: false, onDropOut: false }, options || {}, InkElement.data(element)); if (typeof opt.hoverClass === 'string') { opt.hoverClass = opt.hoverClass.split(/\s+/); } function cleanStyle(draggable) { draggable.style.position = 'inherit'; } var that = this; var namedEventHandlers = { move: function (draggable, droppable/*, event*/) { cleanStyle(draggable); droppable.appendChild(draggable); }, copy: function (draggable, droppable/*, event*/) { cleanStyle(draggable); droppable.appendChild(draggable.cloneNode); }, revert: function (draggable/*, droppable, event*/) { that._findDraggable(draggable).originalParent.appendChild(draggable); cleanStyle(draggable); } }; var name; if (typeof opt.onHover === 'string') { name = opt.onHover; opt.onHover = namedEventHandlers[name]; if (opt.onHover === undefined) { throw new Error('Unknown hover event handler: ' + name); } } if (typeof opt.onDrop === 'string') { name = opt.onDrop; opt.onDrop = namedEventHandlers[name]; if (opt.onDrop === undefined) { throw new Error('Unknown drop event handler: ' + name); } } if (typeof opt.onDropOut === 'string') { name = opt.onDropOut; opt.onDropOut = namedEventHandlers[name]; if (opt.onDropOut === undefined) { throw new Error('Unknown dropOut event handler: ' + name); } } var elementData = { element: element, data: {}, options: opt }; this._droppables.push(elementData); this._update(elementData); }, /** * find droppable data about `element`. this data is added in `.add` * * @method _findData * @param {DOMElement} element Needle * @return {object} Droppable data of the element * @private */ _findData: function (element) { var elms = this._droppables; for (var i = 0, len = elms.length; i < len; i++) { if (elms[i].element === element) { return elms[i]; } } }, /** * Find draggable data about `element` * * @method _findDraggable * @param {DOMElement} element Needle * @return {Object} Draggable data queried * @private */ _findDraggable: function (element) { var elms = this._draggables; for (var i = 0, len = elms.length; i < len; i++) { if (elms[i].element === element) { return elms[i]; } } }, /** * Invoke every time a drag starts * * @method updateAll * @private */ updateAll: function() { InkArray.each(this._droppables, Droppable._update); }, /** * Updates location and size of droppable element * * @method update * @param {String|DOMElement} element - target element * @private */ update: function(element) { this._update(this._findData(element)); }, _update: function(elementData) { var data = elementData.data; var element = elementData.element; data.left = InkElement.offsetLeft(element); data.top = InkElement.offsetTop( element); data.right = data.left + InkElement.elementWidth( element); data.bottom = data.top + InkElement.elementHeight(element); }, /** * Removes an element from the droppable stack and removes the droppable behavior * * @method remove * @param {String|DOMElement} elOrSelector Droppable element to disable. * @return {Boolean} Whether the object was found and deleted * @public */ remove: function(el) { el = Common.elOrSelector(el); var len = this._droppables.length; for (var i = 0; i < len; i++) { if (this._droppables[i].element === el) { this._droppables.splice(i, 1); break; } } return len !== this._droppables.length; }, /** * Method called by a draggable to execute an action on a droppable * * @method action * @param {Object} coords coordinates where the action happened * @param {String} type type of action. drag or drop. * @param {Object} ev Event object * @param {Object} draggable draggable element * @private */ action: function(coords, type, ev, draggable) { // check all droppable elements InkArray.each(this._droppables, Ink.bind(function(elementData) { var data = elementData.data; var opt = elementData.options; var element = elementData.element; if (opt.accept && !Selector.matches(opt.accept, [draggable]).length) { return; } if (type === 'drag' && !this._findDraggable(draggable)) { this._draggables.push({ element: draggable, originalParent: draggable.parentNode }); } // check if our draggable is over our droppable if (coords.x >= data.left && coords.x <= data.right && coords.y >= data.top && coords.y <= data.bottom) { // INSIDE if (type === 'drag') { if (opt.hoverClass) { InkArray.each(opt.hoverClass, hAddClassName(element)); } if (opt.onHover) { opt.onHover(draggable, element); } } else if (type === 'drop') { if (opt.hoverClass) { InkArray.each(opt.hoverClass, hRemoveClassName(element)); } if (opt.onDrop) { opt.onDrop(draggable, element, ev); } } } else { // OUTSIDE if (type === 'drag' && opt.hoverClass) { InkArray.each(opt.hoverClass, hRemoveClassName(element)); } else if (type === 'drop') { if(opt.onDropOut){ opt.onDropOut(draggable, element, ev); } } } }, this)); } }; return Droppable; }); /** * @module Ink.UI.FormValidator_1 * @author inkdev AT sapo.pt * @version 1 **/ Ink.createModule('Ink.UI.FormValidator', '1', ['Ink.Dom.Element_1', 'Ink.Dom.Css_1','Ink.Util.Validator_1','Ink.Dom.Selector_1'], function( InkElement, Css, InkValidator , Selector) { 'use strict'; function elementsWithSameName(elm) { if (!elm.name) { return []; } if (!elm.form) { return Selector.select('name="' + elm.name + '"'); } var ret = elm.form[elm.name]; if(typeof(ret.length) === 'undefined') { ret = [ret]; } return ret; } /** * @class Ink.UI.FormValidator * @version 1 */ var FormValidator = { /** * Specifies the version of the component * * @property version * @type {String} * @readOnly * @public */ version: '1', /** * Available flags to use in the validation process. * The keys are the 'rules', and their values are objects with the key 'msg', determining * what is the error message. * * @property _flagMap * @type {Object} * @readOnly * @private */ _flagMap: { //'ink-fv-required': {msg: 'Campo obrigat&oacute;rio'}, 'ink-fv-required': {msg: 'Required field'}, //'ink-fv-email': {msg: 'E-mail inv&aacute;lido'}, 'ink-fv-email': {msg: 'Invalid e-mail address'}, //'ink-fv-url': {msg: 'URL inv&aacute;lido'}, 'ink-fv-url': {msg: 'Invalid URL'}, //'ink-fv-number': {msg: 'N&uacute;mero inv&aacute;lido'}, 'ink-fv-number': {msg: 'Invalid number'}, //'ink-fv-phone_pt': {msg: 'N&uacute;mero de telefone inv&aacute;lido'}, 'ink-fv-phone_pt': {msg: 'Invalid phone number'}, //'ink-fv-phone_cv': {msg: 'N&uacute;mero de telefone inv&aacute;lido'}, 'ink-fv-phone_cv': {msg: 'Invalid phone number'}, //'ink-fv-phone_mz': {msg: 'N&uacute;mero de telefone inv&aacute;lido'}, 'ink-fv-phone_mz': {msg: 'Invalid phone number'}, //'ink-fv-phone_ao': {msg: 'N&uacute;mero de telefone inv&aacute;lido'}, 'ink-fv-phone_ao': {msg: 'Invalid phone number'}, //'ink-fv-date': {msg: 'Data inv&aacute;lida'}, 'ink-fv-date': {msg: 'Invalid date'}, //'ink-fv-confirm': {msg: 'Confirma&ccedil;&atilde;o inv&aacute;lida'}, 'ink-fv-confirm': {msg: 'Confirmation does not match'}, 'ink-fv-custom': {msg: ''} }, /** * This property holds all form elements for later validation * * @property elements * @type {Object} * @public */ elements: {}, /** * This property holds the objects needed to cross-check for the 'confirm' rule * * @property confirmElms * @type {Object} * @public */ confirmElms: {}, /** * This property holds the previous elements in the confirmElms property, but with a * true/false specifying if it has the class ink-fv-confirm. * * @property hasConfirm * @type {Object} */ hasConfirm: {}, /** * Defined class name to use in error messages label * * @property _errorClassName * @type {String} * @readOnly * @private */ _errorClassName: 'tip error', /** * @property _errorValidationClassName * @type {String} * @readOnly * @private */ _errorValidationClassName: 'validaton', /** * @property _errorTypeWarningClassName * @type {String} * @readOnly * @private */ _errorTypeWarningClassName: 'warning', /** * @property _errorTypeErrorClassName * @type {String} * @readOnly * @private */ _errorTypeErrorClassName: 'error', /** * Check if a form is valid or not * * @method validate * @param {DOMElement|String} elm DOM form element or form id * @param {Object} options Options for * @param {Function} [options.onSuccess] function to run when form is valid * @param {Function} [options.onError] function to run when form is not valid * @param {Array} [options.customFlag] custom flags to use to validate form fields * @public * @return {Boolean} Whether the form is deemed valid or not. * * @example * * ## What markup do I need? * * Besides the markup structure you can see in * <a href="http://ink.sapo.pt/forms#building"></a>, you need to add * the `ink-fv-*` classes to your inputs, which correspond to validation * rules in this component. Available classes are: * * - `ink-fv-required` : Required field * - `ink-fv-email` : Valid e-mail * - `ink-fv-url` : Valid URL address * - `ink-fv-number` : Valid number * - `ink-fv-phone_pt`, `ink-fv-phone_cv`, `ink-fv-phone_mz`, `ink-fv-phone_ao` : Valid telephone number in Portugal, Cape Verde, Mozambique or Angola. * - `ink-fv-date` : Valid date * - `ink-fv-confirm` : Make the user type the same thing twice. Common rule for confirming passwords. * - `ink-fv-custom` : Custom rule (see below example "Custom rule") * * E-mail field: <input class="ink-fv-required ink-fv-email"><br> * Phone number field: <input class="ink-fv-number ink-fv-required"><br> * Website field (optional): <input class="ink-fv-url"> * * ## Simple usage * * So you have a form and would like to validate it? This example shows * how to validate a form and stop it from being submitted when invalid. * To use this, add the several ink-fv-* classes to your input elements. * * The validate() function will also add "invalid" classes to each of * your elements so the user gets a color feedback and an error message * below each element (control-group, really). * * var myForm = Ink.i('my-form'); * InkEvent.observe(myForm, 'submit', function (ev) { * var formIsValid = FormValidator.validate(myForm); * if (!formIsValid) { * InkEvent.stop(ev); // Cancel submission of form. * } * }); * * @example * * ## Custom rule. * * The following code validates using a custom rule named `minthree`, * which fails if the input string has less than three characters. * To do this, you must add the `ink-fv-custom` and `minthree` classes * to the input elements you want to validate, and pass the `customFlag` * option to this function, like so: * * var isValid = FormValidator.validate(myForm, { * customFlag: [ * { * flag: 'minthree', // The name of this rule (add this class to your <input>s * msg: 'Please input at least three characters', // Error message when rule fails * callback: function (el) { * return el.value.length >= 3 // Return true when okay, false when not * } * } * ] * }); */ validate: function(elm, options) { this._free(); options = Ink.extendObj({ onSuccess: false, onError: false, customFlag: false, confirmGroup: [] }, options || {}); if(typeof(elm) === 'string') { elm = document.getElementById(elm); } if(elm === null){ return false; } this.element = elm; if(typeof(this.element.id) === 'undefined' || this.element.id === null || this.element.id === '') { // generate a random ID // TODO ugly and potentially problematic, and you know Murphy's law. this.element.id = 'ink-fv_randomid_'+(Math.round(Math.random() * 99999)); } this.custom = options.customFlag; this.confirmGroup = options.confirmGroup; var fail = this._validateElements(); if(fail.length > 0) { if(options.onError) { options.onError(fail); } else { this._showError(elm, fail); } return false; } else { if(!options.onError) { this._clearError(elm); } this._clearCache(); if(options.onSuccess) { options.onSuccess(); } return true; } }, /** * Reset previously generated validation errors * * @method reset * @public */ reset: function() { this._clearError(); this._clearCache(); }, /** * Cleans the object * * @method _free * @private */ _free: function() { this.element = null; //this.elements = []; this.custom = false; this.confirmGroup = false; }, /** * Cleans the properties responsible for caching * * @method _clearCache * @private */ _clearCache: function() { this.element = null; this.elements = []; this.custom = false; this.confirmGroup = false; }, /** * Gets the form elements and stores them in the caching properties * * @method _getElements * @private */ _getElements: function() { //this.elements = []; // if(typeof(this.elements[this.element.id]) !== 'undefined') { // return; // } var elements = this.elements[this.element.id] = []; this.confirmElms[this.element.id] = []; //console.log(this.element); //console.log(this.element.elements); var formElms = Selector.select(':input', this.element); var curElm = false; for(var i=0, totalElm = formElms.length; i < totalElm; i++) { curElm = formElms[i]; var type = (curElm.getAttribute('type') + '').toLowerCase(); if (type === 'radio' || type === 'checkbox') { if(elements.length === 0 || ( curElm.getAttribute('type') !== elements[elements.length - 1].getAttribute('type') && curElm.getAttribute('name') !== elements[elements.length - 1].getAttribute('name') )) { for(var flag in this._flagMap) { if(Css.hasClassName(curElm, flag)) { elements.push(curElm); break; } } } } else { for(var flag2 in this._flagMap) { if(Css.hasClassName(curElm, flag2) && flag2 !== 'ink-fv-confirm') { /*if(flag2 == 'ink-fv-confirm') { this.confirmElms[this.element.id].push(curElm); this.hasConfirm[this.element.id] = true; }*/ elements.push(curElm); break; } } if(Css.hasClassName(curElm, 'ink-fv-confirm')) { this.confirmElms[this.element.id].push(curElm); this.hasConfirm[this.element.id] = true; } } } }, /** * Runs the validation for each element * * @method _validateElements * @private */ _validateElements: function() { var oGroups; this._getElements(); if(this.hasConfirm[this.element.id] === true) { oGroups = this._makeConfirmGroups(); } var errors = []; var curElm = false; var customErrors = false; var inArray; for(var i=0, totalElm = this.elements[this.element.id].length; i < totalElm; i++) { inArray = false; curElm = this.elements[this.element.id][i]; if(!curElm.disabled) { for(var flag in this._flagMap) { if(Css.hasClassName(curElm, flag)) { if(flag !== 'ink-fv-custom' && flag !== 'ink-fv-confirm') { if(!this._isValid(curElm, flag)) { if(!inArray) { errors.push({elm: curElm, errors:[flag]}); inArray = true; } else { errors[(errors.length - 1)].errors.push(flag); } } } else if(flag !== 'ink-fv-confirm'){ customErrors = this._isCustomValid(curElm); if(customErrors.length > 0) { errors.push({elm: curElm, errors:[flag], custom: customErrors}); } } else if(flag === 'ink-fv-confirm'){ continue; } } } } } errors = this._validateConfirmGroups(oGroups, errors); //console.log(InkDumper.returnDump(errors)); return errors; }, /** * Runs the 'confirm' validation for each group of elements * * @method _validateConfirmGroups * @param {Array} oGroups Array/Object that contains the group of confirm objects * @param {Array} errors Array that will store the errors * @private * @return {Array} Array of errors that was passed as 2nd parameter (either changed, or not, depending if errors were found). */ _validateConfirmGroups: function(oGroups, errors) { //console.log(oGroups); var curGroup = false; for(var i in oGroups) if (oGroups.hasOwnProperty(i)) { curGroup = oGroups[i]; if(curGroup.length === 2) { if(curGroup[0].value !== curGroup[1].value) { errors.push({elm:curGroup[1], errors:['ink-fv-confirm']}); } } } return errors; }, /** * Creates the groups of 'confirm' objects * * @method _makeConfirmGroups * @private * @return {Array|Boolean} Returns the array of confirm elements or false on error. */ _makeConfirmGroups: function() { var oGroups; if(this.confirmGroup && this.confirmGroup.length > 0) { oGroups = {}; var curElm = false; var curGroup = false; //this.confirmElms[this.element.id]; for(var i=0, total=this.confirmElms[this.element.id].length; i < total; i++) { curElm = this.confirmElms[this.element.id][i]; for(var j=0, totalG=this.confirmGroup.length; j < totalG; j++) { curGroup = this.confirmGroup[j]; if(Css.hasClassName(curElm, curGroup)) { if(typeof(oGroups[curGroup]) === 'undefined') { oGroups[curGroup] = [curElm]; } else { oGroups[curGroup].push(curElm); } } } } return oGroups; } else { if(this.confirmElms[this.element.id].length === 2) { oGroups = { "ink-fv-confirm": [ this.confirmElms[this.element.id][0], this.confirmElms[this.element.id][1] ] }; } return oGroups; } return false; }, /** * Validates an element with a custom validation * * @method _isCustomValid * @param {DOMElemenmt} elm Element to be validated * @private * @return {Array} Array of errors. If no errors are found, results in an empty array. */ _isCustomValid: function(elm) { var customErrors = []; var curFlag = false; for(var i=0, tCustom = this.custom.length; i < tCustom; i++) { curFlag = this.custom[i]; if(Css.hasClassName(elm, curFlag.flag)) { if(!curFlag.callback(elm, curFlag.msg)) { customErrors.push({flag: curFlag.flag, msg: curFlag.msg}); } } } return customErrors; }, /** * Runs the normal validation functions for a specific element * * @method _isValid * @param {DOMElement} elm DOMElement that will be validated * @param {String} fieldType Rule to be validated. This must be one of the keys present in the _flagMap property. * @private * @return {Boolean} The result of the validation. */ _isValid: function(elm, fieldType) { var nodeName = elm.nodeName.toLowerCase(); var inputType = (elm.getAttribute('type') || '').toLowerCase(); var value = this._trim(elm.value); // When we're analyzing emails, telephones, etc, and the field is // empty, we check if it is required. If not required, it's valid. if (fieldType !== 'ink-fv-required' && inputType !== 'checkbox' && inputType !== 'radio' && value === '') { return !Css.hasClassName(elm, 'ink-fv-required'); } switch(fieldType) { case 'ink-fv-required': if(nodeName === 'select') { if(elm.selectedIndex > 0) { return true; } else { return false; } } if(inputType !== 'checkbox' && inputType !== 'radio' && value !== '') { return true; // A input type=text,email,etc. } else if(inputType === 'checkbox' || inputType === 'radio') { var aFormRadios = elementsWithSameName(elm); var isChecked = false; // check if any input of the radio is checked for(var i=0, totalRadio = aFormRadios.length; i < totalRadio; i++) { if(aFormRadios[i].checked === true) { isChecked = true; break; } } return isChecked; } return false; case 'ink-fv-email': return InkValidator.mail(elm.value); case 'ink-fv-url': return InkValidator.url(elm.value); case 'ink-fv-number': return !isNaN(Number(elm.value)) && isFinite(Number(elm.value)); case 'ink-fv-phone_pt': return InkValidator.isPTPhone(elm.value); case 'ink-fv-phone_cv': return InkValidator.isCVPhone(elm.value); case 'ink-fv-phone_ao': return InkValidator.isAOPhone(elm.value); case 'ink-fv-phone_mz': return InkValidator.isMZPhone(elm.value); case 'ink-fv-date': var Element = Ink.getModule('Ink.Dom.Element',1); var dataset = Element.data( elm ); var validFormat = 'yyyy-mm-dd'; if( Css.hasClassName(elm, 'ink-datepicker') && ('format' in dataset) ){ validFormat = dataset.format; } else if( ('validFormat' in dataset) ){ validFormat = dataset.validFormat; } if( !(validFormat in InkValidator._dateParsers ) ){ var validValues = []; for( var val in InkValidator._dateParsers ){ if (InkValidator._dateParsers.hasOwnProperty(val)) { validValues.push(val); } } throw new Error( 'The attribute data-valid-format must be one of ' + 'the following values: ' + validValues.join(', ')); } return InkValidator.isDate( validFormat, elm.value ); case 'ink-fv-custom': break; } return false; }, /** * Makes the necessary changes to the markup to show the errors of a given element * * @method _showError * @param {DOMElement} formElm The form element to be changed to show the errors * @param {Array} aFail An array with the errors found. * @private */ _showError: function(formElm, aFail) { this._clearError(formElm); //ink-warning-field //console.log(aFail); var curElm = false; for(var i=0, tFail = aFail.length; i < tFail; i++) { curElm = aFail[i].elm; if (curElm) { this._showAnErrorOnElement(curElm, aFail[i]); } } }, _showAnErrorOnElement: function (curElm, error) { /* jshint noempty:false */ var controlGroupElm = InkElement.findUpwardsByClass( curElm, 'control-group'); var controlElm = InkElement.findUpwardsByClass( curElm, 'control'); var errorClasses = [ this._errorClassName, this._errorTypeClassName].join(' '); var errorMsg = InkElement.create('p', { className: errorClasses }); if(error.errors[0] !== 'ink-fv-custom') { errorMsg.innerHTML = this._flagMap[error.errors[0]].msg; } else { errorMsg.innerHTML = error.custom[0].msg; } var target = (controlElm || controlGroupElm); if (target) { target.appendChild(errorMsg); } else { InkElement.insertAfter(errorMsg, curElm); } if (controlElm) { if(error.errors[0] === 'ink-fv-required') { Css.addClassName(controlGroupElm, 'validation error'); } else { Css.addClassName(controlGroupElm, 'validation warning'); } } }, /** * Clears the error of a given element. Normally executed before any validation, for all elements, as a reset. * * @method _clearErrors * @param {DOMElement} formElm Form element to be cleared. * @private */ _clearError: function(formElm) { //return; var aErrorLabel = formElm.getElementsByTagName('p'); var curElm; var control; for(var i = (aErrorLabel.length - 1); i >= 0; i--) { curElm = aErrorLabel[i]; if(Css.hasClassName(curElm, this._errorClassName)) { control = InkElement.findUpwardsBySelector(curElm, '.control-group'); if (control) { Css.removeClassName(control, ['validation', 'error', 'warning']); } if(Css.hasClassName(curElm, this._errorClassName, true /*both*/)) { InkElement.remove(curElm); } } } var aErrorLabel2 = formElm.getElementsByTagName('ul'); for(i = (aErrorLabel2.length - 1); i >= 0; i--) { curElm = aErrorLabel2[i]; if(Css.hasClassName(curElm, 'control-group')) { Css.removeClassName(curElm, 'validation error'); } } }, /** * Removes unnecessary spaces to the left or right of a string * * @method _trim * @param {String} stri String to be trimmed * @private * @return {String|undefined} String trimmed. */ _trim: function(str) { if(typeof(str) === 'string') { return str.replace(/^\s+|\s+$|\n+$/g, ''); } } }; return FormValidator; }); /** * @module Ink.UI.FormValidator_2 * @author inkdev AT sapo.pt * @version 2 */ Ink.createModule('Ink.UI.FormValidator', '2', [ 'Ink.UI.Common_1','Ink.Dom.Element_1','Ink.Dom.Event_1','Ink.Dom.Selector_1','Ink.Dom.Css_1','Ink.Util.Array_1','Ink.Util.I18n_1','Ink.Util.Validator_1'], function( Common, Element, Event, Selector, Css, InkArray, I18n, InkValidator ) { 'use strict'; /** * Validation Functions to be used * Some functions are a port from PHP, others are the 'best' solutions available * * @type {Object} * @private * @static */ var validationFunctions = { /** * Checks if the value is actually defined and is not empty * * @method validationFunctions.required * @param {String} value Value to be checked * @return {Boolean} True case is defined, false if it's empty or not defined. */ 'required': function( value ){ return ( (typeof value !== 'undefined') && ( !(/^\s*$/).test(value) ) ); }, /** * Checks if the value has a minimum length * * @method validationFunctions.min_length * @param {String} value Value to be checked * @param {String|Number} minSize Number of characters that the value at least must have. * @return {Boolean} True if the length of value is equal or bigger than the minimum chars defined. False if not. */ 'min_length': function( value, minSize ){ return ( (typeof value === 'string') && ( value.length >= parseInt(minSize,10) ) ); }, /** * Checks if the value has a maximum length * * @method validationFunctions.max_length * @param {String} value Value to be checked * @param {String|Number} maxSize Number of characters that the value at maximum can have. * @return {Boolean} True if the length of value is equal or smaller than the maximum chars defined. False if not. */ 'max_length': function( value, maxSize ){ return ( (typeof value === 'string') && ( value.length <= parseInt(maxSize,10) ) ); }, /** * Checks if the value has an exact length * * @method validationFunctions.exact_length * @param {String} value Value to be checked * @param {String|Number} exactSize Number of characters that the value must have. * @return {Boolean} True if the length of value is equal to the size defined. False if not. */ 'exact_length': function( value, exactSize ){ return ( (typeof value === 'string') && ( value.length === parseInt(exactSize,10) ) ); }, /** * Checks if the value has a valid e-mail address * * @method validationFunctions.email * @param {String} value Value to be checked * @return {Boolean} True if the value is a valid e-mail address. False if not. */ 'email': function( value ){ return ( ( typeof value === 'string' ) && InkValidator.mail( value ) ); }, /** * Checks if the value has a valid URL * * @method validationFunctions.url * @param {String} value Value to be checked * @param {Boolean} fullCheck Flag that specifies if the value must be validated as a full url (with the protocol) or not. * @return {Boolean} True if the URL is considered valid. False if not. */ 'url': function( value, fullCheck ){ fullCheck = fullCheck || false; return ( (typeof value === 'string') && InkValidator.url( value, fullCheck ) ); }, /** * Checks if the value is a valid IP. Supports ipv4 and ipv6 * * @method validationFunctions.ip * @param {String} value Value to be checked * @param {String} ipType Type of IP to be validated. The values are: ipv4, ipv6. By default is ipv4. * @return {Boolean} True if the value is a valid IP address. False if not. */ 'ip': function( value, ipType ){ if( typeof value !== 'string' ){ return false; } return InkValidator.isIP(value, ipType); }, /** * Checks if the value is a valid phone number. Supports several countries, based in the Ink.Util.Validator class. * * @method validationFunctions.phone * @param {String} value Value to be checked * @param {String} phoneType Country's initials to specify the type of phone number to be validated. Ex: 'AO'. * @return {Boolean} True if it's a valid phone number. False if not. */ 'phone': function( value, phoneType ){ if( typeof value !== 'string' ){ return false; } var countryCode = phoneType ? phoneType.toUpperCase() : ''; return InkValidator['is' + countryCode + 'Phone'](value); }, /** * Checks if it's a valid credit card. * * @method validationFunctions.credit_card * @param {String} value Value to be checked * @param {String} cardType Type of credit card to be validated. The card types available are in the Ink.Util.Validator class. * @return {Boolean} True if the value is a valid credit card number. False if not. */ 'credit_card': function( value, cardType ){ if( typeof value !== 'string' ){ return false; } return InkValidator.isCreditCard( value, cardType || 'default' ); }, /** * Checks if the value is a valid date. * * @method validationFunctions.date * @param {String} value Value to be checked * @param {String} format Specific format of the date. * @return {Boolean} True if the value is a valid date. False if not. */ 'date': function( value, format ){ return ( (typeof value === 'string' ) && InkValidator.isDate(format, value) ); }, /** * Checks if the value only contains alphabetical values. * * @method validationFunctions.alpha * @param {String} value Value to be checked * @param {Boolean} supportSpaces Allow whitespace * @return {Boolean} True if the value is alphabetical-only. False if not. */ 'alpha': function( value, supportSpaces ){ return InkValidator.ascii(value, {singleLineWhitespace: supportSpaces}); }, /* * Check that the value contains only printable unicode text characters * from the Basic Multilingual plane (BMP) * Optionally allow punctuation and whitespace * * @method validationFunctions.text * @param {String} value Value to be checked * @return {Boolean} Whether the value only contains printable text characters **/ 'text': function (value, whitespace, punctuation) { return InkValidator.unicode(value, { singleLineWhitespace: whitespace, unicodePunctuation: punctuation}); }, /* * Check that the value contains only printable text characters * available in the latin-1 encoding. * * Optionally allow punctuation and whitespace * * @method validationFunctions.text * @param {String} value Value to be checked * @return {Boolean} Whether the value only contains printable text characters **/ 'latin': function (value, punctuation, whitespace) { if ( typeof value !== 'string') { return false; } return InkValidator.latin1(value, {latin1Punctuation: punctuation, singleLineWhitespace: whitespace}); }, /** * Checks if the value only contains alphabetical and numerical characters. * * @method validationFunctions.alpha_numeric * @param {String} value Value to be checked * @return {Boolean} True if the value is a valid alphanumerical. False if not. */ 'alpha_numeric': function( value ){ return InkValidator.ascii(value, {numbers: true}); }, /** * Checks if the value only contains alphabetical, dash or underscore characteres. * * @method validationFunctions.alpha_dashes * @param {String} value Value to be checked * @return {Boolean} True if the value is a valid. False if not. */ 'alpha_dash': function( value ){ return InkValidator.ascii(value, {dash: true, underscore: true}); }, /** * Checks if the value is a digit (an integer of length = 1). * * @method validationFunctions.digit * @param {String} value Value to be checked * @return {Boolean} True if the value is a valid digit. False if not. */ 'digit': function( value ){ return ((typeof value === 'string') && /^[0-9]{1}$/.test(value)); }, /** * Checks if the value is a valid integer. * * @method validationFunctions.integer * @param {String} value Value to be checked * @param {String} positive Flag that specifies if the integer is must be positive (unsigned). * @return {Boolean} True if the value is a valid integer. False if not. */ 'integer': function( value, positive ){ return InkValidator.number(value, { negative: !positive, decimalPlaces: 0 }); }, /** * Checks if the value is a valid decimal number. * * @method validationFunctions.decimal * @param {String} value Value to be checked * @param {String} decimalSeparator Character that splits the integer part from the decimal one. By default is '.'. * @param {String} [decimalPlaces] Maximum number of digits that the decimal part must have. * @param {String} [leftDigits] Maximum number of digits that the integer part must have, when provided. * @return {Boolean} True if the value is a valid decimal number. False if not. */ 'decimal': function( value, decimalSeparator, decimalPlaces, leftDigits ){ return InkValidator.number(value, { decimalSep: decimalSeparator || '.', decimalPlaces: +decimalPlaces || null, maxDigits: +leftDigits }); }, /** * Checks if it is a numeric value. * * @method validationFunctions.numeric * @param {String} value Value to be checked * @param {String} decimalSeparator Verifies if it's a valid decimal. Otherwise checks if it's a valid integer. * @param {String} [decimalPlaces] (when the number is decimal) Maximum number of digits that the decimal part must have. * @param {String} [leftDigits] (when the number is decimal) Maximum number of digits that the integer part must have, when provided. * @return {Boolean} True if the value is numeric. False if not. */ 'numeric': function( value, decimalSeparator, decimalPlaces, leftDigits ){ decimalSeparator = decimalSeparator || '.'; if( value.indexOf(decimalSeparator) !== -1 ){ return validationFunctions.decimal( value, decimalSeparator, decimalPlaces, leftDigits ); } else { return validationFunctions.integer( value ); } }, /** * Checks if the value is in a specific range of values. The parameters after the first one are used for specifying the range, and are similar in function to python's range() function. * * @method validationFunctions.range * @param {String} value Value to be checked * @param {String} minValue Left limit of the range. * @param {String} maxValue Right limit of the range. * @param {String} [multipleOf] In case you want numbers that are only multiples of another number. * @return {Boolean} True if the value is within the range. False if not. */ 'range': function( value, minValue, maxValue, multipleOf ){ value = +value; minValue = +minValue; maxValue = +maxValue; if (isNaN(value) || isNaN(minValue) || isNaN(maxValue)) { return false; } if( value < minValue || value > maxValue ){ return false; } if (multipleOf) { return (value - minValue) % multipleOf === 0; } else { return true; } }, /** * Checks if the value is a valid color. * * @method validationFunctions.color * @param {String} value Value to be checked * @return {Boolean} True if the value is a valid color. False if not. */ 'color': function( value ){ return InkValidator.isColor(value); }, /** * Checks if the value matches the value of a different field. * * @method validationFunctions.matches * @param {String} value Value to be checked * @param {String} fieldToCompare Name or ID of the field to compare. * @return {Boolean} True if the values match. False if not. */ 'matches': function( value, fieldToCompare ){ return ( value === this.getFormElements()[fieldToCompare][0].getValue() ); } }; /** * Error messages for the validation functions above * @type {Object} * @private * @static */ var validationMessages = new I18n({ en_US: { 'formvalidator.required' : 'The {field} filling is mandatory', 'formvalidator.min_length': 'The {field} must have a minimum size of {param1} characters', 'formvalidator.max_length': 'The {field} must have a maximum size of {param1} characters', 'formvalidator.exact_length': 'The {field} must have an exact size of {param1} characters', 'formvalidator.email': 'The {field} must have a valid e-mail address', 'formvalidator.url': 'The {field} must have a valid URL', 'formvalidator.ip': 'The {field} does not contain a valid {param1} IP address', 'formvalidator.phone': 'The {field} does not contain a valid {param1} phone number', 'formvalidator.credit_card': 'The {field} does not contain a valid {param1} credit card', 'formvalidator.date': 'The {field} should contain a date in the {param1} format', 'formvalidator.alpha': 'The {field} should only contain letters', 'formvalidator.text': 'The {field} should only contain alphabetic characters', 'formvalidator.latin': 'The {field} should only contain alphabetic characters', 'formvalidator.alpha_numeric': 'The {field} should only contain letters or numbers', 'formvalidator.alpha_dashes': 'The {field} should only contain letters or dashes', 'formvalidator.digit': 'The {field} should only contain a digit', 'formvalidator.integer': 'The {field} should only contain an integer', 'formvalidator.decimal': 'The {field} should contain a valid decimal number', 'formvalidator.numeric': 'The {field} should contain a number', 'formvalidator.range': 'The {field} should contain a number between {param1} and {param2}', 'formvalidator.color': 'The {field} should contain a valid color', 'formvalidator.matches': 'The {field} should match the field {param1}', 'formvalidator.validation_function_not_found': 'The rule {rule} has not been defined' }, pt_PT: { 'formvalidator.required' : 'Preencher {field} é obrigatório', 'formvalidator.min_length': '{field} deve ter no mínimo {param1} caracteres', 'formvalidator.max_length': '{field} tem um tamanho máximo de {param1} caracteres', 'formvalidator.exact_length': '{field} devia ter exactamente {param1} caracteres', 'formvalidator.email': '{field} deve ser um e-mail válido', 'formvalidator.url': 'O {field} deve ser um URL válido', 'formvalidator.ip': '{field} não tem um endereço IP {param1} válido', 'formvalidator.phone': '{field} deve ser preenchido com um número de telefone {param1} válido.', 'formvalidator.credit_card': '{field} não tem um cartão de crédito {param1} válido', 'formvalidator.date': '{field} deve conter uma data no formato {param1}', 'formvalidator.alpha': 'O campo {field} deve conter apenas caracteres alfabéticos', 'formvalidator.text': 'O campo {field} deve conter apenas caracteres alfabéticos', 'formvalidator.latin': 'O campo {field} deve conter apenas caracteres alfabéticos', 'formvalidator.alpha_numeric': '{field} deve conter apenas letras e números', 'formvalidator.alpha_dashes': '{field} deve conter apenas letras e traços', 'formvalidator.digit': '{field} destina-se a ser preenchido com apenas um dígito', 'formvalidator.integer': '{field} deve conter um número inteiro', 'formvalidator.decimal': '{field} deve conter um número válido', 'formvalidator.numeric': '{field} deve conter um número válido', 'formvalidator.range': '{field} deve conter um número entre {param1} e {param2}', 'formvalidator.color': '{field} deve conter uma cor válida', 'formvalidator.matches': '{field} deve corresponder ao campo {param1}', 'formvalidator.validation_function_not_found': '[A regra {rule} não foi definida]' } }, 'en_US'); /** * Constructor of a FormElement. * This type of object has particular methods to parse rules and validate them in a specific DOM Element. * * @param {DOMElement} element DOM Element * @param {Object} options Object with configuration options * @return {FormElement} FormElement object */ var FormElement = function( element, options ){ this._element = Common.elOrSelector( element, 'Invalid FormElement' ); this._errors = {}; this._rules = {}; this._value = null; this._options = Ink.extendObj( { label: this._getLabel() }, Element.data(this._element) ); this._options = Ink.extendObj( this._options, options || {} ); }; /** * FormElement's prototype */ FormElement.prototype = { /** * Function to get the label that identifies the field. * If it can't find one, it will use the name or the id * (depending on what is defined) * * @method _getLabel * @return {String} Label to be used in the error messages * @private */ _getLabel: function(){ var controlGroup = Element.findUpwardsByClass(this._element,'control-group'); var label = Ink.s('label',controlGroup); if( label ){ label = Element.textContent(label); } else { label = this._element.name || this._element.id || ''; } return label; }, /** * Function to parse a rules' string. * Ex: required|number|max_length[30] * * @method _parseRules * @param {String} rules String with the rules * @private */ _parseRules: function( rules ){ this._rules = {}; rules = rules.split("|"); var i, rulesLength = rules.length, rule, params, paramStartPos ; if( rulesLength > 0 ){ for( i = 0; i < rulesLength; i++ ){ rule = rules[i]; if( !rule ){ continue; } if( ( paramStartPos = rule.indexOf('[') ) !== -1 ){ params = rule.substr( paramStartPos+1 ); params = params.split(']'); params = params[0]; params = params.split(','); for (var p = 0, len = params.length; p < len; p++) { params[p] = params[p] === 'true' ? true : params[p] === 'false' ? false : params[p]; } params.splice(0,0,this.getValue()); rule = rule.substr(0,paramStartPos); this._rules[rule] = params; } else { this._rules[rule] = [this.getValue()]; } } } }, /** * Function to add an error to the FormElement's 'errors' object. * It basically receives the rule where the error occurred, the parameters passed to it (if any) * and the error message. * Then it replaces some tokens in the message for a more 'custom' reading * * @method _addError * @param {String|null} rule Rule that failed, or null if no rule was found. * @private * @static */ _addError: function(rule){ var params = this._rules[rule] || []; var paramObj = { field: this._options.label, value: this.getValue() }; for( var i = 1; i < params.length; i++ ){ paramObj['param' + i] = params[i]; } var i18nKey = 'formvalidator.' + rule; this._errors[rule] = validationMessages.text(i18nKey, paramObj); if (this._errors[rule] === i18nKey) { this._errors[rule] = 'Validation message not found'; } }, /** * Function to retrieve the element's value * * @method getValue * @return {mixed} The DOM Element's value * @public */ getValue: function(){ switch(this._element.nodeName.toLowerCase()){ case 'select': return Ink.s('option:selected',this._element).value; case 'textarea': return this._element.innerHTML; case 'input': if( "type" in this._element ){ if( (this._element.type === 'radio') && (this._element.type === 'checkbox') ){ if( this._element.checked ){ return this._element.value; } } else if( this._element.type !== 'file' ){ return this._element.value; } } else { return this._element.value; } return; default: return this._element.innerHTML; } }, /** * Function that returns the constructed errors object. * * @method getErrors * @return {Object} Errors' object * @public */ getErrors: function(){ return this._errors; }, /** * Function that returns the DOM element related to it. * * @method getElement * @return {Object} DOM Element * @public */ getElement: function(){ return this._element; }, /** * Get other elements in the same form. * * @method getFormElements * @return {Object} A mapping of keys to other elements in this form. * @public */ getFormElements: function () { return this._options.form._formElements; }, /** * Function used to validate the element based on the rules defined. * It parses the rules defined in the _options.rules property. * * @method validate * @return {Boolean} True if every rule was valid. False if one fails. * @public */ validate: function(){ this._errors = {}; if( "rules" in this._options || 1){ this._parseRules( this._options.rules ); } if( ("required" in this._rules) || (this.getValue() !== '') ){ for(var rule in this._rules) { if (this._rules.hasOwnProperty(rule)) { if( (typeof validationFunctions[rule] === 'function') ){ if( validationFunctions[rule].apply(this, this._rules[rule] ) === false ){ this._addError( rule ); return false; } } else { this._addError( null ); return false; } } } } return true; } }; /** * @class Ink.UI.FormValidator_2 * @version 2 * @constructor * @param {String|DOMElement} selector Either a CSS Selector string, or the form's DOMElement * @param {String} [options.eventTrigger='submit'] What event do we listen for. * @param {Boolean} [options.neverSubmit=false] Always cancel the event? Use this to avoid submitting the form. * @param {Selector} [options.searchFor='input, select, textarea, .control-group'] Look in these inputs for validation data-attributes. * @param {Function} [options.beforeValidation] Callback to be executed before validating the form * @param {Function} [options.onError] Validation error callback * @param {Function} [options.onSuccess] Validation success callback * * @example * Ink.requireModules( ['Ink.UI.FormValidator_2'], function( FormValidator ){ * var myValidator = new FormValidator( '#my-form' ); * }); */ var FormValidator = function( selector, options ){ /** * DOMElement of the <form> being validated * * @property _rootElement * @type {DOMElement} */ this._rootElement = Common.elOrSelector( selector ); /** * Object that will gather the form elements by name * * @property _formElements * @type {Object} */ this._formElements = {}; /** * Error message DOMElements * * @property _errorMessages */ this._errorMessages = []; /** * Array of elements marked with validation errors * * @property _markedErrorElements */ this._markedErrorElements = []; /** * Configuration options. Fetches the data attributes first, then the ones passed when executing the constructor. * By doing that, the latter will be the one with highest priority. * * @property _options * @type {Object} */ this._options = Ink.extendObj({ eventTrigger: 'submit', neverSubmit: 'false', searchFor: 'input, select, textarea, .control-group', beforeValidation: undefined, onError: undefined, onSuccess: undefined },Element.data(this._rootElement)); this._options = Ink.extendObj( this._options, options || {} ); // Sets an event listener for a specific event in the form, if defined. // By default is the 'submit' event. if( typeof this._options.eventTrigger === 'string' ){ Event.observe( this._rootElement,this._options.eventTrigger, Ink.bindEvent(this.validate,this) ); } this._init(); }; /** * Method used to set validation functions (either custom or ovewrite the existent ones) * * @method setRule * @param {String} name Name of the function. E.g. 'required' * @param {String} errorMessage Error message to be displayed in case of returning false. E.g. 'Oops, you passed {param1} as parameter1, lorem ipsum dolor...' * @param {Function} cb Function to be executed when calling this rule * @public * @static */ FormValidator.setRule = function( name, errorMessage, cb ){ validationFunctions[ name ] = cb; if (validationMessages.getKey('formvalidator.' + name) !== errorMessage) { var langObj = {}; langObj['formvalidator.' + name] = errorMessage; var dictObj = {}; dictObj[validationMessages.lang()] = langObj; validationMessages.append(dictObj); } }; /** * Get the i18n object in charge of the error messages * * @method getI18n * @return {Ink.Util.I18n} The i18n object the FormValidator is using. */ FormValidator.getI18n = function () { return validationMessages; }; /** * Sets the I18n object for validation error messages * * @method setI18n * @param {Ink.Util.I18n} i18n The I18n object. */ FormValidator.setI18n = function (i18n) { validationMessages = i18n; }; /** * Add to the I18n dictionary. See `Ink.Util.I18n.append()` documentation. * * @method AppendI18n */ FormValidator.appendI18n = function () { validationMessages.append.apply(validationMessages, [].slice.call(arguments)); }; /** * Sets the language of the error messages. pt_PT and en_US are available, but you can add new languages by using append() * * See the `Ink.Util.I18n.lang()` setter * * @method setLanguage * @param language The language to set i18n to. */ FormValidator.setLanguage = function (language) { validationMessages.lang(language); }; /** * Method used to get the existing defined validation functions * * @method getRules * @return {Object} Object with the rules defined * @public * @static */ FormValidator.getRules = function(){ return validationFunctions; }; FormValidator.prototype = { _init: function(){ }, /** * Function that searches for the elements of the form, based in the * this._options.searchFor configuration. * * @method getElements * @return {Object} An object with the elements in the form, indexed by name/id * @public */ getElements: function(){ this._formElements = {}; var formElements = Selector.select( this._options.searchFor, this._rootElement ); if( formElements.length ){ var i, element; for( i=0; i<formElements.length; i+=1 ){ element = formElements[i]; var dataAttrs = Element.data( element ); if( !("rules" in dataAttrs) ){ continue; } var options = { form: this }; var key; if( ("name" in element) && element.name ){ key = element.name; } else if( ("id" in element) && element.id ){ key = element.id; } else { key = 'element_' + Math.floor(Math.random()*100); element.id = key; } if( !(key in this._formElements) ){ this._formElements[key] = [ new FormElement( element, options ) ]; } else { this._formElements[key].push( new FormElement( element, options ) ); } } } return this._formElements; }, /** * Runs the validate function of each FormElement in the this._formElements * object. * Also, based on the this._options.beforeValidation, this._options.onError * and this._options.onSuccess, this callbacks are executed when defined. * * @method validate * @param {Event} event window.event object * @return {Boolean} * @public */ validate: function( event ) { if(this._options.neverSubmit+'' === 'true' && event) { Event.stopDefault(event); } if( typeof this._options.beforeValidation === 'function' ){ this._options.beforeValidation(); } InkArray.each( this._markedErrorElements, function (errorElement) { Css.removeClassName(errorElement, ['validation', 'error']); }); InkArray.each( this._errorMessages, Element.remove); this.getElements(); var errorElements = []; for( var key in this._formElements ){ if( this._formElements.hasOwnProperty(key) ){ for( var counter = 0; counter < this._formElements[key].length; counter+=1 ){ if( !this._formElements[key][counter].validate() ) { errorElements.push(this._formElements[key][counter]); } } } } if( errorElements.length === 0 ){ if( typeof this._options.onSuccess === 'function' ){ this._options.onSuccess(); } // [3.0.0] remove this, it's a little backwards compat quirk if(event && this._options.cancelEventOnSuccess.toString() === 'true') { Event.stopDefault(event); return false; } return true; } else { if(event) { Event.stopDefault(event); } if( typeof this._options.onError === 'function' ){ this._options.onError( errorElements ); } this._errorMessages = []; this._markedErrorElements = []; InkArray.each( errorElements, Ink.bind(function( formElement ){ var controlGroupElement; var controlElement; if( Css.hasClassName(formElement.getElement(),'control-group') ){ controlGroupElement = formElement.getElement(); controlElement = Ink.s('.control',formElement.getElement()); } else { controlGroupElement = Element.findUpwardsByClass(formElement.getElement(),'control-group'); controlElement = Element.findUpwardsByClass(formElement.getElement(),'control'); } if(controlGroupElement) { Css.addClassName( controlGroupElement, ['validation', 'error'] ); this._markedErrorElements.push(controlGroupElement); } var paragraph = document.createElement('p'); Css.addClassName(paragraph,'tip'); if (controlElement || controlGroupElement) { (controlElement || controlGroupElement).appendChild(paragraph); } else { Element.insertAfter(paragraph, formElement.getElement()); } var errors = formElement.getErrors(); var errorArr = []; for (var k in errors) { if (errors.hasOwnProperty(k)) { errorArr.push(errors[k]); } } paragraph.innerHTML = errorArr.join('<br/>'); this._errorMessages.push(paragraph); }, this)); return false; } } }; /** * Returns the FormValidator's Object */ return FormValidator; }); /** * @module Ink.UI.ImageQuery_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.ImageQuery', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.Dom.Element_1','Ink.Util.Array_1'], function(Common, Event, Element, InkArray ) { 'use strict'; /** * @class Ink.UI.ImageQuery * @constructor * @version 1 * * @param {String|DOMElement} selector * @param {Object} [options] Options * @param {String|Function} [options.src] String or Callback function (that returns a string) with the path to be used to get the images. * @param {String|Function} [options.retina] String or Callback function (that returns a string) with the path to be used to get RETINA specific images. * @param {Array} [options.queries] Array of queries * @param {String} [options.queries.label] Label of the query. Ex. 'small' * @param {Number} [options.queries.width] Min-width to use this query * @param {Function} [options.onLoad] Date format string * * @example * <div class="imageQueryExample large-100 medium-100 small-100 content-center clearfix vspace"> * <img src="/assets/imgs/imagequery/small/image.jpg" /> * </div> * <script type="text/javascript"> * Ink.requireModules( ['Ink.Dom.Selector_1', 'Ink.UI.ImageQuery_1'], function( Selector, ImageQuery ){ * var imageQueryElement = Ink.s('.imageQueryExample img'); * var imageQueryObj = new ImageQuery('.imageQueryExample img',{ * src: '/assets/imgs/imagequery/{:label}/{:file}', * queries: [ * { * label: 'small', * width: 480 * }, * { * label: 'medium', * width: 640 * }, * { * label: 'large', * width: 1024 * } * ] * }); * } ); * </script> */ var ImageQuery = function(selector, options){ /** * Get elements, create more ImageQueries if selector finds more than one * * [improvement] This is a useful pattern. More UI modules could use it. */ this._element = Common.elsOrSelector(selector, 'Ink.UI.ImageQuery', /*required=*/true); // In case we have several elements for (var i = 1 /* start from second element*/; i < this._element.length; i++) { new ImageQuery(this._element[i], options); } this._element = this._element[0]; /** * Default options, overriden by data-attributes if any. * The parameters are: * @param {array} queries Array of objects that determine the label/name and its min-width to be applied. * @param {boolean} allowFirstLoad Boolean flag to allow the loading of the first element. */ this._options = Ink.extendObj({ queries:[], onLoad: null }, options || {}, Element.data(this._element)); /** * Determining the original basename (with the querystring) of the file. */ var pos; if( (pos=this._element.src.lastIndexOf('?')) !== -1 ){ var search = this._element.src.substr(pos); this._filename = this._element.src.replace(search,'').split('/').pop()+search; } else { this._filename = this._element.src.split('/').pop(); } this._init(); }; ImageQuery.prototype = { /** * Init function called by the constructor * * @method _init * @private */ _init: function(){ // Sort queries by width, in descendant order. this._options.queries = InkArray.sortMulti(this._options.queries, 'width').reverse(); if( typeof this._options.onLoad === 'function' ){ Event.observe(this._element, 'onload', Ink.bindEvent(this._onLoad, this)); } Event.observe(window, 'resize', Ink.bindEvent(this._onResize, this)); // Imediate call to apply the right images based on the current viewport this._onResize(); }, /** * Handles the resize event (as specified in the _init function) * * @method _onResize * @private */ _onResize: Event.throttle(function(){ if( !this._options.queries.length ){ return; } var current = this._findCurrentQuery(); /** * Choosing the right src. The rule is: * * "If there is specifically defined in the query object, use that. Otherwise uses the global src." * * The above rule applies to a retina src. */ var src = current.src || this._options.src; if ( window.devicePixelRatio > 1 && ('retina' in this._options ) ) { src = current.retina || this._options.retina; } /** * Injects the file variable for usage in the 'templating system' below */ current.file = this._filename; /** * Since we allow the src to be a callback, let's run it and get the results. * For the inside, we're passing the element (img) being processed and the object of the selected * query. */ if( typeof src === 'function' ){ src = src.apply(this,[this._element,current]); if( typeof src !== 'string' ){ throw '[ImageQuery] :: "src" callback does not return a string'; } } /** * Replace the values of the existing properties on the query object (except src and retina) in the * defined src and/or retina. */ src = src.replace(/{:(.*?)}/g, function(_, prop) { return current[prop]; }); this._element.src = src; // Removes the injected file property delete current.file; }, 500), /** * Queries are in a descendant order. We want to find the query with the highest width that fits * the viewport, therefore the first one. */ _findCurrentQuery: function () { /** * Gets viewport width */ var viewportWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var queries = this._options.queries; var last = queries.length - 1; for( var query=0; query < last; query+=1 ){ if (queries[query].width <= viewportWidth){ return queries[query]; } } return queries[last]; }, /** * Handles the element loading (img onload) event * * @method _onLoad * @private */ _onLoad: function(){ /** * Since we allow a callback for this let's run it. */ this._options.onLoad.call(this); } }; return ImageQuery; }); /** * @module Ink.UI.Modal_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1','Ink.Util.Array_1'], function(Common, Event, Css, InkElement, Selector, InkArray ) { 'use strict'; var opacitySupported = (function (div) { div.style.opacity = 'invalid'; return div.style.opacity !== 'invalid'; }(InkElement.create('div', {style: 'opacity: 1'}))); /** * @class Ink.UI.Modal * @constructor * @version 1 * @param {String|DOMElement} selector * @param {Object} [options] Options * @param {String} [options.width] Default/Initial width. Ex: '600px' * @param {String} [options.height] Default/Initial height. Ex: '400px' * @param {String} [options.shadeClass] Custom class to be added to the div.ink-shade * @param {String} [options.modalClass] Custom class to be added to the div.ink-modal * @param {String} [options.trigger] CSS Selector to target elements that will trigger the Modal. * @param {String} [options.triggerEvent] Trigger's event to be listened. 'click' is the default value. Ex: 'mouseover', 'touchstart'... * @param {Boolean} [options.autoDisplay=true] Display the Modal automatically when constructed. * @param {String} [options.markup] Markup to be placed in the Modal when created * @param {Function} [options.onShow] Callback function to run when the Modal is opened. * @param {Function} [options.onDismiss] Callback function to run when the Modal is closed. Return `false` to cancel dismissing the Modal. * @param {Boolean} [options.closeOnClick=false] Determines if the Modal should close when clicked outside of it. * @param {Boolean} [options.closeOnEscape=true] Determines if the Modal should close when "Esc" key is pressed. * @param {Boolean} [options.responsive] Determines if the Modal should behave responsively (adapt to smaller viewports). * @param {Boolean} [options.disableScroll] Determines if the Modal should 'disable' the page's scroll (not the Modal's body). * * @example * <div class="ink-shade fade"> * <div id="test" class="ink-modal fade" data-trigger="#bModal" data-width="800px" data-height="400px"> * <div class="modal-header"> * <button class="modal-close ink-dismiss"></button> * <h5>Modal windows can have headers</h5> * </div> * <div class="modal-body" id="modalContent"> * <h3>Please confirm your previous choice</h3> * <p>"No," said Peleg, "and he hasn't been baptized right either, or it would have washed some of that devil's blue off his face."</p> * <p> * <img src="http://placehold.it/800x400" style="width: 100%;" alt=""> * </p> * <p>"Do tell, now," cried Bildad, "is this Philistine a regular member of Deacon Deuteronomy's meeting? I never saw him going there, and I pass it every Lord's day."</p> * <p>"I don't know anything about Deacon Deuteronomy or his meeting," said I; "all I know is, that Queequeg here is a born member of the First Congregational Church. He is a deacon himself, Queequeg is."</p> * </div> * <div class="modal-footer"> * <div class="push-right"> * <button class="ink-button info">Confirm</button> * <button class="ink-button caution ink-dismiss">Cancel</button> * </div> * </div> * </div> * </div> * <a href="#" id="bModal">Open modal</a> * <script> * Ink.requireModules( ['Ink.Dom.Selector_1','Ink.UI.Modal_1'], function( Selector, Modal ){ * var modalElement = Ink.s('#test'); * var modalObj = new Modal( modalElement ); * }); * </script> */ function upName(dimension) { // omg IE var firstCharacter = dimension.match(/^./)[0]; return firstCharacter.toUpperCase() + dimension.replace(/^./, ''); } function maxName(dimension) { return 'max' + upName(dimension); } var openModals = []; var Modal = function(selector, options) { if (!selector) { this._element = null; } else { this._element = Common.elOrSelector(selector, 'Ink.UI.Modal markup'); } this._options = { /** * Width, height and markup really optional, as they can be obtained by the element */ width: undefined, height: undefined, /** * To add extra classes */ shadeClass: undefined, modalClass: undefined, /** * Optional trigger properties */ trigger: undefined, triggerEvent: 'click', autoDisplay: true, /** * Remaining options */ markup: undefined, onShow: undefined, onDismiss: undefined, closeOnClick: false, closeOnEscape: true, responsive: true, disableScroll: true }; this._handlers = { click: Ink.bindEvent(this._onShadeClick, this), keyDown: Ink.bindEvent(this._onKeyDown, this), resize: Ink.bindEvent(this._onResize, this) }; this._wasDismissed = false; /** * Modal Markup */ if( this._element ){ this._markupMode = Css.hasClassName(this._element,'ink-modal'); // Check if the full modal comes from the markup } else { this._markupMode = false; } if( !this._markupMode ){ this._modalShadow = document.createElement('div'); this._modalShadowStyle = this._modalShadow.style; this._modalDiv = document.createElement('div'); this._modalDivStyle = this._modalDiv.style; if( !!this._element ){ this._options.markup = this._element.innerHTML; } /** * Not in full markup mode, let's set the classes and css configurations */ Css.addClassName( this._modalShadow,'ink-shade' ); Css.addClassName( this._modalDiv,'ink-modal ink-space' ); /** * Applying the main css styles */ // this._modalDivStyle.position = 'absolute'; this._modalShadow.appendChild( this._modalDiv); document.body.appendChild( this._modalShadow ); } else { this._modalDiv = this._element; this._modalDivStyle = this._modalDiv.style; this._modalShadow = this._modalDiv.parentNode; this._modalShadowStyle = this._modalShadow.style; this._contentContainer = Selector.select(".modal-body", this._modalDiv)[0]; if( !this._contentContainer){ throw new Error('Ink.UI.Modal: Missing div with class "modal-body"'); } this._options.markup = this._contentContainer.innerHTML; /** * First, will handle the least important: The dataset */ this._options = Ink.extendObj(this._options,InkElement.data(this._element)); } /** * Now, the most important, the initialization options */ this._options = Ink.extendObj(this._options,options || {}); if( !this._markupMode ){ this.setContentMarkup(this._options.markup); } if( typeof this._options.shadeClass === 'string' ){ Css.addClassName(this._modalShadow, this._options.shadeClass); } if( typeof this._options.modalClass === 'string' ){ Css.addClassName(this._modalDiv, this._options.modalClass); } if( ("trigger" in this._options) && ( typeof this._options.trigger !== 'undefined' ) ){ var triggerElement; if( typeof this._options.trigger === 'string' ){ triggerElement = Selector.select( this._options.trigger ); Event.observeMulti(triggerElement, this._options.triggerEvent, Ink.bindEvent(this.open, this)); } } else if ( this._options.autoDisplay.toString() === "true" ) { this.open(); } }; Modal.prototype = { /** * Responsible for repositioning the modal * * @method _reposition * @private */ _reposition: function(){ this._modalDivStyle.marginTop = (-InkElement.elementHeight(this._modalDiv)/2) + 'px'; this._modalDivStyle.marginLeft = (-InkElement.elementWidth(this._modalDiv)/2) + 'px'; }, /** * Responsible for resizing the modal * * @method _onResize * @param {Boolean|Event} runNow Its executed in the begining to resize/reposition accordingly to the viewport. But usually it's an event object. * @private */ _onResize: function( runNow ){ if( typeof runNow === 'boolean' ){ this._timeoutResizeFunction.call(this); } else if( !this._resizeTimeout && (runNow && typeof runNow === 'object') ){ this._resizeTimeout = setTimeout(Ink.bind(this._timeoutResizeFunction, this),250); } }, /** * Timeout Resize Function * * @method _timeoutResizeFunction * @private */ _timeoutResizeFunction: function(){ /** * Getting the current viewport size */ var isPercentage = { width: ('' + this._options.width).indexOf('%') !== -1, height: ('' + this._options.height).indexOf('%') !== -1 }; var currentViewport = { height: InkElement.viewportHeight(), width: InkElement.viewportWidth() }; InkArray.forEach(['height', 'width'], Ink.bind(function (dimension) { // Not used for percentage measurements if (isPercentage[dimension]) { return; } if (currentViewport[dimension] > this.originalStatus[dimension]) { this._modalDivStyle[dimension] = this._modalDivStyle[maxName(dimension)]; } else { this._modalDivStyle[dimension] = Math.round(currentViewport[dimension] * 0.9) + 'px'; } }, this)); this._resizeContainer(); this._reposition(); this._resizeTimeout = undefined; }, /** * Handle clicks on the shade element. * * @method _onShadeClick * @param {Event} ev * @private */ _onShadeClick: function(ev) { var tgtEl = Event.element(ev); if (Css.hasClassName(tgtEl, 'ink-close') || Css.hasClassName(tgtEl, 'ink-dismiss') || InkElement.findUpwardsBySelector(tgtEl, '.ink-close,.ink-dismiss') || ( this._options.closeOnClick && (!InkElement.descendantOf(this._shadeElement, tgtEl) || (tgtEl === this._shadeElement)) ) ) { var alertsInTheModal = Selector.select('.ink-alert', this._shadeElement), alertsLength = alertsInTheModal.length; for( var i = 0; i < alertsLength; i++ ){ if( InkElement.descendantOf(alertsInTheModal[i], tgtEl) ){ return; } } this.dismiss(); // Only stop the event if this dismisses this modal if (this._wasDismissed) { Event.stop(ev); } } }, /** * Responsible for handling the escape key pressing. * * @method _onKeyDown * @param {Event} ev * @private */ _onKeyDown: function(ev) { if (ev.keyCode !== 27 || this._wasDismissed) { return; } if (this._options.closeOnEscape.toString() === 'true' && openModals[openModals.length - 1] === this) { this.dismiss(); if (this._wasDismissed) { Event.stop(ev); } } }, /** * Responsible for setting the size of the modal (and position) based on the viewport. * * @method _resizeContainer * @private */ _resizeContainer: function() { // [3.0.0] drop this because everyone should have the new CSS now, which has this rule already with .ink-modal-is-open. this._contentElement.style.overflow = this._contentElement.style.overflowX = this._contentElement.style.overflowY = 'hidden'; var containerHeight = InkElement.elementHeight(this._modalDiv); this._modalHeader = Selector.select('.modal-header',this._modalDiv)[0]; if( this._modalHeader ){ containerHeight -= InkElement.elementHeight(this._modalHeader); } this._modalFooter = Selector.select('.modal-footer',this._modalDiv)[0]; if( this._modalFooter ){ containerHeight -= InkElement.elementHeight(this._modalFooter); } this._contentContainer.style.height = containerHeight + 'px'; if( containerHeight !== InkElement.elementHeight(this._contentContainer) ){ this._contentContainer.style.height = ~~(containerHeight - (InkElement.elementHeight(this._contentContainer) - containerHeight)) + 'px'; } if( this._markupMode ){ return; } this._contentContainer.style.overflow = this._contentContainer.style.overflowX = 'hidden'; this._contentContainer.style.overflowY = 'auto'; this._contentElement.style.overflow = this._contentElement.style.overflowX = this._contentElement.style.overflowY = 'visible'; }, /** * Responsible for 'disabling' the page scroll * * @method _disableScroll * @private */ _disableScroll: function() { var htmlEl = document.documentElement; this._oldHtmlOverflows = [ htmlEl.style.overflowX, htmlEl.style.overflowY ]; htmlEl.style.overflowX = htmlEl.style.overflowY = 'hidden'; }, /************** * PUBLIC API * **************/ /** * Display this Modal. Useful if you have initialized the modal * @method open * @param {Event} [event] (internal) In case its fired by the internal trigger. */ open: function(event) { if( event ){ Event.stop(event); } var elem = (document.compatMode === "CSS1Compat") ? document.documentElement : document.body; this._resizeTimeout = null; Css.addClassName( this._modalShadow,'ink-shade' ); this._modalShadowStyle.display = this._modalDivStyle.display = 'block'; setTimeout(Ink.bind(function() { Css.addClassName( this._modalShadow, 'visible' ); Css.addClassName( this._modalDiv, 'visible' ); }, this), 100); /** * Fallback to the old one */ this._contentElement = this._modalDiv; this._shadeElement = this._modalShadow; if( !this._markupMode ){ /** * Setting the content of the modal */ this.setContentMarkup( this._options.markup ); } /** * If any size has been user-defined, let's set them as max-width and max-height */ var isPercentage = { width: ('' + this._options.width).indexOf('%') !== -1, height: ('' + this._options.height).indexOf('%') !== -1 }; InkArray.forEach(['width', 'height'], Ink.bind(function (dimension) { if (this._options[dimension] !== undefined) { this._modalDivStyle[dimension] = this._options[dimension]; if (!isPercentage[dimension]) { this._modalDivStyle[maxName(dimension)] = InkElement['element' + upName(dimension)](this._modalDiv) + 'px'; } } else { this._modalDivStyle[maxName(dimension)] = InkElement['element' + upName(dimension)](this._modalDiv) + 'px'; } if (isPercentage[dimension] && parseInt(elem['client' + maxName(dimension)], 10) <= parseInt(this._modalDivStyle[dimension], 10) ) { this._modalDivStyle[dimension] = Math.round(parseInt(elem['client' + maxName(dimension)], 10) * 0.9) + 'px'; } }, this)); this.originalStatus = { viewportHeight: InkElement.elementHeight(elem), viewportWidth: InkElement.elementWidth(elem), height: InkElement.elementHeight(this._modalDiv), width: InkElement.elementWidth(this._modalDiv) }; /** * Let's 'resize' it: */ if( this._options.responsive.toString() === 'true' ) { this._onResize(true); Event.observe( window,'resize',this._handlers.resize ); } else { this._resizeContainer(); this._reposition(); } if (this._options.onShow) { this._options.onShow(this); } if(this._options.disableScroll.toString() === 'true') { this._disableScroll(); } // subscribe events Event.observe(this._shadeElement, 'click', this._handlers.click); if (this._options.closeOnEscape.toString() === 'true') { Event.observe(document, 'keydown', this._handlers.keyDown); } Common.registerInstance(this, this._shadeElement, 'modal'); this._wasDismissed = false; openModals.push(this); Css.addClassName(document.documentElement, 'ink-modal-is-open'); }, /** * Dismisses the modal * * @method dismiss * @public */ dismiss: function() { if (this._wasDismissed) { /* Already dismissed. WTF IE. */ return; } if (this._options.onDismiss) { var ret = this._options.onDismiss(this); if (ret === false) { return; } } this._wasDismissed = true; if( this._options.responsive ){ Event.stopObserving(window, 'resize', this._handlers.resize); } // this._modalShadow.parentNode.removeChild(this._modalShadow); if( !this._markupMode ){ this._modalShadow.parentNode.removeChild(this._modalShadow); this.destroy(); } else { Css.removeClassName( this._modalDiv, 'visible' ); Css.removeClassName( this._modalShadow, 'visible' ); this._waitForFade(this._modalShadow, Ink.bind(function () { this._modalShadowStyle.display = 'none'; }, this)); } openModals = InkArray.remove(openModals, InkArray.keyValue(this, openModals), 1); if (openModals.length === 0) { // Document level stuff now there are no modals in play. var htmlEl = document.documentElement; // Reenable scroll if(this._options.disableScroll) { htmlEl.style.overflowX = this._oldHtmlOverflows[0]; htmlEl.style.overflowY = this._oldHtmlOverflows[1]; } // Remove the class from the HTML element. Css.removeClassName(htmlEl, 'ink-modal-is-open'); } }, /** * Utility function to listen to the onTransmissionEnd event, or wait using setTimeouts * * Specific to this._element */ _waitForFade: function (elem, callback) { if (!opacitySupported) { return callback(); } var transitionEndEventNames = [ 'transitionEnd', 'oTransitionEnd', 'webkitTransitionEnd']; var classicName; var evName; for (var i = 0, len = transitionEndEventNames.length; i < len; i++) { evName = transitionEndEventNames[i]; classicName = 'on' + evName.toLowerCase(); if (classicName in elem) { Event.observeOnce(elem, evName, callback); return; } } var fadeChecker = function () { if( +Css.getStyle(elem, 'opacity') > 0 ){ setTimeout(fadeChecker, 250); } else { callback(); } }; setTimeout(fadeChecker, 500); }, /** * Removes the modal from the DOM * * @method destroy * @public */ destroy: function() { Common.unregisterInstance(this._instanceId); }, /** * Returns the content DOM element * * @method getContentElement * @return {DOMElement} Modal main cointainer. * @public */ getContentElement: function() { return this._contentContainer; }, /** * Replaces the content markup * * @method setContentMarkup * @param {String} contentMarkup * @public */ setContentMarkup: function(contentMarkup) { if( !this._markupMode ){ this._modalDiv.innerHTML = [contentMarkup].join(''); this._contentContainer = Selector.select(".modal-body",this._modalDiv); if( !this._contentContainer.length ){ // throw 'Missing div with class "modal-body"'; var tempHeader = Selector.select(".modal-header",this._modalDiv); var tempFooter = Selector.select(".modal-footer",this._modalDiv); InkArray.each(tempHeader, InkElement.remove); InkArray.each(tempFooter, InkElement.remove); var body = document.createElement('div'); Css.addClassName(body,'modal-body'); body.innerHTML = this._modalDiv.innerHTML; this._modalDiv.innerHTML = ''; var toAdd = tempHeader.concat([body]).concat(tempFooter); InkArray.each(toAdd, Ink.bindMethod(this._modalDiv, 'appendChild')); // InkArray.each(tempHeader,Ink.bind(function( element ){ this._modalDiv.appendChild(element); },this)); // this._modalDiv.appendChild(body); // InkArray.each(tempFooter,Ink.bind(function( element ){ this._modalDiv.appendChild(element); },this)); this._contentContainer = Selector.select(".modal-body",this._modalDiv); } this._contentContainer = this._contentContainer[0]; } else { this._contentContainer.innerHTML = contentMarkup; } this._contentElement = this._modalDiv; this._resizeContainer(); } }; return Modal; }); /** * @module Ink.UI.Pagination_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.Pagination', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1'], function(Common, Event, Css, Element, Selector ) { 'use strict'; /** * Function to create the pagination anchors * * @method genAel * @param {String} inner HTML to be placed inside the anchor. * @return {DOMElement} Anchor created */ var genAEl = function(inner, index) { var aEl = document.createElement('a'); aEl.setAttribute('href', '#'); if (index !== undefined) { aEl.setAttribute('data-index', index); } aEl.innerHTML = inner; return aEl; }; /** * @class Ink.UI.Pagination * @constructor * @version 1 * @param {String|DOMElement} selector * @param {Object} options Options * @param {Number} [options.size] number of pages. * @param {Number} [options.totalItemCount] Total numeber of items to display * @param {Number} [options.itemsPerPage] number of items per page. * @param {Number} [options.maxSize] If passed, only shows at most maxSize items. displays also first|prev page and next page|last buttons * @param {Number} [options.start] start page. defaults to 1 * @param {String} [options.firstLabel] label to display on first page button * @param {String} [options.lastLabel] label to display on last page button * @param {String} [options.previousLabel] label to display on previous button * @param {String} [options.nextLabel] label to display on next button * @param {String} [options.previousPageLabel] label to display on previous page button * @param {String} [options.nextPageLabel] label to display on next page button * @param {Function} [options.onChange] optional callback. Called with `(thisPaginator, newPageNumber)`. * @param {String} [options.hashParameter] parameter to use on setHash. by default uses 'page' * @param {String} [options.parentTag] HTML Tag used as the parent node. * @param {String} [options.childTag] HTML Tag used as the child nodes. * @param {String} [options.wrapperClass] CSS Class used in the wrapper element * @param {String} [options.paginationClass] CSS Class used in the pagination element * @param {String} [options.activeClass] CSS Class used to mark page as active * @param {String} [options.disabledClass] CSS Class used to mark page as disabled * @param {String} [options.hideClass] CSS Class used to hide elements * @param {String} [options.previousClass] CSS Class used in the previous element * @param {String} [options.previousPageClass] CSS Class used in the previous page element * @param {String} [options.nextClass] CSS Class used in the next element * @param {String} [options.nextPageClass] CSS Class used in the next page element * @param {Function} [options.numberFormatter] optional function which takes and 0-indexed number and returns the string which appears on a numbered button */ var Pagination = function(selector, options) { this._element = Common.elOrSelector(selector, 'Ink.UI.Pagination element'); this._options = Common.options('Ink.UI.Pagination_1', { size: ['Integer', null], totalItemCount: ['Integer', null], itemsPerPage: ['Integer', null], maxSize: ['Integer', null], start: ['Integer', 1], firstLabel: ['String', 'First'], lastLabel: ['String', 'Last'], previousLabel: ['String', 'Previous'], nextLabel: ['String', 'Next'], previousPageLabel: ['String', null], nextPageLabel: ['String', null], onChange: ['Function', undefined], hashParameter: ['String', 'page'], parentTag: ['String', 'ul'], childTag: ['String', 'li'], wrapperClass: ['String', 'ink-navigation'], paginationClass: ['String', 'pagination'], activeClass: ['String', 'active'], disabledClass: ['String', 'disabled'], hideClass: ['String', 'hide-all'], previousClass: ['String', 'previous'], previousPageClass: ['String', 'previousPage'], nextClass: ['String', 'next'], nextPageClass: ['String', 'nextPage'], numberFormatter: ['Function', function(i) { return i + 1; }] }, options || {}, this._element); if (!this._options.previousPageLabel) { this._options.previousPageLabel = this._options.previousLabel + ' ' + this._options.maxSize; } if (!this._options.nextPageLabel) { this._options.nextPageLabel = this._options.nextLabel + ' ' + this._options.maxSize; } this._handlers = { click: Ink.bindEvent(this._onClick,this) }; if (Common.isInteger(this._options.totalItemCount) && Common.isInteger(this._options.itemsPerPage)) { this._size = Math.ceil(this._options.totalItemCount / this._options.itemsPerPage); } else if (Common.isInteger(this._options.size)) { this._size = this._options.size; } else { throw new TypeError('Ink.UI.Pagination: Please supply a size option or totalItemCount and itemsPerPage options.'); } if (!Common.isInteger(this._options.start) && this._options.start > 0 && this._options.start <= this._size) { throw new TypeError('start option is a required integer between 1 and size!'); } if (this._options.maxSize && !Common.isInteger(this._options.maxSize) && this._options.maxSize > 0) { throw new TypeError('maxSize option is a positive integer!'); } else if (this._size < 0) { throw new RangeError('size option must be equal or more than 0!'); } this.setOnChange(this._options.onChange); this._current = this._options.start - 1; this._itemLiEls = []; this._init(); }; Pagination.prototype = { /** * Init function called by the constructor * * @method _init * @private */ _init: function() { // generate and apply DOM this._generateMarkup(this._element); this._updateItems(); // subscribe events this._observe(); Common.registerInstance(this, this._element, 'pagination'); }, /** * Responsible for setting listener in the 'click' event of the Pagination element. * * @method _observe * @private */ _observe: function() { Event.observeDelegated(this._element, 'click', '.' + this._options.paginationClass + ' > ' + this._options.childTag, this._handlers.click); }, /** * Updates the markup everytime there's a change in the Pagination object. * * @method _updateItems * @private */ _updateItems: function() { var liEls = this._itemLiEls; var isSimpleToggle = this._size === liEls.length; var i, f, liEl; if (isSimpleToggle) { // just toggle active class for (i = 0, f = this._size; i < f; ++i) { Css.setClassName(liEls[i], this._options.activeClass, i === this._current); } } else { // remove old items for (i = liEls.length - 1; i >= 0; --i) { this._ulEl.removeChild(liEls[i]); } // add new items liEls = []; for (i = 0, f = this._size; i < f; ++i) { liEl = document.createElement(this._options.childTag); liEl.appendChild( genAEl( this._options.numberFormatter(i), i) ); Css.setClassName(liEl, this._options.activeClass, i === this._current); this._ulEl.insertBefore(liEl, this._nextEl); liEls.push(liEl); } this._itemLiEls = liEls; } if (this._options.maxSize) { // toggle visible items var page = Math.floor( this._current / this._options.maxSize ); var pi = this._options.maxSize * page; var pf = pi + this._options.maxSize - 1; for (i = 0, f = this._size; i < f; ++i) { liEl = liEls[i]; Css.setClassName(liEl, this._options.hideClass, i < pi || i > pf); } this._pageStart = pi; this._pageEnd = pf; this._page = page; Css.setClassName(this._prevPageEl, this._options.disabledClass, !this.hasPreviousPage()); Css.setClassName(this._nextPageEl, this._options.disabledClass, !this.hasNextPage()); Css.setClassName(this._firstEl, this._options.disabledClass, this.isFirst()); Css.setClassName(this._lastEl, this._options.disabledClass, this.isLast()); } // update prev and next Css.setClassName(this._prevEl, this._options.disabledClass, !this.hasPrevious()); Css.setClassName(this._nextEl, this._options.disabledClass, !this.hasNext()); }, /** * Returns the top element for the gallery DOM representation * * @method _generateMarkup * @param {DOMElement} el * @private */ _generateMarkup: function(el) { Css.addClassName(el, 'ink-navigation'); var ulEl,liEl, hasUlAlready = false; if( ( ulEl = Selector.select('.' + this._options.paginationClass,el)).length < 1 ){ ulEl = document.createElement(this._options.parentTag); Css.addClassName(ulEl, this._options.paginationClass); } else { hasUlAlready = true; ulEl = ulEl[0]; } if (this._options.maxSize) { liEl = document.createElement(this._options.childTag); liEl.appendChild( genAEl(this._options.firstLabel) ); this._firstEl = liEl; Css.addClassName(liEl, this._options.firstClass); ulEl.appendChild(liEl); liEl = document.createElement(this._options.childTag); liEl.appendChild( genAEl(this._options.previousPageLabel) ); this._prevPageEl = liEl; Css.addClassName(liEl, this._options.previousPageClass); ulEl.appendChild(liEl); } liEl = document.createElement(this._options.childTag); liEl.appendChild( genAEl(this._options.previousLabel) ); this._prevEl = liEl; Css.addClassName(liEl, this._options.previousClass); ulEl.appendChild(liEl); liEl = document.createElement(this._options.childTag); liEl.appendChild( genAEl(this._options.nextLabel) ); this._nextEl = liEl; Css.addClassName(liEl, this._options.nextClass); ulEl.appendChild(liEl); if (this._options.maxSize) { liEl = document.createElement(this._options.childTag); liEl.appendChild( genAEl(this._options.nextPageLabel) ); this._nextPageEl = liEl; Css.addClassName(liEl, this._options.nextPageClass); ulEl.appendChild(liEl); liEl = document.createElement(this._options.childTag); liEl.appendChild( genAEl(this._options.lastLabel) ); this._lastEl = liEl; Css.addClassName(liEl, this._options.lastClass); ulEl.appendChild(liEl); } if( !hasUlAlready ){ el.appendChild(ulEl); } this._ulEl = ulEl; }, /** * Click handler * * @method _onClick * @param {Event} ev * @private */ _onClick: function(ev) { Event.stop(ev); var liEl = Event.element(ev); if ( Css.hasClassName(liEl, this._options.activeClass) || Css.hasClassName(liEl, this._options.disabledClass) ) { return; } var isPrev = Css.hasClassName(liEl, this._options.previousClass); var isNext = Css.hasClassName(liEl, this._options.nextClass); var isPrevPage = Css.hasClassName(liEl, this._options.previousPageClass); var isNextPage = Css.hasClassName(liEl, this._options.nextPageClass); var isFirst = Css.hasClassName(liEl, this._options.firstClass); var isLast = Css.hasClassName(liEl, this._options.lastClass); if (isFirst) { this.setCurrent(0); } else if (isLast) { this.setCurrent(this._size - 1); } else if (isPrevPage || isNextPage) { this.setCurrent( (isPrevPage ? -1 : 1) * this._options.maxSize, true); } else if (isPrev || isNext) { this.setCurrent(isPrev ? -1 : 1, true); } else { var aElem = Ink.s('[data-index]', liEl); var nr = parseInt( aElem.getAttribute('data-index'), 10); this.setCurrent(nr); } }, /** * Allows you to subscribe to the onChange event * * @method setOnChange * @param cb {Function} Callback called with `(thisPaginator, newPageNumber)`. */ setOnChange: function (onChange) { if (onChange !== undefined && typeof onChange !== 'function') { throw new TypeError('onChange option must be a function!'); } this._onChange = onChange; }, /************** * PUBLIC API * **************/ /** * Sets the number of pages * * @method setSize * @param {Number} sz number of pages * @public */ setSize: function(sz) { if (!Common.isInteger(sz)) { throw new TypeError('1st argument must be an integer number!'); } this._size = sz; this._updateItems(); this._current = 0; }, /** * Calculate the number of pages, then call setSize(). * * @param setSizeInItems * @param {Number} totalItems * @param {Number} itemsPerPage */ setSizeInItems: function (totalItems, itemsPerPage) { var pageNumber = Math.ceil(totalItems / itemsPerPage); this.setSize(pageNumber); }, /** * Sets the current page * * @method setCurrent * @param {Number} nr sets the current page to given number * @param {Boolean} isRelative trueish to set relative change instead of absolute (default) * @public */ setCurrent: function(nr, isRelative) { if (!Common.isInteger(nr)) { throw new TypeError('1st argument must be an integer number!'); } if (isRelative) { nr += this._current; } if (nr > this._size - 1) { nr = this._size - 1; } if (nr < 0) { nr = 0; } this._current = nr; this._updateItems(); if (this._onChange) { this._onChange(this, nr); } /*if (this._options.setHash) { var o = {}; o[this._options.hashParameter] = nr; Common.setHash(o); }*/ // undocumented option, removing }, /** * Returns the number of pages * * @method getSize * @return {Number} Number of pages * @public */ getSize: function() { return this._size; }, /** * Returns current page * * @method getCurrent * @return {Number} Current page * @public */ getCurrent: function() { return this._current; }, /** * Returns true iif at first page * * @method isFirst * @return {Boolean} True if at first page * @public */ isFirst: function() { return this._current === 0; }, /** * Returns true iif at last page * * @method isLast * @return {Boolean} True if at last page * @public */ isLast: function() { return this._current === this._size - 1; }, /** * Returns true iif has prior pages * * @method hasPrevious * @return {Boolean} True if has prior pages * @public */ hasPrevious: function() { return this._current > 0; }, /** * Returns true iif has pages ahead * * @method hasNext * @return {Boolean} True if has pages ahead * @public */ hasNext: function() { return this._current < this._size - 1; }, /** * Returns true iif has prior set of page(s) * * @method hasPreviousPage * @return {Boolean} Returns true iif has prior set of page(s) * @public */ hasPreviousPage: function() { return this._options.maxSize && this._current > this._options.maxSize - 1; }, /** * Returns true iif has set of page(s) ahead * * @method hasNextPage * @return {Boolean} Returns true iif has set of page(s) ahead * @public */ hasNextPage: function() { return this._options.maxSize && this._size - this._current >= this._options.maxSize + 1; }, /** * Unregisters the component and removes its markup from the DOM * * @method destroy * @public */ destroy: Common.destroyComponent }; return Pagination; }); /** * @module Ink.UI.ProgressBar_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.ProgressBar', '1', ['Ink.Dom.Selector_1','Ink.Dom.Element_1'], function( Selector, Element ) { 'use strict'; /** * Associated to a .ink-progress-bar element, it provides the necessary * method - setValue() - for the user to change the element's value. * * @class Ink.UI.ProgressBar * @constructor * @version 1 * @param {String|DOMElement} selector * @param {Object} [options] Options * @param {Number} [options.startValue] Percentage of the bar that is filled. Range between 0 and 100. Default: 0 * @param {Function} [options.onStart] Callback that is called when a change of value is started * @param {Function} [options.onEnd] Callback that is called when a change of value ends * * @example * <div class="ink-progress-bar grey" data-start-value="70%"> * <span class="caption">I am a grey progress bar</span> * <div class="bar grey"></div> * </div> * <script> * Ink.requireModules( ['Ink.Dom.Selector_1','Ink.UI.ProgressBar_1'], function( Selector, ProgressBar ){ * var progressBarElement = Ink.s('.ink-progress-bar'); * var progressBarObj = new ProgressBar( progressBarElement ); * }); * </script> */ var ProgressBar = function( selector, options ){ if( typeof selector !== 'object' ){ if( typeof selector !== 'string' ){ throw '[Ink.UI.ProgressBar] :: Invalid selector'; } else { this._element = Selector.select(selector); if( this._element.length < 1 ){ throw "[Ink.UI.ProgressBar] :: Selector didn't find any elements"; } this._element = this._element[0]; } } else { this._element = selector; } this._options = Ink.extendObj({ 'startValue': 0, 'onStart': function(){}, 'onEnd': function(){} },Element.data(this._element)); this._options = Ink.extendObj( this._options, options || {}); this._value = this._options.startValue; this._init(); }; ProgressBar.prototype = { /** * Init function called by the constructor * * @method _init * @private */ _init: function(){ this._elementBar = Selector.select('.bar',this._element); if( this._elementBar.length < 1 ){ throw '[Ink.UI.ProgressBar] :: Bar element not found'; } this._elementBar = this._elementBar[0]; this._options.onStart = Ink.bind(this._options.onStart,this); this._options.onEnd = Ink.bind(this._options.onEnd,this); this.setValue( this._options.startValue ); }, /** * Sets the value of the Progressbar * * @method setValue * @param {Number} newValue Numeric value, between 0 and 100, that represents the percentage of the bar. * @public */ setValue: function( newValue ){ this._options.onStart( this._value); newValue = parseInt(newValue,10); if( isNaN(newValue) || (newValue < 0) ){ newValue = 0; } else if( newValue>100 ){ newValue = 100; } this._value = newValue; this._elementBar.style.width = this._value + '%'; this._options.onEnd( this._value ); } }; return ProgressBar; }); /** * @module Ink.UI.SmoothScroller_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.SmoothScroller', '1', ['Ink.Dom.Event_1','Ink.Dom.Selector_1','Ink.Dom.Loaded_1'], function(Event, Selector, Loaded) { 'use strict'; var requestAnimationFrame = window.requestAnimationFrame || function (cb) { return setTimeout(cb, 10); }; var cancelAnimationFrame = window.cancelAnimationFrame || function (id) { clearTimeout(id); }; /** * @class Ink.UI.SmoothScroller * @version 1 * @static * * @example * * <a href="#part1" class="ink-smooth-scroll">go to Part 1</a> * * [lots and lots of content...] * * <h1 id="part1">Part 1</h1> * * <script> * // ...Although you don't need to do this if you have autoload.js * Ink.requireModules(['Ink.UI.SmoothScroller_1'], function (SmoothScroller) { * SmoothScroller.init('.ink-smooth-scroll'); * }) * </script> */ var SmoothScroller = { /** * Sets the speed of the scrolling * * @property speed * @type {Number} * @readOnly * @static */ speed: 10, /** * Returns the Y position of an element, relative to the document * * @method getTop * @param {DOMElement} d DOMElement to get the Y position from * @return {Number} Y position of div 'd' * @public * @static */ getTop: function(d) { return Math.round( SmoothScroller.scrollTop() + d.getBoundingClientRect().top); }, /** * Returns the current scroll position * * @method scrollTop * @return {Number} Current scroll position * @public * @static */ scrollTop: function() { var body = document.body, d = document.documentElement; if (body && body.scrollTop){ return body.scrollTop; } if (d && d.scrollTop){ return d.scrollTop; } if (window.pageYOffset){ return window.pageYOffset; } return 0; }, /** * Attaches an event for an element * * @method add * @param {DOMElement} el DOMElement to make the listening of the event * @param {String} event Event name to be listened * @param {DOMElement} fn Callback function to run when the event is triggered. * @public * @static */ add: function(el, event, fn) { Event.observe(el,event,fn); }, /** * Kill an event of an element * * @method end * @param {String} e Event to be killed/stopped * @public * @static */ // kill an event of an element end: function(e) { Event.stopDefault(e); }, /** * Moves the scrollbar to the target element. This is the function * which animates the scroll position bit by bit. It calls itself in * the end through requestAnimationFrame * * @method scroll * @param {Number} d Y coordinate value to stop * @public * @static */ scroll: function(d) { var a = SmoothScroller.scrollTop(); if (d > a) { a += Math.ceil((d - a) / SmoothScroller.speed); } else { a = a + (d - a) / SmoothScroller.speed; } window.scrollTo(0, a); cancelAnimationFrame(SmoothScroller.interval); if (!((a) === d || SmoothScroller.offsetTop === a)) { SmoothScroller.interval = requestAnimationFrame( Ink.bindMethod(SmoothScroller, 'scroll', d), document.body); } else { SmoothScroller.onDone(); } SmoothScroller.offsetTop = a; }, /** * Has smooth scrolling applied to relevant elements upon page load. * * @method init * @param [selector='a.scrollableLink,a.ink-smooth-scroll'] Selector string for finding links with smooth scrolling enabled. * @public * @static */ init: function(selector) { Loaded.run(Ink.bindMethod(SmoothScroller, 'render', selector)); }, /** * This method extracts all the anchors and validates them as # and attaches the events * * @method render * @public * @static */ render: function(selector) { var a = Selector.select(selector || 'a.scrollableLink,a.ink-smooth-scroll'); for (var i = 0; i < a.length; i++) { var _elm = a[i]; if (_elm.href && _elm.href.indexOf('#') !== -1 && ((_elm.pathname === location.pathname) || ('/' + _elm.pathname === location.pathname))) { Event.observe(_elm,'click', Ink.bindEvent(SmoothScroller.onClick, this, _elm)); } } }, /** * Click handler * * @method onClick * @public * @static */ onClick: function(event, _elm) { SmoothScroller.end(event); if(_elm !== null && _elm.getAttribute('href') !== null) { var hashIndex = _elm.href.indexOf('#'); if (hashIndex === -1) { return; } var hash = _elm.href.substr((hashIndex + 1)); var activeLiSelector = 'ul > li.active > ' + selector; var selector = 'a[name="' + hash + '"],#' + hash; var elm = Selector.select(selector)[0]; var activeLi = Selector.select(activeLiSelector)[0]; activeLi = activeLi && activeLi.parentNode; if (typeof(elm) !== 'undefined') { if (_elm.parentNode.className.indexOf('active') === -1) { if (activeLi) { activeLi.className = activeLi.className.replace(/(^|\s+)active($|\s+)/g, ''); } _elm.parentNode.className += " active"; } SmoothScroller.hash = hash; SmoothScroller.scroll(SmoothScroller.getTop(elm)); } } }, /** * Called when the scroll movement is done. Updates browser address. */ onDone: function () { window.location.hash = SmoothScroller.hash; } }; return SmoothScroller; }); /** * @module Ink.UI.SortableList_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.SortableList', '1', ['Ink.UI.Common_1','Ink.Dom.Css_1','Ink.Dom.Event_1','Ink.Dom.Element_1','Ink.Dom.Selector_1'], function( Common, Css, Events, Element, Selector ) { 'use strict'; var hasTouch = (('ontouchstart' in window) || // html5 browsers (navigator.maxTouchPoints > 0) || // future IE (navigator.msMaxTouchPoints > 0)); /** * Adds sortable behaviour to any list! * * @class Ink.UI.SortableList * @constructor * @version 1 * @param {String|DOMElement} selector * @param {String} [options.placeholderClass='placeholder'] CSS class to be added to the "ghost" element being dragged around * @param {String} [options.draggedClass='hide-all'] CSS class added to the original element. * @param {String} [options.draggingClass='dragging'] CSS class added to the html element when the user is dragging. * @param {String} [options.dragSelector='li'] CSS selector for the drag enabled nodes. * @param {String} [options.handleSelector=null] CSS selector for the drag handle. If present, you can only drag nodes by this selector. * @param {String} [options.moveSelector=null] CSS selector to validate a node move. If present, you can only move nodes into this selector. * @param {Boolean} [options.swap=false] Flag to swap moving element with target element instead of changing its order. * @param {Boolean} [options.cancelMouseOut=false] Flag to cancel moving if mouse leaves the container element. * @example * <ul class="unstyled ink-sortable-list" id="slist" data-handle-selector=".ink-label"> * <li><span class="ink-label info">drag here</span>primeiro</li> * <li><span class="ink-label info">drag here</span>segundo</li> * <li><span class="ink-label info">drag here</span>terceiro</li> * </ul> * <script> * Ink.requireModules( ['Ink.Dom.Selector_1','Ink.UI.SortableList_1'], function( Selector, SortableList ){ * var sortableListElement = Ink.s('.ink-sortable-list'); * var sortableListObj = new SortableList( sortableListElement ); * }); * <\/script> */ var SortableList = function(selector, options) { this._element = Common.elOrSelector(selector, 'Ink.UI.SortableList'); this._options = Common.options('Sortable', { 'placeholderClass': ['String', 'placeholder'], 'draggedClass': ['String', 'hide-all'], 'draggingClass': ['String', 'dragging'], 'dragSelector': ['String', 'li'], 'dragObject': ['String', null], // Deprecated. Use handleSelector instead. 'handleSelector': ['String', null], 'moveSelector': ['String', false], 'swap': ['Boolean', false], 'cancelMouseOut': ['Boolean', false] }, options || {}, this._element); if (this._options.dragObject != null) { // [3.0.0] Remove this deprecation notice and stop providing backwards compatibility Ink.warn('Ink.UI.SortableList: options.dragObject is now deprecated. ' + 'Please use options.handleSelector instead.'); this._options.handleSelector = this._options.handleSelector || this._options.dragObject; } this._handlers = { down: Ink.bind(this._onDown, this), move: Ink.bind(this._onMove, this), up: Ink.bind(this._onUp, this) }; this._isMoving = false; this._init(); }; SortableList.prototype = { /** * Init function called by the constructor. * * @method _init * @private */ _init: function() { this._down = hasTouch ? 'touchstart mousedown' : 'mousedown'; this._move = hasTouch ? 'touchmove mousemove' : 'mousemove'; this._up = hasTouch ? 'touchend mouseup' : 'mouseup'; this._observe(); Common.registerInstance(this, this._element, 'sortableList'); }, /** * Sets the event handlers. * * @method _observe * @private */ _observe: function() { Events.on(this._element, this._down, this._options.dragSelector, this._handlers.down); Events.on(this._element, this._move, this._options.dragSelector, this._handlers.move); if(this._options.cancelMouseOut) { Events.on(this._element, 'mouseleave', Ink.bind(this.stopMoving, this)); } Events.on(document.documentElement, this._up, this._handlers.up); }, /** * Mousedown or touchstart handler * * @method _onDown * @param {Event} ev * @private */ _onDown: function(ev) { if (this._isMoving || this._placeholder) { return; } if(this._options.handleSelector && !Selector.matchesSelector(ev.target, this._options.handleSelector)) { return; } var tgtEl = ev.currentTarget; this._isMoving = tgtEl; this._placeholder = tgtEl.cloneNode(true); this._movePlaceholder(tgtEl); this._addMovingClasses(); return false; }, /** * Mousemove or touchmove handler * * @method _onMove * @param {Event} ev * @private */ _onMove: function(ev) { this.validateMove(ev.currentTarget); return false; }, /** * Mouseup or touchend handler * * @method _onUp * @param {Event} ev * @private */ _onUp: function(ev) { if (!this._isMoving || !this._placeholder) { return; } if (ev.currentTarget === this._isMoving) { return; } if (ev.currentTarget === this._placeholder) { return; } Element.insertBefore(this._isMoving, this._placeholder); this.stopMoving(); return false; }, /** * Adds the CSS classes to interactive elements * * @method _addMovingClasses * @private */ _addMovingClasses: function(){ Css.addClassName(this._placeholder, this._options.placeholderClass); Css.addClassName(this._isMoving, this._options.draggedClass); Css.addClassName(document.documentElement, this._options.draggingClass); }, /** * Removes the CSS classes from interactive elements * * @method _removeMovingClasses * @private */ _removeMovingClasses: function(){ if(this._isMoving) { Css.removeClassName(this._isMoving, this._options.draggedClass); } if(this._placeholder) { Css.removeClassName(this._placeholder, this._options.placeholderClass); } Css.removeClassName(document.documentElement, this._options.draggingClass); }, /** * Moves the placeholder element relative to the target element * * @method _movePlaceholder * @param {Element} target_position * @private */ _movePlaceholder: function(target){ var placeholder = this._placeholder, target_position, placeholder_position, from_top, from_left; if(!placeholder) { Element.insertAfter(placeholder, target); } else if(this._options.swap){ Element.insertAfter(placeholder, target); Element.insertBefore(target, this._isMoving); Element.insertBefore(this._isMoving, placeholder); } else { target_position = Element.offset(target); placeholder_position = Element.offset(this._placeholder); from_top = target_position[1] > placeholder_position[1]; from_left = target_position[0] > placeholder_position[0]; if( ( from_top && from_left ) || ( !from_top && !from_left ) ) { Element.insertBefore(placeholder, target); } else { Element.insertAfter(placeholder, target); } Element.insertBefore(this._isMoving, placeholder); } }, /************** * PUBLIC API * **************/ /** * Unregisters the component and removes its markup from the DOM * * @method destroy * @public */ destroy: Common.destroyComponent, /** * Visually stops moving. Removes the placeholder as well as the styling classes. * * @method _movePlaceholder * @public */ stopMoving: function(){ this._removeMovingClasses(); Element.remove(this._placeholder); this._placeholder = false; this._isMoving = false; }, /** * Validation method for the move handler * * @method _movePlaceholder * @param {Element} elem * @public */ validateMove: function(elem){ if (!this._isMoving || !this._placeholder) { return; } if (elem === this._placeholder) { return; } if (elem === this._isMoving) { return; } if(!this._options.moveSelector || Selector.matchesSelector(elem, this._options.moveSelector)){ this._movePlaceholder(elem); } else { this.stopMoving(); } } }; return SortableList; }); /** * @module Ink.UI.Spy_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.Spy', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1'], function(Common, Event, Css, Element, Selector ) { 'use strict'; // Maps a spy target (EG a menu with links inside) to spied instances. var spyTargets = [ // [target, [spied, spied, spied...]], ... ]; function targetIndex(target) { for (var i = 0, len = spyTargets.length; i < len; i++) { if (spyTargets[i][0] === target) { return i; } } return null; } function addSpied(spied, target) { var index = targetIndex(target); if (index === null) { spyTargets.push([target, [spied]]); } else { spyTargets[index][1].push(spied); } } var observingOnScroll = false; function observeOnScroll() { if (!observingOnScroll) { observingOnScroll = true; Event.observe(document, 'scroll', Event.throttle(onScroll, 300)); } } function onScroll() { for (var i = 0, len = spyTargets.length; i < len; i++) { onScrollForTarget(spyTargets[i][0], spyTargets[i][1]); } } function onScrollForTarget(target, spied) { var activeEl = findActiveElement(spied); // This selector finds li's to deactivate var toDeactivate = Selector.select('li.active', target); for (var i = 0, total = toDeactivate.length; i < total; i++) { Css.removeClassName(toDeactivate[i], 'active'); } if (activeEl === null) { return; } // The link which should be activated has a "href" ending with "#" + name or id of the element var menuLinkSelector = 'a[href$="#' + (activeEl.name || activeEl.id) + '"]'; var toActivate = Selector.select(menuLinkSelector, target); for (i = 0, total = toActivate.length; i < total; i++) { Css.addClassName(Element.findUpwardsByTag(toActivate[i], 'li'), 'active'); } } function findActiveElement(spied) { /* * Find the element above the top of the screen, but closest to it. * _____ * |_____| element 1 (active element) * * --- * _____ | * | | element 2 | viewport visible area * | | | * |_____| | * --- */ // Remember that getBoundingClientRect returns coordinates // relative to the top left corner of the screen. // // So checking if it's < 0 is used to tell if // the element is above the top of the screen. var closest = -Infinity; var closestIndex; var bBox; for( var i = 0, total = spied.length; i < total; i++ ){ bBox = spied[i].getBoundingClientRect(); if (bBox.top <= 0 && bBox.top > closest) { closest = bBox.top; closestIndex = i; } } if (closestIndex === undefined) { return null; } else { return spied[closestIndex]; } } /** * Spy is a component that 'spies' an element (or a group of elements) and when they leave the viewport (through the top), * highlight an option - related to that element being spied - that resides in a menu, initially identified as target. * * @class Ink.UI.Spy * @constructor * @version 1 * @param {String|DOMElement} selector * @param {Object} [options] Options * @param {DOMElement|String} options.target Target menu on where the spy will highlight the right option. * TODO @xparam {String} [options.activeClass='active'] Class which marks the "li" as active. * @example * <script> * Ink.requireModules( ['Ink.Dom.Selector_1','Ink.UI.Spy_1'], function( Selector, Spy ){ * var menuElement = Ink.s('#menu'); * var specialAnchorToSpy = Ink.s('#specialAnchor'); * var spyObj = new Spy( specialAnchorToSpy, { * target: menuElement * }); * }); * </script> */ var Spy = function( selector, options ){ this._rootElement = Common.elOrSelector(selector,'1st argument'); /** * Setting default options and - if needed - overriding it with the data attributes */ this._options = Ink.extendObj({ target: undefined, activeClass: 'active' }, Element.data( this._rootElement ) ); /** * In case options have been defined when creating the instance, they've precedence */ this._options = Ink.extendObj(this._options,options || {}); this._options.target = Common.elOrSelector( this._options.target, 'Target' ); this._init(); }; Spy.prototype = { /** * Init function called by the constructor * * @method _init * @private */ _init: function() { addSpied(this._rootElement, this._options.target); observeOnScroll(); onScroll(); } }; return Spy; }); /** * @module Ink.UI.Stacker_1 **/ Ink.createModule('Ink.UI.Stacker', 1, ['Ink.UI.Common_1', 'Ink.Dom.Event_1', 'Ink.Dom.Element_1'], function(InkUICommon, InkEvent, InkElement) { 'use strict'; function Stacker(selector, options) { this._init(selector, options); } Stacker.prototype = { /** * This module combines several stacks of items together, in smaller screen sizes. * * The purpose is to have several stacks of items which may have different heights and as such cannot be used because of `float: left` quirks. * * For example, when you have three different columns of information: * * [col. A: 1] [col. B: 1] [col. C: 1] * [col. B: 2] [col. C: 2] [col. C: 2] * * and the screen resizes and you need a layout of 2 columns, Stacker reorders the stacks so that you get: * * [col. A: 1] [col. B: 1] * [col. C: 1] [col. A: 2] * [col. B: 2] [col. C: 2] * * Note: If you just want to use a different amount of columns for your items in several viewports, but these items are guaranteed to have a fixed height, don't use this module. Use the `small-*`, `medium-*` and `large-*` classes instead. * * @class Ink.UI.Stacker_1 * * @constructor * @param [container] {DOMElement|String} Element which contains the stacks (identified by the options.column selector) * @param [options] * @param [options.column='.stacker-column'] {String} Select the columns inside the `container` * @param [options.item='.stacker-item'] {String} Select items in your stack * * @param [options.customBreakPoints] {Object} options for each breakpoint name. Use this if you have more breakpoints than Ink by default (`large`, `medium`, `small`) * @param [options.customBreakpoints.(breakpoint)] {Object} * @param options.customBreakpoints.(breakpoint).max Maximum screen size as seen in your media query * @param options.customBreakpoints.(breakpoint).min Minimum screen size as seen in your media query * @param options.customBreakpoints.(breakpoint).cols Column count for this size. * * @param [options.largeMax] {Number} Upper bound of `large` breakpoint * @param [options.largeMin=961] {Number} Lower bound of `large` breakpoint * @param [options.mediumMax=960] {Number} Upper bound of `medium` breakpoint * @param [options.mediumMin=651] {Number} Lower bound of `medium` breakpoint * @param [options.smallMax=650] {Number} Upper bound of `small` breakpoint * @param [options.smallMin] {Number} Lower bound of `small` breakpoint * * @param [options.largeCols=3] {Integer} Number of columns in the `large` viewport * @param [options.mediumCols=2] {Integer} Number of columns in the `medium` viewport * @param [options.smallCols=1] {Integer} Number of columns in the `small` viewport * * @param [options.isOrdered=true] {Boolean} When `false`, do not reorder stacks when combining them. * @param [options.onRunCallback] {Function} Called when instantiated * @param [options.onResizeCallback] {Function} Called when resized because the window resized. * @param [options.onAPIReloadCallback] {Function} Called when you ask to reload stack items from the DOM. * * @example * * Html: * * <div id="stacker-container"> <!-- Stacker element --> * <div class="large-33 medium-50 small-100 stacker-column"> <!-- Column element ('.stacker-column' is the default selector) --> * <div id="a" class="stacker-item">a</div> <!-- Item ('.stacker-item' is the default selector) --> * <div id="d" class="stacker-item">d</div> * <div id="g" class="stacker-item">g</div> * </div> * <div class="large-33 medium-50 small-100 hide-small stacker-column"> * <div id="b" class="stacker-item">b</div> * <div id="e" class="stacker-item">e</div> * <div id="h" class="stacker-item">h</div> * </div> * <div class="large-33 medium-50 small-100 hide-medium hide-small stacker-column"> * <div id="c" class="stacker-item">c</div> * <div id="f" class="stacker-item">f</div> * <div id="i" class="stacker-item">i</div> * </div> * </div> * * Javascript: * * Ink.requireModules(['Ink.UI.Stacker_1'], function (Stacker) { * var stacker = new Stacker('#stacker-container'); * // Keep the "stacker" variable around if you want to call addItem and reloadItems * }); **/ _init: function(selector, options) { /* globals console */ this._rootElm = InkUICommon.elsOrSelector(selector, 'Ink.UI.Stacker root element')[0] || null; if(this._rootElm === null) { if(typeof console !== 'undefined') { console.warn('Ink.UI.Stacker: No root element'); } } this._options = InkUICommon.options({ column: ['String', '.stacker-column'], item: ['String', '.stacker-item'], // [3.0.0] review this when we have info about our breakpoints from the CSS customBreakPoints: ['Object', null], // Must be: {xlarge: {max: 9999, min: 1281, cols: 5}, large:{max:1280, min:1001, cols:4} medium:{max:1000, min:801,cols:3}, ...etc..} largeMax: ['Number', Number.MAX_VALUE], largeMin: ['Number', 961], mediumMax: ['Number', 960], mediumMin: ['Number', 651], smallMax: ['Number', 650], smallMin: ['Number', 0], largeCols: ['Integer', 3], mediumCols: ['Integer', 2], smallCols: ['Integer', 1], isOrdered: ['Boolean', true], onRunCallback: ['Function', null], onResizeCallback: ['Function', null], onAPIReloadCallback: ['Function', null] }, options || {}, this._rootElm); this._aList = []; this._curLayout = 'large'; // [todo] is this needed? this._runFirstTime = false; this._getPageItemsToList(); if(this._canApplyLayoutChange() || !this._runFirstTime) { this._runFirstTime = true; this._applyLayoutChange(); if(typeof(this._options.onRunCallback) === 'function') { this._options.onRunCallback(this._curLayout); } } this._addEvents(); }, /** * Add an item to the end of your stacks. Call `reloadItems()` when you are done adding items. * @method addItem * @param {DOMElement} item **/ addItem: function(item) { this._aList.push(item); }, /** * Update the layout of your items. * * Call this when: * * - The width has changed, but not because of the window resizing. * - You used addItem to add some items * * @method reloadItems **/ reloadItems: function() { this._applyLayoutChange(); if(typeof(this._options.onAPIReloadCallback) === 'function') { this._options.onAPIReloadCallback(this._curLayout); } }, _addEvents: function() { InkEvent.observe(window, 'resize', Ink.bindEvent(this._onResize, this)); }, _onResize: function() { if(this._canApplyLayoutChange()) { this._removeDomItems(); this._applyLayoutChange(); if(typeof(this._options.onResizeCallback) === 'function') { this._options.onResizeCallback(this._curLayout); } } }, _setCurLayout: function() { var viewportWidth = InkElement.viewportWidth(); if(this._options.customBreakpoints && typeof(this._options.customBreakPoints) === 'object') { for(var prop in this._options.customBreakPoints) { if(this._options.customBreakPoints.hasOwnProperty(prop)) { if(viewportWidth >= Number(this._options.customBreakPoints[prop].min) && viewportWidth <= Number(this._options.customBreakPoints[prop].max) && this._curLayout !== prop) { this._curLayout = prop; return; } } } } else { if(viewportWidth <= Number(this._options.largeMax) && viewportWidth >= Number(this._options.largeMin) && this._curLayout !== 'large') { this._curLayout = 'large'; } else if(viewportWidth >= Number(this._options.mediumMin) && viewportWidth <= Number(this._options.mediumMax) && this._curLayout !== 'medium') { this._curLayout = 'medium'; } else if(viewportWidth >= Number(this._options.smallMin) && viewportWidth <= Number(this._options.smallMax) && this._curLayout !== 'small') { this._curLayout = 'small'; } } }, _getColumnsToShow: function() { if(this._options.customBreakPoints && typeof(this._options.customBreakPoints) === 'object') { return Number(this._options.customBreakPoints[this._curLayout].cols); } else { return Number(this._options[this._curLayout+'Cols']); } }, _canApplyLayoutChange: function() { var curLayout = this._curLayout; this._setCurLayout(); if(curLayout !== this._curLayout) { return true; } return false; }, _getPageItemsToList: function() { this._aColumn = Ink.ss(this._options.column, this._rootElm); var totalCols = this._aColumn.length; var index = 0; if(totalCols > 0) { for(var i=0; i < this._aColumn.length; i++) { var aItems = Ink.ss(this._options.item, this._aColumn[i]); for(var j=0; j < aItems.length; j++) { if(this._options.isOrdered) { index = i + (j * totalCols); } this._aList[index] = aItems[j]; if(!this._options.isOrdered) { index++; } //aItems[j].style.height = (100 + (Math.random() * 100))+'px'; aItems[j].parentNode.removeChild(aItems[j]); } } if(this._aList.length > 0 && this._options.isOrdered) { var aNewList = []; for(var ii=0; ii < this._aList.length; ii++) { if(typeof(this._aList[ii]) !== 'undefined') { aNewList.push(this._aList[ii]); } } this._aList = aNewList; } } }, _removeDomItems: function() { var totalCols = this._aColumn.length; if(totalCols > 0) { for(var i=0; i < totalCols; i++) { var aItems = Ink.ss(this._options.item, this._aColumn[i]); for(var j=aItems.length - 1; j >= 0; j--) { aItems[j].parentNode.removeChild(aItems[j]); } } } }, _applyLayoutChange: function() { var totalCols = this._getColumnsToShow(); var totalItems = this._aList.length; var index = 0; var countCol = 0; if(totalCols > 0) { while(countCol < totalCols) { this._aColumn[countCol].appendChild(this._aList[index]); index++; countCol++; if(index === totalItems) { return; } if(countCol === totalCols) { countCol = 0; } } } } }; return Stacker; }); /** * @module Ink.UI.Sticky_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.Sticky', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.Dom.Element_1','Ink.Dom.Css_1'], function(Common, Event, Element, Css) { 'use strict'; /** * The Sticky component takes an element and transforms it's behavior in order to, when the user scrolls he sets its position * to fixed and maintain it until the user scrolls back to the same place. * * @class Ink.UI.Sticky * @constructor * @version 1 * @param {String|DOMElement} selector * @param {Object} [options] Options * @param {Number} [options.offsetBottom=0] Number of pixels of distance from the bottomElement. * @param {Number} [options.offsetTop=0] Number of pixels of distance from the topElement. * @param {Boolean} [options.inlineDimensions=true] Whether to set "style.height" and "style.width" in the stuck element. Turn this off when your `stickyClass` has its own height and width and you don't want this to be dealt with through javascript. * @param {Boolean} [options.inlinePosition=true] Whether to set "style.left" in the stuck element. Turn this off when your `stickyClass` has its own "left" position and you don't want this to be dealt with through javascript. * @param {String} [options.wrapperClass="ink-sticky-wrapper"] Css class for the wrapper element. * @param {String} [options.stickyClass="ink-sticky-stuck"] Css class for sticking the sticky to the screen. Add your own "stuck" class to define your own sticky behaviour. * @param {String} [options.topElement] CSS Selector that specifies a top element with which the component could collide. * @param {String} [options.bottomElement] CSS Selector that specifies a bottom element with which the component could collide. * @param {Array|String} [options.activateInLayouts='medium,large'] Layouts in which the sticky behaviour is present. Pass an array or comma-separated string. * @example * <script> * Ink.requireModules( ['Ink.Dom.Selector_1','Ink.UI.Sticky_1'], function( Selector, Sticky ) { * var menuElement = Ink.s('#menu'); * var stickyObj = new Sticky( menuElement ); * }); * </script> */ var Sticky = function( selector, options ){ this._rootElement = Common.elOrSelector(selector, 'Ink.UI.Sticky_1'); this._options = Common.options({ offsetBottom: ['Integer', 0], offsetTop: ['Integer', 0], topElement: ['Element', null], wrapperClass: ['String', 'ink-sticky-wrapper'], stickyClass: ['String', 'ink-sticky-stuck'], inlineDimensions: ['Boolean', true], inlinePosition: ['Boolean', true], bottomElement: ['Element', null], activateInLayouts: ['String', 'medium,large'] }, options || {}, this._rootElement ); // Because String#indexOf is compatible with lt IE8 but not Array#indexOf this._options.activateInLayouts = this._options.activateInLayouts.toString(); this._dims = null; // force a recalculation of the dimensions later this._options.offsetTop = parseInt(this._options.offsetTop, 10) || 0; this._options.offsetBottom = parseInt(this._options.offsetBottom, 10) || 0; if (this._options.topElement) { this._options.topElement = Common.elOrSelector(this._options.topElement, 'Top Element'); } if (this._options.bottomElement) { this._options.bottomElement = Common.elOrSelector(this._options.bottomElement, 'Sticky bottom Element'); } this._wrapper = Element.create('div', { className: this._options.wrapperClass }); Element.wrap(this._rootElement, this._wrapper); this._init(); }; Sticky.prototype = { /** * Init function called by the constructor * * @method _init * @private */ _init: function() { var scrollTarget = document.addEventListener ? document : window; this._onScroll = Ink.bind(Event.throttle(this._onScroll, 33), this); // Because this is called directly. Event.observe( scrollTarget, 'scroll', this._onScroll ); Event.observe( window, 'resize', Ink.bindEvent(Event.throttle(this._onResize, 100), this) ); this._onScroll(); }, /** * Returns whether the sticky is disabled in the current view * * @method isDisabledInLayout * @private */ _isDisabledInLayout: function () { var currentLayout = Common.currentLayout(); if (!currentLayout) { return false; } return this._options.activateInLayouts.indexOf(currentLayout) === -1; }, /** * Scroll handler. * * @method _onScroll * @private */ _onScroll: function(){ var dims = this._getDims(); var scrollHeight = Element.scrollHeight(); var unstick = this._isDisabledInLayout() || scrollHeight <= dims.top - this._options.offsetTop || (this._options.topElement && this._options.topElement.getBoundingClientRect().bottom + this._options.offsetTop > 0); if( unstick ) { // We're on top, no sticking. position:static is the "normal" position. this._unstick(); return; } // If we stick it now, what will be its boundingClientRect.bottom ? var bottomOfSticky = this._options.offsetTop + dims.height + Element.scrollHeight(); var maxBottomOfSticky = document.body.scrollHeight; if (this._options.bottomElement) { maxBottomOfSticky = this._options.bottomElement.getBoundingClientRect().top + Element.scrollHeight(); } maxBottomOfSticky -= this._options.offsetBottom; if ( bottomOfSticky < maxBottomOfSticky ) { // Stick to screen! this._stickTo('screen'); } else { // Stick to bottom this._stickTo('bottom'); } }, /** * Have the sticky stick nowhere, to the screen, or to the bottom. * * @method _stickTo * @private */ _stickTo: function (where) { var style = this._rootElement.style; var dims = this._getDims(); Css.addClassName(this._rootElement, this._options.stickyClass); this._wrapper.style.height = dims.height + 'px'; this._inlineDimensions(dims.height + 'px', dims.width + 'px'); if (this._options.inlinePosition === false) { return; } style.left = dims.left + 'px'; if (where === 'screen') { style.bottom = null; style.top = this._options.offsetTop + 'px'; } else if (where === 'bottom') { // Distance between bottom of sticky and bottom of document var bottom = this._getBottomOffset(); // Distance between bottom of viewport and bottom of document var bottomOfViewport = Element.scrollHeight() + Element.viewportHeight(); var toBottomOfDocument = Element.pageHeight() - bottomOfViewport; style.bottom = bottom - toBottomOfDocument + 'px'; style.top = 'auto'; } }, /** * "unstick" the sticky from the screen or bottom of the document * @method _unstick * @private */ _unstick: function () { Css.removeClassName(this._rootElement, this._options.stickyClass); // deinline dimensions of our root element this._inlineDimensions(null, null); // deinline the position of our root element if (this._options.inlinePosition) { this._rootElement.style.left = null; this._rootElement.style.top = null; this._rootElement.style.bottom = null; } // deinline dimensions of wrapper this._wrapper.style.height = null; this._wrapper.style.width = null; // Break the "getDims" cache this._dims = null; }, /** * Resize handler * * @method _onResize * @private */ _onResize: function(){ this._dims = null; // Blow the cache so _getDims recalculates this._onScroll(); }, /** * Recalculate the "dims" cache, or get it. * * The "dims" cache is to be set to null when the element is liable to have changed dimensions * * (eg: on resize) * **/ _getDims: function () { if (this._dims !== null) { return this._dims; } var style = this._rootElement.style; // We unstick the sticky so we can measure. var oldPosition = style.position; var oldWidth = style.width; style.position = 'static'; // [todo] this should be a class toggle style.width = null; var dimensionsInStatic = Element.outerDimensions(this._rootElement); var rect = this._wrapper.getBoundingClientRect(); this._dims = { height: dimensionsInStatic[1], width: dimensionsInStatic[0], left: rect.left + Element.scrollWidth(), top: rect.top + Element.scrollHeight() }; style.position = oldPosition; style.width = oldWidth; return this._dims; }, /** * Set style.height and style.width, but not if options.inlineDimensions === false * * @method _inlineDimensions * @private */ _inlineDimensions: function (height, width) { if (this._options.inlineDimensions) { this._rootElement.style.height = height; this._rootElement.style.width = width; } }, /** * Get the distance between the bottom of the element and the bottom of the page * * @method _getBottomOffset * @private */ _getBottomOffset: function () { var bottom = this._options.offsetBottom; if (this._options.bottomElement) { bottom += Element.pageHeight() - Element.offsetTop(this._options.bottomElement); } return bottom; } }; return Sticky; }); /** * @module Ink.UI.Swipe * @author ink AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.Swipe', '1', ['Ink.Dom.Event_1', 'Ink.Dom.Element_1', 'Ink.UI.Common_1'], function(InkEvent, InkElement, Common) { 'use strict'; /** * Subscribe swipe gestures! * * Supports filtering swipes be any combination of the criteria supported in the options. * * @class Ink.UI.Swipe * @constructor * @param {String|DOMElement} el * @param {Object} options * @param {Function} [options.onEnd] callback function for the `touchend` event. Gets all the gesture information, and is filtered by min/max Dist and Duration options (see below) * @param {Function} [options.onStart] callback function for `touchstart` event * @param {Function} [options.onMove] callback function for every `touchmove` event. Gets current gesture information. * @param {Number} [options.minDist] minimum allowed distance, in pixels * @param {Number} [options.maxDist] maximum allowed distance, in pixels * @param {Number} [options.minDuration] minimum allowed duration, in seconds * @param {Number} [options.maxDuration] maximum allowed duration, in seconds * @param {String} [options.axis] if either 'x' or 'y' is passed, only swipes where the dominant axis is the given one trigger the callback * @param {String} [options.storeGesture=false] store gesture information and provide to the callback * @param {String} [options.stopEvents=true] stop (default and propagation) of the received events * * ----- * * Arguments received by the callbacks * ----------------------------------- * * `onStart`, `onMove`, and `onEnd` receive as argument an object containing: * * - `event`: the DOMEvent object * - `element`: the target element * - `Instance`: the `Ink.UI.Swipe_1` instance * - `position`: `Array` with `[x, y]` coordinates of current position * - `dt`: Time passed between now and the first event (onMove only) * - `gesture`: an Array containing [x,y] coordinates of every touchmove event received (storeGesture only) (onEnd only) * - `time`: an Array containing all the `dt` values for every touchmove event (onEnd only) * - `overallMovement`: X and Y distance traveled by the touch movement (`[x, y]`) (onEnd only) * - `overallTime`: total time passed (onEnd only) * */ function Swipe(el, options) { el = Common.elOrSelector(el, 'Swipe target'); this._options = Ink.extendObj({ onEnd: undefined, onStart: undefined, onMove: undefined, minDist: undefined, // in pixels maxDist: undefined, minDuration: undefined, // in seconds maxDuration: undefined, axis: undefined, // x | y storeGesture: false, stopEvents: true }, InkElement.data(el), options || {}); if (typeof options === 'function') { this._options.onEnd = options; } this._handlers = { down: Ink.bindEvent(this._onDown, this), move: Ink.bindEvent(this._onMove, this), up: Ink.bindEvent(this._onUp, this) }; this._element = el; this._init(); } Swipe.prototype = { version: '0.1', _supported: ('ontouchstart' in document.documentElement), _init: function() { var db = document.body; InkEvent.observe(db, 'touchstart', this._handlers.down); if (this._options.storeGesture || this._options.onMove) { InkEvent.observe(db, 'touchmove', this._handlers.move); } InkEvent.observe(db, 'touchend', this._handlers.up); this._isOn = false; }, _isMeOrParent: function(el, parentEl) { if (!el) {return;} do { if (el === parentEl) { return true; } el = el.parentNode; } while (el); return false; }, _pushGesture: function (coords, dt) { if (this._options.storeGesture) { this._gesture.push(coords); this._time.push(dt); } }, _onDown: function(event) { if (event.changedTouches.length !== 1) { return; } if (!this._isMeOrParent(event.target, this._element)) { return; } if( this._options.stopEvents === true ){ InkEvent.stop(event); } event = event.changedTouches[0]; this._isOn = true; this._target = event.target; this._t0 = +new Date(); this._p0 = [event.pageX, event.pageY]; if (this._options.storeGesture) { this._gesture = []; this._time = []; } this._pushGesture(this._p0, 0); if (this._options.onStart) { this._options.onStart({ event: event, element: this._element, instance: this, position: this._p0, dt: 0 }); } }, _onMove: function(event) { if (!this._isOn || event.changedTouches.length !== 1) { return; } if( this._options.stopEvents === true ) { InkEvent.stop(event); } event = event.changedTouches[0]; var t1 = +new Date(); var dt = (t1 - this._t0); var gesture = [event.pageX, event.pageY]; this._pushGesture(gesture, dt); if (this._options.onMove) { this._options.onMove({ event: event, element: this._element, instance: this, position: gesture, dt: dt }); } }, _onUp: function(event) { if (!this._isOn || event.changedTouches.length !== 1) { return; } if( this._options.stopEvents === true ){ InkEvent.stop(event); } event = event.changedTouches[0]; // TODO SHOULD CHECK IT IS THE SAME TOUCH this._isOn = false; var t1 = +new Date(); var p1 = [event.pageX, event.pageY]; var dt = (t1 - this._t0); var dr = [ p1[0] - this._p0[0], p1[1] - this._p0[1] ]; var dist = Math.sqrt(dr[0]*dr[0] + dr[1]*dr[1]); var axis = Math.abs(dr[0]) > Math.abs(dr[1]) ? 'x' : 'y'; var o = this._options; if (o.minDist && dist < o.minDist) { return; } if (o.maxDist && dist > o.maxDist) { return; } if (o.minDuration && dt < o.minDuration) { return; } if (o.maxDuration && dt > o.maxDuration) { return; } if (o.axis && axis !== o.axis) { return; } if (this._options.onEnd) { this._options.onEnd({ event: event, element: this._element, instance: this, gesture: this._gesture, time: this._time, axis: axis, overallMovement: dr, overallTime: dt }); } } }; return Swipe; }); /** * @module Ink.UI.Table_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.Table', '1', ['Ink.Util.Url_1','Ink.UI.Pagination_1','Ink.Net.Ajax_1','Ink.UI.Common_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1','Ink.Util.Array_1','Ink.Util.String_1', 'Ink.Util.Json_1'], function(InkUrl,Pagination, Ajax, Common, Event, Css, Element, Selector, InkArray, InkString, Json) { 'use strict'; var rNumber = /\d/g; // Turn into a number, if we can. For sorting data which could be numeric or not. function maybeTurnIntoNumber(value) { if( !isNaN(value) && rNumber.test(value) ){ return parseInt(value, 10); } else if( !isNaN(value) ){ return parseFloat(value); } return value; } function cmp (a, b) { if( a === b ){ return 0; } return ( ( a > b ) ? 1 : -1 ); } // cmp function for comparing data which might be a number. function numberishEnabledCmp (a, b) { var aValue = maybeTurnIntoNumber(Element.textContent(a)); var bValue = maybeTurnIntoNumber(Element.textContent(b)); return cmp(aValue, bValue); } // Object.keys polyfill function keys(obj) { if (typeof Object.keys !== 'undefined') { return Object.keys(obj); } var ret = []; for (var k in obj) if (obj.hasOwnProperty(k)) { ret.push(k); } return ret; } // Most processJSON* functions can just default to this. function sameSame(obj) { return obj; } /** * The Table component transforms the native/DOM table element into a * sortable, paginated component. * * @class Ink.UI.Table * @constructor * @version 1 * @param {String|DOMElement} selector * @param {Object} [options] Options * @param {Number} [options.pageSize] * Number of rows per page. Omit to avoid paginating. * * @param {String} [options.endpoint] * Endpoint to get the records via AJAX. Omit if you don't want to do AJAX * * @param {Function} [options.createEndpointUrl] * Callback to customise what URL the AJAX endpoint is at. Receives three * arguments: base (the "endpoint" option), sort (`{ order: 'asc' or 'desc', field: fieldname }`) * and page ({ page: page number, size: items per page }) * * @param {Function} [options.getDataFromEndPoint] * Callback to allow the user to retrieve the data himself given an URL. * Must accept two arguments: `url` and `callback`. This `callback` will * take as a single argument a JavaScript object. * * @param {Function} [options.processJSONRows] * Retrieve an array of rows from the data which came from AJAX. * * @param {Function} [options.processJSONHeaders] * Get an object with all the headers' names as keys, and a { label, sortable } * object as value. * Example: `{col1: {label: "Column 1"}, col2: {label: "Column 2", sortable: true}`. * Takes a single argument, the JSON response. * * @param {Function} [options.processJSONRow] * Process a row object before it gets on the table. * * @param {Function} [options.processJSONField] * Process the field data before putting it on the table. * You can return HTML, a DOM element, or a string here. * Arguments you receive: `(column, fieldData, rowIndex)`. * * @param {Function} [options.processJSONField.(field_name)] * The same as processJSONField, but for a particular field. * * @param {Function} [options.processJSONTotalRows] * A callback where you have a chance to say how many rows * are in the dataset (not only on this page) you have on the * collection. You get as an argument the JSON response. * * @param {Function} [options.getSortKey=null] * A function taking a `{ columnIndex, columnName, data, element }` * object and returning a value which serves as a sort key for the * sorting operation. For example, if you want to sort by a * `data-sort-key` atribute, set `getSortKey` to: * * function (cell) { * return cell.element.getAttribute('data-sort-key'); * } * * @param {Function} [options.getSortKey.(field_name)] * Same as `options.getSortKey`, but for a particular field. * * @param {Object} [options.tdClassNames] * An object mapping each field to what classes it gets. * Example: `{ name: "large-10", isBoss: "hide-small" }` * * @param {String|DomElement|Ink.UI.Pagination} [options.pagination] * Pagination instance or element. * * @param {Object} [options.paginationOptions] * Override the options with which we instantiate the Ink.UI.Pagination. * * @param {Boolean} [options.allowResetSorting] * Allow sort order to be set to "none" in addition to "ascending" and "descending" * * @param {String|Array} [options.visibleFields] * Set of fields which get shown on the table * @example * <table class="ink-table alternating" data-page-size="6"> * <thead> * <tr> * <th data-sortable="true" width="75%">Pepper</th> * <th data-sortable="true" width="25%">Scoville Rating</th> * </tr> * </thead> * <tbody> * <tr> * <td>Trinidad Moruga Scorpion</td> * <td>1500000</td> * </tr> * <tr> * <td>Bhut Jolokia</td> * <td>1000000</td> * </tr> * <tr> * <td>Naga Viper</td> * <td>1463700</td> * </tr> * <tr> * <td>Red Savina Habanero</td> * <td>580000</td> * </tr> * <tr> * <td>Habanero</td> * <td>350000</td> * </tr> * <tr> * <td>Scotch Bonnet</td> * <td>180000</td> * </tr> * <tr> * <td>Malagueta</td> * <td>50000</td> * </tr> * <tr> * <td>Tabasco</td> * <td>35000</td> * </tr> * <tr> * <td>Serrano Chili</td> * <td>27000</td> * </tr> * <tr> * <td>Jalapeño</td> * <td>8000</td> * </tr> * <tr> * <td>Poblano</td> * <td>1500</td> * </tr> * <tr> * <td>Peperoncino</td> * <td>500</td> * </tr> * </tbody> * </table> * <nav class="ink-navigation"><ul class="pagination"></ul></nav> * <script> * Ink.requireModules( ['Ink.Dom.Selector_1','Ink.UI.Table_1'], function( Selector, Table ){ * var tableElement = Ink.s('.ink-table'); * var tableObj = new Table( tableElement ); * }); * </script> */ var Table = function( selector, options ){ /** * Get the root element */ this._rootElement = Common.elOrSelector(selector, 'Ink.UI.Table :'); if( this._rootElement.nodeName.toLowerCase() !== 'table' ){ throw new Error('[Ink.UI.Table] :: The element is not a table'); } this._options = Common.options({ pageSize: ['Integer', null], endpoint: ['String', null], createEndpointUrl: ['Function', null /* default func uses above option */], getDataFromEndPoint: ['Function', null /* by default use plain ajax for JSON */], processJSONRows: ['Function', sameSame], processJSONRow: ['Function', sameSame], processJSONField: ['Function', sameSame], processJSONHeaders: ['Function', function (dt) { return dt.fields; }], processJSONTotalRows: ['Function', function (dt) { return dt.length || dt.totalRows; }], getSortKey: ['Function', null], pagination: ['Element', null], allowResetSorting: ['Boolean', false], visibleFields: ['String', null], tdClassNames: ['Object', {}], paginationOptions: ['Object', null] }, options || {}, this._rootElement); /** * Checking if it's in markup mode or endpoint mode */ this._markupMode = !this._options.endpoint; if( this._options.visibleFields ){ this._options.visibleFields = this._options.visibleFields.toString().split(/[, ]+/g); } this._thead = this._rootElement.tHead || this._rootElement.createTHead(); this._headers = Selector.select('th', this._thead); /** * Initializing variables */ this._handlers = { thClick: null }; this._originalFields = [ // field headers from the DOM ]; this._sortableFields = { // Identifies which columns are sorted and how. // columnIndex: 'none'|'asc'|'desc' }; this._originalData = this._data = []; this._pagination = null; this._totalRows = 0; this._handlers.thClick = Event.observeDelegated(this._rootElement, 'click', 'thead th[data-sortable="true"]', Ink.bindMethod(this, '_onThClick')); this._init(); }; Table.prototype = { /** * Init function called by the constructor * * @method _init * @private */ _init: function(){ /** * If not is in markup mode, we have to do the initial request * to get the first data and the headers */ if( !this._markupMode ) { /* Endpoint mode */ this._getData( ); } else /* Markup mode */ { this._resetSortOrder(); this._addHeadersClasses(); /** * Getting the table's data */ this._data = Selector.select('tbody tr', this._rootElement); this._originalData = this._data.slice(0); this._totalRows = this._data.length; /** * Set pagination if options tell us to */ this._setPagination(); } }, /** * Add the classes in this._options.tdClassNames to our table headers. * @method _addHeadersClasses * @private */ _addHeadersClasses: function () { var headerLabel; var classNames; for (var i = 0, len = this._headers.length; i < len; i++) { headerLabel = Element.textContent(this._headers[i]); classNames = this._options.tdClassNames[headerLabel]; // TODO do not find header labels this way. But how? if (classNames) { Css.addClassName(this._headers[i], classNames); } } }, /** * Click handler. This will mainly handle the sorting (when you click in the headers) * * @method _onThClick * @param {Event} event Event obj * @private */ _onThClick: function( event ){ var tgtEl = Event.element(event), paginated = this._options.pageSize !== undefined; Event.stop(event); var index = InkArray.keyValue(tgtEl, this._headers, true); var sortable = index !== false && this._sortableFields[index] !== undefined; if( !sortable ){ return; } if( !this._markupMode && paginated ){ this._invertSortOrder(index, false); } else { if ( (this._sortableFields[index] === 'desc') && this._options.allowResetSorting ) { this._setSortOrderOfColumn(index, null); this._data = this._originalData.slice(0); } else { this._invertSortOrder(index, true); } var tbody = Selector.select('tbody',this._rootElement)[0]; Common.cleanChildren(tbody); InkArray.each(this._data, Ink.bindMethod(tbody, 'appendChild')); if (this._pagination) { this._pagination.setCurrent(0); this._paginate(1); } } }, _invertSortOrder: function (index, sortAndReverse) { var isAscending = this._sortableFields[index] === 'asc'; for (var i = 0, len = this._headers.length; i < len; i++) { this._setSortOrderOfColumn(i, null); } if (sortAndReverse) { this._sort(index); if (isAscending) { this._data.reverse(); } } this._setSortOrderOfColumn(index, !isAscending); }, _setSortOrderOfColumn: function(index, up) { var header = this._headers[index]; var caretHtml = ''; var order = 'none'; if (up === true) { caretHtml = '<i class="icon-caret-up"></i>'; order = 'asc'; } else if (up === false) { caretHtml = '<i class="icon-caret-down"></i>'; order = 'desc'; } this._sortableFields[index] = order; header.innerHTML = Element.textContent(header) + caretHtml; }, /** * Applies and/or changes the CSS classes in order to show the right columns * * @method _paginate * @param {Number} page Current page * @private */ _paginate: function( page ){ if (!this._pagination) { return; } var pageSize = this._options.pageSize; // Hide everything except the items between these indices var firstIndex = (page - 1) * pageSize; var lastIndex = firstIndex + pageSize; InkArray.each(this._data, function(item, index){ if (index >= firstIndex && index < lastIndex) { Css.removeClassName(item,'hide-all'); } else { Css.addClassName(item,'hide-all'); } }); }, /* register fields into this._originalFields, whether they come from JSON or a table. * @method _registerFieldNames * @private * @param [names] The field names in an array **/ _registerFieldNames: function (names) { this._originalFields = []; InkArray.forEach(names, Ink.bind(function (field) { if( !this._fieldIsVisible(field) ){ return; // The user deems this not to be necessary to see. } this._originalFields.push(field); }, this)); }, _fieldIsVisible: function (field) { return !this._options.visibleFields || (this._options.visibleFields.indexOf(field) !== -1); }, /** * Sorts by a specific column. * * @method _sort * @param {Number} index Column number (starting at 0) * @private */ _sort: function( index ){ // TODO this is THE worst way to declare field names. Incompatible with i18n and a lot of other things. var fieldName = Element.textContent(this._headers[index]); var keyFunction = this._options.getSortKey; if (keyFunction) { keyFunction = typeof keyFunction[fieldName] === 'function' ? keyFunction[fieldName] : typeof keyFunction === 'function' ? keyFunction : null; } var self = this; this._data.sort(function (trA, trB) { var elementA = Ink.ss('td', trA)[index]; var elementB = Ink.ss('td', trB)[index]; if (keyFunction) { return cmp(userKey(elementA), userKey(elementB)); } else { return numberishEnabledCmp(elementA, elementB, index); } }); function userKey(element) { return keyFunction.call(self, { columnIndex: index, columnName: fieldName, data: Element.textContent(element), element: element }); } }, /** * Assembles the headers markup * * @method _createHeadersFromJson * @param {Object} headers Key-value object that contains the fields as keys, their configuration (label and sorting ability) as value * @private */ _createHeadersFromJson: function( headers ){ this._registerFieldNames(keys(headers)); if (this._thead.children.length) { return; } var tr = this._thead.insertRow(0); var th; for (var i = 0, len = headers.length; i < len; i++) { if (this._fieldIsVisible(headers[i])) { th = Element.create('th'); th = this._createSingleHeaderFromJson(headers[i], th); tr.appendChild(th); this._headers.push(th); } } }, _createSingleHeaderFromJson: function (header, th) { if (header.sortable) { th.setAttribute('data-sortable','true'); } if (header.label){ Element.setTextContent(th, header.label); } return th; }, /** * Reset the sort order as marked on the table headers to "none" * * @method _resetSortOrder * @private */ _resetSortOrder: function(){ /** * Setting the sortable columns and its event listeners */ for (var i = 0, len = this._headers.length; i < len; i++) { var dataset = Element.data( this._headers[i] ); if (dataset.sortable && dataset.sortable.toString() === 'true') { this._sortableFields[i] = 'none'; } } }, /** * This method gets the rows from AJAX and places them as <tr> and <td> * * @method _createRowsFromJSON * @param {Object} rows Array of objects with the data to be showed * @private */ _createRowsFromJSON: function( rows ){ var tbody = Selector.select('tbody',this._rootElement)[0]; if( !tbody ){ tbody = document.createElement('tbody'); this._rootElement.appendChild( tbody ); } else { Element.setHTML(tbody, ''); } this._data = []; var row; for (var trIndex in rows) { if (rows.hasOwnProperty(trIndex)) { row = this._options.processJSONRow(rows[trIndex]); this._createSingleRowFromJson(tbody, row, trIndex); } } this._originalData = this._data.slice(0); }, _createSingleRowFromJson: function (tbody, row, rowIndex) { var tr = document.createElement('tr'); tbody.appendChild( tr ); for( var field in row ){ if (row.hasOwnProperty(field)) { this._createFieldFromJson(tr, row[field], field, rowIndex); } } this._data.push(tr); }, _createFieldFromJson: function (tr, fieldData, fieldName, rowIndex) { if (!this._fieldIsVisible(fieldName)) { return; } var processor = this._options.processJSONField[fieldName] || // per-field callback this._options.processJSONField; // generic callback var result; if (typeof processor === 'function') { result = processor(fieldData, fieldName, rowIndex); } else { result = fieldData; } var elm = this._elOrFieldData(result); var className = this._options.tdClassNames[fieldName]; if (className) { Css.addClassName(elm, className); } tr.appendChild(elm); }, _elOrFieldData: function (processed) { if (Common.isDOMElement(processed)) { return processed; } var isString = typeof processed === 'string'; var isNumber = typeof processed === 'number'; var elm = Element.create('td'); if (isString && /^\s*?</.test(processed)) { Element.setHTML(elm, processed); } else if (isString || isNumber) { Element.setTextContent(elm, processed); } else { throw new Error('Ink.UI.Table Unknown result from processJSONField: ' + processed); } return elm; }, /** * Sets the endpoint. Useful for changing the endpoint in runtime. * * @method _setEndpoint * @param {String} endpoint New endpoint */ setEndpoint: function( endpoint, currentPage ){ if( !this._markupMode ){ this._options.endpoint = endpoint; if (this._pagination) { this._pagination.setCurrent((!!currentPage) ? parseInt(currentPage,10) : 0 ); } } }, /** * Sets the instance's pagination, if necessary. * * Precondition: this._totalRows needs to be known. * * @method _setPagination * @private */ _setPagination: function(){ /* If user doesn't say they want pagination, bail. */ if( this._options.pageSize == null ){ return; } /** * Fetch pagination from options. Can be a selector string, an element or a Pagination instance. */ var paginationEl = this._options.pagination; if ( paginationEl instanceof Pagination ) { this._pagination = paginationEl; return; } if (!paginationEl) { paginationEl = Element.create('nav', { className: 'ink-navigation', insertAfter: this._rootElement }); Element.create('ul', { className: 'pagination', insertBottom: paginationEl }); } var paginationOptions = Ink.extendObj({ totalItemCount: this._totalRows, itemsPerPage: this._options.pageSize, onChange: Ink.bind(function (_, pageNo) { this._paginate(pageNo + 1); }, this) }, this._options.paginationOptions || {}); this._pagination = new Pagination(paginationEl, paginationOptions); this._paginate(1); }, /** * Method to choose which is the best way to get the data based on the endpoint: * - AJAX * - JSONP * * @method _getData * @private */ _getData: function( ){ var sortOrder = this._getSortOrder() || null; var page = null; if (this._pagination) { page = { size: this._options.pageSize, page: this._pagination.getCurrent() + 1 }; } this._getDataViaAjax( this._getUrl( sortOrder, page) ); }, /** * Return an object describing sort order { field: [field name] , * order: ["asc" or "desc"] }, or null if there is no sorting * going on. * @method _getSortOrder * @private */ _getSortOrder: function () { var index; for (index in this._sortableFields) if (this._sortableFields.hasOwnProperty(index)) { if( this._sortableFields[index] !== 'none' ){ break; } } if (!index) { return null; // no sorting going on } return { field: this._originalFields[index], order: this._sortableFields[index] }; }, _getUrl: function (sort, page) { var urlCreator = this._options.createEndpointUrl || function (endpoint, sort, page /* TODO implement filters too */) { endpoint = InkUrl.parseUrl(endpoint); endpoint.query = endpoint.query || {}; if (sort) { endpoint.query.sortOrder = sort.order; endpoint.query.sortField = sort.field; } if (page) { endpoint.query['rows_per_page'] = page.size; endpoint.query['page'] = page.page; } return InkUrl.format(endpoint); }; var ret = urlCreator(this._options.endpoint, sort, page); if (typeof ret !== 'string') { throw new TypeError('Ink.UI.Table_1: ' + 'createEndpointUrl did not return a string!'); } return ret; }, /** * Gets the data via AJAX and calls this._onAjaxSuccess with the response. * * Will call options.getDataFromEndpoint( Uri, callback ) if available. * * @param endpointUri Endpoint to get data from, after processing. */ _getDataViaAjax: function( endpointUri ){ var success = Ink.bind(function( JSONData ){ this._onAjaxSuccess( JSONData ); }, this); if (!this._options.getDataFromEndpoint) { new Ajax( endpointUri, { method: 'GET', contentType: 'application/json', sanitizeJSON: true, onSuccess: Ink.bind(function( response ){ if( response.status === 200 ){ success(Json.parse(response.responseText)); } }, this) }); } else { this._options.getDataFromEndpoint( endpointUri, success ); } }, _onAjaxSuccess: function (jsonResponse) { var paginated = this._options.pageSize != null; var rows = this._options.processJSONRows(jsonResponse); this._headers = Selector.select('th', this._thead); // If headers not in DOM, get from JSON if( this._headers.length === 0 ) { var headers = this._options.processJSONHeaders( jsonResponse); if (!headers || !headers.length || !headers[0]) { throw new Error('Ink.UI.Table: processJSONHeaders option must return an array of objects!'); } this._createHeadersFromJson( headers ); this._resetSortOrder(); this._addHeadersClasses(); } this._createRowsFromJSON( rows ); this._totalRows = this._rowLength = rows.length; if( paginated ){ this._totalRows = this._options.processJSONTotalRows(jsonResponse); this._setPagination( ); } } }; return Table; }); /** * @module Ink.UI.Tabs_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.Tabs', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1','Ink.Util.Array_1'], function(Common, Event, Css, Element, Selector, InkArray ) { 'use strict'; /** * Tabs component * * @class Ink.UI.Tabs * @constructor * @version 1 * @param {String|DOMElement} selector * @param {Object} [options] Options * @param {Boolean} [options.preventUrlChange] Flag that determines if follows the link on click or stops the event * @param {String} [options.active] ID of the tab to activate on creation * @param {Array} [options.disabled] IDs of the tabs that will be disabled on creation * @param {Function} [options.onBeforeChange] Callback to be executed before changing tabs * @param {Function} [options.onChange] Callback to be executed after changing tabs * @param {Boolean} [options.triggerEventsOnLoad] Trigger the above events when the page is loaded. * @example * <div class="ink-tabs top"> <!-- replace 'top' with 'bottom', 'left' or 'right' to place navigation --> * * <!-- put navigation first if using top, left or right positioning --> * <ul class="tabs-nav"> * <li><a href="#home">Home</a></li> * <li><a href="#news">News</a></li> * <li><a href="#description">Description</a></li> * <li><a href="#stuff">Stuff</a></li> * <li><a href="#more_stuff">More stuff</a></li> * </ul> * * <!-- Put your content second if using top, left or right navigation --> * <div id="home" class="tabs-content"><p>Content</p></div> * <div id="news" class="tabs-content"><p>Content</p></div> * <div id="description" class="tabs-content"><p>Content</p></div> * <div id="stuff" class="tabs-content"><p>Content</p></div> * <div id="more_stuff" class="tabs-content"><p>Content</p></div> * <!-- If you're using bottom navigation, switch the nav block with the content blocks --> * * </div> * <script> * Ink.requireModules( ['Ink.Dom.Selector_1','Ink.UI.Tabs_1'], function( Selector, Tabs ){ * var tabsElement = Ink.s('.ink-tabs'); * var tabsObj = new Tabs( tabsElement ); * }); * </script> */ var Tabs = function(selector, options) { this._element = Common.elOrSelector(selector, 'Ink.UI.Tabs tab container'); this._options = Ink.extendObj({ preventUrlChange: false, active: undefined, disabled: [], onBeforeChange: undefined, onChange: undefined, triggerEventsOnLoad: true }, options || {}, Element.data(this._element)); this._handlers = { tabClicked: Ink.bindEvent(this._onTabClicked,this), disabledTabClicked: Ink.bindEvent(this._onDisabledTabClicked,this), resize: Ink.bindEvent(Event.throttle(this._onResize, 100),this) }; this._init(); }; Tabs.prototype = { /** * Init function called by the constructor * * @method _init * @private */ _init: function() { this._menu = Selector.select('.tabs-nav', this._element)[0]; this._menuTabs = this._menu.children; this._contentTabs = Selector.select('.tabs-content', this._element); //initialization of the tabs, hides all content before setting the active tab this._initializeDom(); // subscribe events this._observe(); //sets the first active tab this._setFirstActive(); this._handlers.resize(); Common.registerInstance(this, this._element, 'tabs'); }, /** * Initialization of the tabs, hides all content before setting the active tab * * @method _initializeDom * @private */ _initializeDom: function(){ for(var i = 0; i < this._contentTabs.length; i++){ Css.addClassName(this._contentTabs[i], 'hide-all'); } }, /** * Subscribe events * * @method _observe * @private */ _observe: function() { InkArray.each(this._menuTabs,Ink.bind(function(elem){ var link = Selector.select('a', elem)[0]; if(InkArray.inArray(link.getAttribute('href'), this._options.disabled)){ this.disable(link); } else { this.enable(link); } },this)); Event.observe(window, 'resize', this._handlers.resize); }, /** * Run at instantiation, to determine which is the first active tab * fallsback from window.location.href to options.active to the first not disabled tab * * @method _setFirstActive * @private */ _setFirstActive: function() { var hash = window.location.hash; var activeMenuLink = this._findLinkByHref(hash) || (this._options.active && this._findLinkByHref(this._options.active)) || Selector.select('a', this._menu)[0]; this._changeTab(activeMenuLink, this._options.triggerEventsOnLoad); }, /** * Changes to the desired tab * * @method _changeTab * @param {DOMElement} link anchor linking to the content container * @param {boolean} runCallbacks defines if the callbacks should be run or not * @private */ _changeTab: function(link, runCallbacks){ if(runCallbacks && typeof this._options.onBeforeChange !== 'undefined'){ this._options.onBeforeChange(this); } var selector = link.getAttribute('href'); if (this._activeMenuTab) { Css.removeClassName(this._activeMenuTab, 'active'); Css.removeClassName(this._activeContentTab, 'active'); Css.addClassName(this._activeContentTab, 'hide-all'); } this._activeMenuLink = link; this._activeMenuTab = this._activeMenuLink.parentNode; this._activeContentTab = Selector.select(selector.substr(selector.indexOf('#')), this._element)[0]; if (!this._activeContentTab) { this._activeMenuLink = this._activeMenuTab = this._activeContentTab = null; return; } Css.addClassName(this._activeMenuTab, 'active'); Css.addClassName(this._activeContentTab, 'active'); Css.removeClassName(this._activeContentTab, 'hide-all'); if(runCallbacks && typeof(this._options.onChange) !== 'undefined'){ this._options.onChange(this); } }, /** * Tab clicked handler * * @method _onTabClicked * @param {Event} ev * @private */ _onTabClicked: function(ev) { Event.stop(ev); var target = Event.findElement(ev, 'A'); if(!target || target.nodeName.toLowerCase() !== 'a') { return; } var href = target.getAttribute('href').substr(target.getAttribute('href').indexOf('#')); if (!href || Ink.i(href.replace(/^#/, '')) === null) { return; } if (this._options.preventUrlChange.toString() !== 'true') { window.location.hash = href; } if (target === this._activeMenuLink) { return; } this.changeTab(target); }, /** * Disabled tab clicked handler * * @method _onDisabledTabClicked * @param {Event} ev * @private */ _onDisabledTabClicked: function(ev) { Event.stop(ev); }, /** * Resize handler * * @method _onResize * @private */ _onResize: function(){ var currentLayout = Common.currentLayout(); if(currentLayout === this._lastLayout){ return; } if(currentLayout === Common.Layouts.SMALL || currentLayout === Common.Layouts.MEDIUM){ Css.removeClassName(this._menu, 'menu'); Css.removeClassName(this._menu, 'horizontal'); // Css.addClassName(this._menu, 'pills'); } else { Css.addClassName(this._menu, 'menu'); Css.addClassName(this._menu, 'horizontal'); // Css.removeClassName(this._menu, 'pills'); } this._lastLayout = currentLayout; }, /***************** * Aux Functions * *****************/ /** * Allows the hash to be passed with or without the cardinal sign * * @method _hashify * @param {String} hash the string to be hashified * @return {String} Resulting hash * @private */ _hashify: function(hash){ if(!hash){ return ""; } return hash.indexOf('#') === 0? hash : '#' + hash; }, /** * Returns the anchor with the desired href * * @method _findLinkBuHref * @param {String} href the href to be found on the returned link * @return {String|undefined} [description] * @private */ _findLinkByHref: function(href){ href = this._hashify(href); // Find a link which has a href ending with... return Selector.select('a[href$="' + href + '"]', this._menu)[0]; }, /************** * PUBLIC API * **************/ /** * Changes to the desired tag * * @method changeTab * @param {String|DOMElement} selector the id of the desired tab or the link that links to it * @public */ changeTab: function(selector) { var element = (selector.nodeType === 1)? selector : this._findLinkByHref(this._hashify(selector)); if(!element || Css.hasClassName(element, 'ink-disabled')){ return; } this._changeTab(element, true); }, /** * Disables the desired tag * * @method disable * @param {String|DOMElement} selector the id of the desired tab or the link that links to it * @public */ disable: function(selector){ var element = (selector.nodeType === 1)? selector : this._findLinkByHref(this._hashify(selector)); if(!element){ return; } Event.stopObserving(element, 'click', this._handlers.tabClicked); Event.observe(element, 'click', this._handlers.disabledTabClicked); Css.addClassName(element, 'ink-disabled'); }, /** * Enables the desired tag * * @method enable * @param {String|DOMElement} selector the id of the desired tab or the link that links to it * @public */ enable: function(selector){ var element = (selector.nodeType === 1)? selector : this._findLinkByHref(this._hashify(selector)); if(!element){ return; } Event.stopObserving(element, 'click', this._handlers.disabledTabClicked); Event.observe(element, 'click', this._handlers.tabClicked); Css.removeClassName(element, 'ink-disabled'); }, /*********** * Getters * ***********/ /** * Returns the active tab id * * @method activeTab * @return {String} ID of the active tab. * @public */ activeTab: function(){ return this._activeContentTab.getAttribute('id'); }, /** * Returns the current active Menu LI * * @method activeMenuTab * @return {DOMElement} Active menu LI. * @public */ activeMenuTab: function(){ return this._activeMenuTab; }, /** * Returns the current active Menu anchorChanges to the desired tag * * @method activeMenuLink * @return {DOMElement} Active menu link * @public */ activeMenuLink: function(){ return this._activeMenuLink; }, /** * Returns the current active Content Tab * * @method activeContentTab * @return {DOMElement} Active Content Tab * @public */ activeContentTab: function(){ return this._activeContentTab; }, /** * Unregisters the component and removes its markup from the DOM * * @method destroy * @public */ destroy: Common.destroyComponent }; return Tabs; }); /* * @module Ink.UI.TagField_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule("Ink.UI.TagField","1",["Ink.Dom.Element_1", "Ink.Dom.Event_1", "Ink.Dom.Css_1", "Ink.Dom.Browser_1", "Ink.UI.Droppable_1", "Ink.Util.Array_1", "Ink.Dom.Selector_1", "Ink.UI.Common_1"],function( InkElement, InkEvent, Css, Browser, Droppable, InkArray, Selector, Common) { 'use strict'; var enterKey = 13; var backspaceKey = 8; var isTruthy = function (val) {return !!val;}; /** * Use this class to have a field where a user can input several tags into a single text field. A good example is allowing the user to describe a blog post or a picture through tags, for later searching. * * The markup is as follows: * * <input class="ink-tagfield" type="text" value="initial,value"> * * By applying this UI class to the above input, you get a tag field with the tags "initial" and "value". The class preserves the original input element. It remains hidden and is updated with new tag information dynamically, so regular HTML form logic still applies. * * Below "input" refers to the current value of the input tag (updated as the user enters text, of course), and "output" refers to the value which this class writes back to said input tag. * * @class Ink.UI.TagField * @version 1 * @constructor * @param {String|InputElement} element Selector or DOM Input Element. * @param {Object} [options] * @param {String|Array} [options.tags] initial tags in the input * @param {Boolean} [options.allowRepeated=true] allow user to input several tags * @param {RegExp} [options.separator=/[,;(space)]+/g] Split the input by this RegExp. The default splits by spaces, commas and semicolons * @param {String} [options.outSeparator=','] Use this string to separate each tag from the next in the output. * @param {Boolean} [options.autoSplit=true] * @param {Integer} [options.maxTags=-1] Maximum amount of tags the user can write. * @example */ function TagField(element, options) { this.init(element, options); } TagField.prototype = { /** * Init function called by the constructor * * @method _init * @private */ init: function(element, options) { element = this._element = Common.elOrSelector(element, 'Ink.UI.TagField'); var o = this._options = Common.options('Ink.UI.TagField', { tags: ['String', []], tagQuery: ['Object', null], tagQueryAsync: ['Object', null], allowRepeated: ['Boolean', false], maxTags: ['Integer', -1], outSeparator: ['String', ','], separator: ['String', /[,; ]+/g], autoSplit: ['Boolean', true] }, options || {}, this._element); if (typeof o.separator === 'string') { o.separator = new RegExp(o.separator, 'g'); } if (typeof o.tags === 'string') { // coerce to array using the separator o.tags = this._readInput(o.tags); } Css.addClassName(this._element, 'hide-all'); this._viewElm = InkElement.create('div', { className: 'ink-tagfield', insertAfter: this._element }); this._input = InkElement.create('input', { type: 'text', className: 'new-tag-input', insertBottom: this._viewElm }); var tags = [].concat(o.tags, this._tagsFromMarkup(this._element)); this._tags = []; InkArray.each(tags, Ink.bindMethod(this, '_addTag')); InkEvent.observe(this._input, 'keyup', Ink.bindEvent(this._onKeyUp, this)); InkEvent.observe(this._input, 'change', Ink.bindEvent(this._onKeyUp, this)); InkEvent.observe(this._input, 'keydown', Ink.bindEvent(this._onKeyDown, this)); InkEvent.observe(this._input, 'blur', Ink.bindEvent(this._onBlur, this)); InkEvent.observe(this._viewElm, 'click', Ink.bindEvent(this._refocus, this)); }, destroy: function () { InkElement.remove(this._viewElm); Css.removeClassName(this._element, 'hide-all'); }, _tagsFromMarkup: function (element) { var tagname = element.tagName.toLowerCase(); if (tagname === 'input') { return this._readInput(element.value); } else if (tagname === 'select') { return InkArray.map(element.getElementsByTagName('option'), function (option) { return InkElement.textContent(option); }); } else { throw new Error('Cannot read tags from a ' + tagname + ' tag. Unknown tag'); } }, _tagsToMarkup: function (tags, element) { var tagname = element.tagName.toLowerCase(); if (tagname === 'input') { if (this._options.separator) { element.value = tags.join(this._options.outSeparator); } } else if (tagname === 'select') { element.innerHTML = ''; InkArray.each(tags, function (tag) { var opt = InkElement.create('option', {selected: 'selected'}); InkElement.setTextContent(opt, tag); element.appendChild(opt); }); } else { throw new Error('TagField: Cannot read tags from a ' + tagname + ' tag. Unknown tag'); } }, _addTag: function (tag) { if (this._options.maxTags !== -1 && this._tags.length >= this._options.maxTags) { return; } if ((!this._options.allowRepeated && InkArray.inArray(tag, this._tags, tag)) || !tag) { return false; } var elm = InkElement.create('span', { className: 'ink-tag', setTextContent: tag + ' ' }); var remove = InkElement.create('span', { className: 'remove icon icon-remove icon-times', // fontawesome 3 changed icon-remove's name to icon-times insertBottom: elm }); InkEvent.observe(remove, 'click', Ink.bindEvent(this._removeTag, this, null)); var spc = document.createTextNode(' '); this._tags.push(tag); this._viewElm.insertBefore(elm, this._input); this._viewElm.insertBefore(spc, this._input); this._tagsToMarkup(this._tags, this._element); }, _readInput: function (text) { if (this._options.separator) { return InkArray.filter(text.split(this._options.separator), isTruthy); } else { return [text]; } }, _onKeyUp: function () { // TODO control input box size if (!this._options.autoSplit) { return; } var split = this._input.value.split(this._options.separator); if (split.length <= 1) { return; } var last = split[split.length - 1]; split = split.splice(0, split.length - 1); split = InkArray.filter(split, isTruthy); InkArray.each(split, Ink.bind(this._addTag, this)); this._input.value = last; }, _onKeyDown: function (event) { if (event.which === enterKey) { return this._onEnterKeyDown(event); } else if (event.which === backspaceKey) { return this._onBackspaceKeyDown(); } else if (this._removeConfirm) { // user pressed another key, cancel removal from a backspace key this._unsetRemovingVisual(this._tags.length - 1); } }, /** * When the user presses backspace twice on the empty input, we delete the last tag on the field. * @method onBackspaceKeyDown * @private */ _onBackspaceKeyDown: function () { if (this._input.value) { return; } if (this._removeConfirm) { this._unsetRemovingVisual(this._tags.length - 1); this._removeTag(this._tags.length - 1); this._removeConfirm = null; } else { this._setRemovingVisual(this._tags.length - 1); } }, _onEnterKeyDown: function (event) { var tag = this._input.value; if (tag) { this._addTag(tag); this._input.value = ''; } InkEvent.stopDefault(event); }, _onBlur: function () { this._addTag(this._input.value); this._input.value = ''; }, /* For when the user presses backspace. * Set the style of the tag so that it seems like it's going to be removed * if they press backspace again. */ _setRemovingVisual: function (tagIndex) { var elm = this._viewElm.children[tagIndex]; Css.addClassName(elm, 'tag-deleting'); this._removeRemovingVisualTimeout = setTimeout(Ink.bindMethod(this, '_unsetRemovingVisual', tagIndex), 4000); InkEvent.observe(this._input, 'blur', Ink.bindMethod(this, '_unsetRemovingVisual', tagIndex)); this._removeConfirm = true; }, _unsetRemovingVisual: function (tagIndex) { var elm = this._viewElm.children[tagIndex]; if (elm) { Css.removeClassName(elm, 'tag-deleting'); clearTimeout(this._removeRemovingVisualTimeout); } this._removeConfirm = null; }, _removeTag: function (event) { var index; if (typeof event === 'object') { // click event on close button var elm = InkEvent.element(event).parentNode; index = InkElement.parentIndexOf(this._viewElm, elm); } else if (typeof event === 'number') { // manual removal index = event; } this._tags = InkArray.remove(this._tags, index, 1); InkElement.remove(this._viewElm.children[index]); this._tagsToMarkup(this._tags, this._element); }, _refocus: function (event) { this._input.focus(); InkEvent.stop(event); return false; } }; return TagField; }); /** * @module Ink.UI.Toggle_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.Toggle', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1','Ink.Util.Array_1'], function(Common, InkEvent, Css, InkElement, Selector, InkArray ) { 'use strict'; /** * Toggle component * * @class Ink.UI.Toggle * @constructor * @version 1 * @param {String|DOMElement} selector * @param {Object} [options] Options * @param {String} options.target CSS Selector that specifies the elements that this component will toggle * @param {String} [options.classNameOn='show-all'] className when toggle is On * @param {String} [options.classNameOff='hide-all'] className when toggle is Off. * @param {String} [options.triggerEvent='click'] Event that will trigger the toggling. * @param {Boolean} [options.closeOnClick=true] When this is on, if the user clicks outside of the toggled content, the target is toggled off. * @param {Selector} [options.closeOnInsideClick='a[href]'] Toggle off when an element matching this selector is clicked. Set to null to deactivate the check. Default: 'a[href]' (finds links) * @param {Boolean} [options.initialState=null] Whether to start toggled off, on, or as found in the markup. (false: off, true: on, null: markup) * @param {Function} [options.onChangeState=null] Callback to be called when the toggle state changes. Return `false` to cancel the event. * * @example * <div class="ink-dropdown"> * <button class="ink-button toggle" data-target="#dropdown">Dropdown <span class="icon-caret-down"></span></button> * <ul id="dropdown" class="dropdown-menu"> * <li class="heading">Heading</li> * <li class="separator-above"><a href="#">Option</a></li> * <li><a href="#">Option</a></li> * <li class="separator-above disabled"><a href="#">Disabled option</a></li> * <li class="submenu"> * <a href="#" class="toggle" data-target="#submenu1">A longer option name</a> * <ul id="submenu1" class="dropdown-menu"> * <li class="submenu"> * <a href="#" class="toggle" data-target="#ultrasubmenu">Sub option</a> * <ul id="ultrasubmenu" class="dropdown-menu"> * <li><a href="#">Sub option</a></li> * <li><a href="#" data-target="ultrasubmenu">Sub option</a></li> * <li><a href="#">Sub option</a></li> * </ul> * </li> * <li><a href="#">Sub option</a></li> * <li><a href="#">Sub option</a></li> * </ul> * </li> * <li><a href="#">Option</a></li> * </ul> * </div> * <script> * Ink.requireModules( ['Ink.Dom.Selector_1','Ink.UI.Toggle_1'], function( Selector, Toggle ){ * var toggleElement = Ink.s('.toggle'); * var toggleObj = new Toggle( toggleElement ); * }); * </script> */ var Toggle = function( selector, options ){ this._rootElement = Common.elOrSelector(selector, '[Ink.UI.Toggle root element]:'); this._options = Ink.extendObj({ target : undefined, triggerEvent: 'click', closeOnClick: true, isAccordion: false, initialState: null, classNameOn: 'show-all', classNameOff: 'hide-all', togglesDisplay: null, closeOnInsideClick: 'a[href]', // closes the toggle when a target is clicked and it is a link onChangeState: null }, options || {}, InkElement.data(this._rootElement)); this._targets = Common.elsOrSelector(this._options.target, 'Ink.UI.Toggle target option'); // Boolean option handling this._options.closeOnClick = this._options.closeOnClick.toString() === 'true'; // Actually a throolean if (this._options.initialState !== null){ this._options.initialState = this._options.initialState.toString() === 'true'; } else { this._options.initialState = Css.getStyle(this._targets[0], 'display') !== 'none'; } if (this._options.classNameOn !== 'show-all' || this._options.classNameOff !== 'hide-all') { for (var i = 0, len = this._targets.length; i < len; i++) { Css.removeClassName(this._targets[i], 'show-all'); Css.removeClassName(this._targets[i], 'hide-all'); } } this._init(); }; Toggle.prototype = { /** * Init function called by the constructor * * @method _init * @private */ _init: function(){ this._accordion = ( Css.hasClassName(this._rootElement.parentNode,'accordion') || Css.hasClassName(this._targets[0].parentNode,'accordion') ); this._firstTime = true; this._bindEvents(); if (this._options.initialState !== null) { this.setState(this._options.initialState, true); } else { // Add initial classes matching the current "display" of the object. var state = Css.getStyle(this._targets[0], 'display') !== 'none'; this.setState(state, true); } // Aditionally, remove any inline "display" style. for (var i = 0, len = this._targets.length; i < len; i++) { if (this._targets[i].style.display) { this._targets[i].style.display = ''; // becomes default } } }, /** * @method _bindEvents * @private */ _bindEvents: function () { if ( this._options.triggerEvent ) { InkEvent.observe( this._rootElement, this._options.triggerEvent, Ink.bind(this._onTriggerEvent, this)); } if( this._options.closeOnClick ){ InkEvent.observe( document, 'click', Ink.bind(this._onOutsideClick, this)); } if( this._options.closeOnInsideClick ) { var sel = this._options.closeOnInsideClick; if (sel.toString() === 'true') { sel = '*'; } InkEvent.observeMulti(this._targets, 'click', Ink.bind(function (e) { if ( InkElement.findUpwardsBySelector(InkEvent.element(e), sel) ) { this.setState(false, true); } }, this)); } }, /** * Event handler. It's responsible for handling the `triggerEvent` as defined in the options. * * This will trigger the toggle. * * @method _onTriggerEvent * @param {Event} event * @private */ _onTriggerEvent: function( event ){ // When the togglee is a child of the toggler, we get the togglee's events here. We have to check that this event is for us. var target = InkEvent.element(event); var isAncestorOfClickedElement = InkArray.some(this._targets, function (thisOne) { return thisOne === target || InkElement.isAncestorOf(thisOne, target); }); if (isAncestorOfClickedElement) { return; } if (this._accordion) { this._updateAccordion(); } var has = this.getState(); this.setState(!has, true); if (!has && this._firstTime) { this._firstTime = false; } InkEvent.stopDefault(event); }, /** * Be compatible with accordions * * @method _updateAccordion **/ _updateAccordion: function () { var elms, accordionElement; if( Css.hasClassName(this._targets[0].parentNode,'accordion') ){ accordionElement = this._targets[0].parentNode; } else { accordionElement = this._targets[0].parentNode.parentNode; } elms = Selector.select('.toggle, .ink-toggle',accordionElement); for(var i=0; i<elms.length; i+=1 ){ var dataset = InkElement.data( elms[i] ), targetElm = Selector.select( dataset.target,accordionElement ); if( (targetElm.length > 0) && (targetElm[0] !== this._targets[0]) ){ targetElm[0].style.display = 'none'; } } }, /** * Click handler. Will handle clicks outside the toggle component. * * @method _onOutsideClick * @param {Event} event * @private */ _onOutsideClick: function( event ){ var tgtEl = InkEvent.element(event), shades; var ancestorOfTargets = InkArray.some(this._targets, function (target) { return InkElement.isAncestorOf(target, tgtEl) || target === tgtEl; }); if( (this._rootElement === tgtEl) || InkElement.isAncestorOf(this._rootElement, tgtEl) || ancestorOfTargets /*|| this._firstTime (I forgot what this last check was for) */) { return; } else if( (shades = Ink.ss('.ink-shade')).length ) { var shadesLength = shades.length; for( var i = 0; i < shadesLength; i++ ){ if( InkElement.isAncestorOf(shades[i],tgtEl) && InkElement.isAncestorOf(shades[i],this._rootElement) ){ return; } } } this.setState(false, true); // dismiss }, /** * Sets the state of the toggle. (on/off) * * @param on {Boolean} New state (on/off) * * @method setState */ setState: function (on, callHandler) { if (on === this.getState()) { return; } if (callHandler && typeof this._options.onChangeState === 'function') { var ret = this._options.onChangeState(on); if (ret === false) { return false; } // Canceled by the event handler } for (var i = 0, len = this._targets.length; i < len; i++) { Css.addRemoveClassName(this._targets[i], this._options.classNameOn, on); Css.addRemoveClassName(this._targets[i], this._options.classNameOff, !on); } Css.addRemoveClassName(this._rootElement, 'active', on); }, /** * Gets the state of the toggle. (on/off) * * @method getState * * @return {Boolean} whether the toggle is toggled on. */ getState: function () { return Css.hasClassName(this._rootElement, 'active'); } }; return Toggle; }); /** * @module Ink.UI.Tooltip_1 * @author inkdev AT sapo.pt */ Ink.createModule('Ink.UI.Tooltip', '1', ['Ink.UI.Common_1', 'Ink.Dom.Event_1', 'Ink.Dom.Element_1', 'Ink.Dom.Selector_1', 'Ink.Util.Array_1', 'Ink.Dom.Css_1', 'Ink.Dom.Browser_1'], function (Common, InkEvent, InkElement, Selector, InkArray, Css) { 'use strict'; /** * @class Ink.UI.Tooltip * @constructor * * @param {DOMElement|String} target Target element or selector of elements, to display the tooltips on. * @param {Object} [options] * @param [options.text=''] Text content for the tooltip. * @param [options.html=''] HTML for the tooltip. Same as above, but won't escape HTML. * @param [options.where='up'] Positioning for the tooltip. Options: * @param options.where.up/down/left/right Place above, below, to the left of, or to the right of, the target. Show an arrow. * @param options.where.mousemove Place the tooltip to the bottom and to the right of the mouse when it hovers the element, and follow the mouse as it moves. * @param options.where.mousefix Place the tooltip to the bottom and to the right of the mouse when it hovers the element, keep the tooltip there motionless. * * @param [options.color=''] Color of the tooltip. Options are red, orange, blue, green and black. Default is white. * @param [options.fade=0.3] Fade time; Duration of the fade in/out effect. * @param [options.forever=0] Set to 1/true to prevent the tooltip from being erased when the mouse hovers away from the target * @param [options.timeout=0] Time for the tooltip to live. Useful together with [options.forever]. * @param [options.delay] Time the tooltip waits until it is displayed. Useful to avoid getting the attention of the user unnecessarily * @param [options.template=null] Element or selector containing HTML to be cloned into the tooltips. Can be a hidden element, because CSS `display` is set to `block`. * @param [options.templatefield=null] Selector within the template element to choose where the text is inserted into the tooltip. Useful when a wrapper DIV is required. * * @param [options.left,top=10] (Nitty-gritty) Spacing from the target to the tooltip, when `where` is `mousemove` or `mousefix` * @param [options.spacing=8] (Nitty-gritty) Spacing between the tooltip and the target element, when `where` is `up`, `down`, `left`, or `right` * * @example * <ul class="buttons"> * <li class="button" data-tip-text="Create a new document">New</li> * <li class="button" data-tip-text="Exit the program">Quit</li> * <li class="button" data-tip-text="Save the document you are working on">Save</li> * </ul> * * [...] * * <script> * Ink.requireModules(['Ink.UI.Tooltip_1'], function (Tooltip) { * new Tooltip('.button', {where: 'mousefix'}); * }); * </script> */ function Tooltip(element, options) { this._init(element, options || {}); } function EachTooltip(root, elm) { this._init(root, elm); } var transitionDurationName, transitionPropertyName, transitionTimingFunctionName; (function () { // Feature detection var test = document.createElement('DIV'); var names = ['transition', 'oTransition', 'msTransition', 'mozTransition', 'webkitTransition']; for (var i = 0; i < names.length; i++) { if (typeof test.style[names[i] + 'Duration'] !== 'undefined') { transitionDurationName = names[i] + 'Duration'; transitionPropertyName = names[i] + 'Property'; transitionTimingFunctionName = names[i] + 'TimingFunction'; break; } } }()); // Body or documentElement var bodies = document.getElementsByTagName('body'); var body = bodies.length ? bodies[0] : document.documentElement; Tooltip.prototype = { _init: function(element, options) { var elements; this.options = Ink.extendObj({ where: 'up', zIndex: 10000, left: 10, top: 10, spacing: 8, forever: 0, color: '', timeout: 0, delay: 0, template: null, templatefield: null, fade: 0.3, text: '' }, options || {}); if (typeof element === 'string') { elements = Selector.select(element); } else if (typeof element === 'object') { elements = [element]; } else { throw 'Element expected'; } this.tooltips = []; for (var i = 0, len = elements.length; i < len; i++) { this.tooltips[i] = new EachTooltip(this, elements[i]); } }, /** * Destroys the tooltips created by this instance * * @method destroy */ destroy: function () { InkArray.each(this.tooltips, function (tooltip) { tooltip._destroy(); }); this.tooltips = null; this.options = null; } }; EachTooltip.prototype = { _oppositeDirections: { left: 'right', right: 'left', up: 'down', down: 'up' }, _init: function(root, elm) { InkEvent.observe(elm, 'mouseover', Ink.bindEvent(this._onMouseOver, this)); InkEvent.observe(elm, 'mouseout', Ink.bindEvent(this._onMouseOut, this)); InkEvent.observe(elm, 'mousemove', Ink.bindEvent(this._onMouseMove, this)); this.root = root; this.element = elm; this._delayTimeout = null; this.tooltip = null; }, _makeTooltip: function (mousePosition) { if (!this._getOpt('text') && !this._getOpt('html') && !InkElement.hasAttribute(this.element, 'title')) { return false; } var tooltip = this._createTooltipElement(); if (this.tooltip) { this._removeTooltip(); } this.tooltip = tooltip; this._fadeInTooltipElement(tooltip); this._placeTooltipElement(tooltip, mousePosition); InkEvent.observe(tooltip, 'mouseover', Ink.bindEvent(this._onTooltipMouseOver, this)); var timeout = this._getFloatOpt('timeout'); if (timeout) { setTimeout(Ink.bind(function () { if (this.tooltip === tooltip) { this._removeTooltip(); } }, this), timeout * 1000); } }, _createTooltipElement: function () { var template = this._getOpt('template'), // User template instead of our HTML templatefield = this._getOpt('templatefield'), tooltip, // The element we float field; // Element where we write our message. Child or same as the above if (template) { // The user told us of a template to use. We copy it. var temp = document.createElement('DIV'); temp.innerHTML = Common.elOrSelector(template, 'options.template').outerHTML; tooltip = temp.firstChild; if (templatefield) { field = Selector.select(templatefield, tooltip); if (field) { field = field[0]; } else { throw 'options.templatefield must be a valid selector within options.template'; } } else { field = tooltip; // Assume same element if user did not specify a field } } else { // We create the default structure tooltip = document.createElement('DIV'); Css.addClassName(tooltip, 'ink-tooltip'); Css.addClassName(tooltip, this._getOpt('color')); field = document.createElement('DIV'); Css.addClassName(field, 'content'); tooltip.appendChild(field); } if (this._getOpt('html')) { field.innerHTML = this._getOpt('html'); } else if (this._getOpt('text')) { InkElement.setTextContent(field, this._getOpt('text')); } else { InkElement.setTextContent(field, this.element.getAttribute('title')); } tooltip.style.display = 'block'; tooltip.style.position = 'absolute'; tooltip.style.zIndex = this._getIntOpt('zIndex'); return tooltip; }, _fadeInTooltipElement: function (tooltip) { var fadeTime = this._getFloatOpt('fade'); if (transitionDurationName && fadeTime) { tooltip.style.opacity = '0'; tooltip.style[transitionDurationName] = fadeTime + 's'; tooltip.style[transitionPropertyName] = 'opacity'; tooltip.style[transitionTimingFunctionName] = 'ease-in-out'; setTimeout(function () { tooltip.style.opacity = '1'; }, 0); // Wait a tick } }, _placeTooltipElement: function (tooltip, mousePosition) { var where = this._getOpt('where'); if (where === 'mousemove' || where === 'mousefix') { var mPos = mousePosition; this._setPos(mPos[0], mPos[1]); body.appendChild(tooltip); } else if (where.match(/(up|down|left|right)/)) { body.appendChild(tooltip); var targetElementPos = InkElement.offset(this.element); var tleft = targetElementPos[0], ttop = targetElementPos[1]; var centerh = (InkElement.elementWidth(this.element) / 2) - (InkElement.elementWidth(tooltip) / 2), centerv = (InkElement.elementHeight(this.element) / 2) - (InkElement.elementHeight(tooltip) / 2); var spacing = this._getIntOpt('spacing'); var tooltipDims = InkElement.elementDimensions(tooltip); var elementDims = InkElement.elementDimensions(this.element); var maxX = InkElement.scrollWidth() + InkElement.viewportWidth(); var maxY = InkElement.scrollHeight() + InkElement.viewportHeight(); where = this._getWhereValueInsideViewport(where, { left: tleft - tooltipDims[0], right: tleft + tooltipDims[0], top: ttop + tooltipDims[1], bottom: ttop + tooltipDims[1] }, { right: maxX, bottom: maxY }); if (where === 'up') { ttop -= tooltipDims[1]; ttop -= spacing; tleft += centerh; } else if (where === 'down') { ttop += elementDims[1]; ttop += spacing; tleft += centerh; } else if (where === 'left') { tleft -= tooltipDims[0]; tleft -= spacing; ttop += centerv; } else if (where === 'right') { tleft += elementDims[0]; tleft += spacing; ttop += centerv; } var arrow = null; if (where.match(/(up|down|left|right)/)) { arrow = document.createElement('SPAN'); Css.addClassName(arrow, 'arrow'); Css.addClassName(arrow, this._oppositeDirections[where]); tooltip.appendChild(arrow); } var tooltipLeft = tleft; var tooltipTop = ttop; var toBottom = (tooltipTop + tooltipDims[1]) - maxY; var toRight = (tooltipLeft + tooltipDims[0]) - maxX; var toLeft = 0 - tooltipLeft; var toTop = 0 - tooltipTop; if (toBottom > 0) { if (arrow) { arrow.style.top = (tooltipDims[1] / 2) + toBottom + 'px'; } tooltipTop -= toBottom; } else if (toTop > 0) { if (arrow) { arrow.style.top = (tooltipDims[1] / 2) - toTop + 'px'; } tooltipTop += toTop; } else if (toRight > 0) { if (arrow) { arrow.style.left = (tooltipDims[0] / 2) + toRight + 'px'; } tooltipLeft -= toRight; } else if (toLeft > 0) { if (arrow) { arrow.style.left = (tooltipDims[0] / 2) - toLeft + 'px'; } tooltipLeft += toLeft; } tooltip.style.left = tooltipLeft + 'px'; tooltip.style.top = tooltipTop + 'px'; } }, /** * Get a value for "where" (left/right/up/down) which doesn't put the * tooltip off the screen * * @method _getWhereValueInsideViewport * @param where {String} "where" value which was given by the user and we might change * @param bbox {BoundingBox} A bounding box like what you get from getBoundingClientRect ({top, bottom, left, right}) with pixel positions from the top left corner of the viewport. * @param viewport {BoundingBox} Bounding box for the viewport. "top" and "left" are omitted because these coordinates are relative to the top-left corner of the viewport so they are zero. * * @note: we can't use getBoundingClientRect in this case because it returns {0,0,0,0} on our uncreated tooltip. */ _getWhereValueInsideViewport: function (where, bbox, viewport) { if (where === 'left' && bbox.left < 0) { return 'right'; } else if (where === 'right' && bbox.right > viewport.right) { return 'left'; } else if (where === 'up' && bbox.top < 0) { return 'down'; } else if (where === 'down' && bbox.bottom > viewport.bottom) { return 'up'; } return where; }, _removeTooltip: function() { var tooltip = this.tooltip; if (!tooltip) {return;} var remove = Ink.bind(InkElement.remove, {}, tooltip); if (this._getOpt('where') !== 'mousemove' && transitionDurationName) { tooltip.style.opacity = 0; // remove() will operate on correct tooltip, although this.tooltip === null then setTimeout(remove, this._getFloatOpt('fade') * 1000); } else { remove(); } this.tooltip = null; }, _getOpt: function (option) { var dataAttrVal = InkElement.data(this.element)[InkElement._camelCase('tip-' + option)]; if (dataAttrVal /* either null or "" may signify the absense of this attribute*/) { return dataAttrVal; } var instanceOption = this.root.options[option]; if (typeof instanceOption !== 'undefined') { return instanceOption; } }, _getIntOpt: function (option) { return parseInt(this._getOpt(option), 10); }, _getFloatOpt: function (option) { return parseFloat(this._getOpt(option), 10); }, _destroy: function () { if (this.tooltip) { InkElement.remove(this.tooltip); } this.root = null; // Cyclic reference = memory leaks this.element = null; this.tooltip = null; }, _onMouseOver: function(e) { // on IE < 10 you can't access the mouse event not even a tick after it fired var mousePosition = this._getMousePosition(e); var delay = this._getFloatOpt('delay'); if (delay) { this._delayTimeout = setTimeout(Ink.bind(function () { if (!this.tooltip) { this._makeTooltip(mousePosition); } this._delayTimeout = null; }, this), delay * 1000); } else { this._makeTooltip(mousePosition); } }, _onMouseMove: function(e) { if (this._getOpt('where') === 'mousemove' && this.tooltip) { var mPos = this._getMousePosition(e); this._setPos(mPos[0], mPos[1]); } }, _onMouseOut: function () { if (!this._getIntOpt('forever')) { this._removeTooltip(); } if (this._delayTimeout) { clearTimeout(this._delayTimeout); this._delayTimeout = null; } }, _onTooltipMouseOver: function () { if (this.tooltip) { // If tooltip is already being removed, this has no effect this._removeTooltip(); } }, _setPos: function(left, top) { left += this._getIntOpt('left'); top += this._getIntOpt('top'); var pageDims = this._getPageXY(); if (this.tooltip) { var elmDims = [InkElement.elementWidth(this.tooltip), InkElement.elementHeight(this.tooltip)]; var scrollDim = this._getScroll(); if((elmDims[0] + left - scrollDim[0]) >= (pageDims[0] - 20)) { left = (left - elmDims[0] - this._getIntOpt('left') - 10); } if((elmDims[1] + top - scrollDim[1]) >= (pageDims[1] - 20)) { top = (top - elmDims[1] - this._getIntOpt('top') - 10); } this.tooltip.style.left = left + 'px'; this.tooltip.style.top = top + 'px'; } }, _getPageXY: function() { var cWidth = 0; var cHeight = 0; if( typeof( window.innerWidth ) === 'number' ) { cWidth = window.innerWidth; cHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { cWidth = document.documentElement.clientWidth; cHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { cWidth = document.body.clientWidth; cHeight = document.body.clientHeight; } return [parseInt(cWidth, 10), parseInt(cHeight, 10)]; }, _getScroll: function() { var dd = document.documentElement, db = document.body; if (dd && (dd.scrollLeft || dd.scrollTop)) { return [dd.scrollLeft, dd.scrollTop]; } else if (db) { return [db.scrollLeft, db.scrollTop]; } else { return [0, 0]; } }, _getMousePosition: function(e) { return [parseInt(InkEvent.pointerX(e), 10), parseInt(InkEvent.pointerY(e), 10)]; } }; return Tooltip; }); /** * @module Ink.UI.TreeView_1 * @author inkdev AT sapo.pt * @version 1 */ Ink.createModule('Ink.UI.TreeView', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1','Ink.Util.Array_1'], function(Common, Event, Css, Element, Selector, InkArray ) { 'use strict'; /** * Shows elements in a tree-like hierarchical structure. * * @class Ink.UI.TreeView * @constructor * @version 1 * @param {String|DOMElement} selector * @param {String} [options.node='li'] Selector to define which elements are seen as nodes. * @param {String} [options.children='ul'] Selector to define which elements are represented as children. * @param {String} [options.parentClass='parent'] Classes to be added to the parent node. * @param {String} [options.openClass='icon icon-minus-circle'] Classes to be added to the icon when a parent is open. * @param {String} [options.closedClass='icon icon-plus-circle'] Classes to be added to the icon when a parent is closed. * @param {String} [options.hideClass='hide-all'] Class to toggle visibility of the children. * @param {String} [options.iconTag='i'] The name of icon tag. The component tries to find a tag with that name as a direct child of the node. If it doesn't find it, it creates it. * @param {Boolean} [options.stopDefault=true] Stops the default behavior of the click handler. * @example * <ul class="ink-tree-view"> * <li data-open="true"><a href="#">root</a> * <ul> * <li><a href="#">child 1</a></li> * <li><a href="#">child 2</a> * <ul> * <li><a href="#">grandchild 2a</a></li> * <li><a href="#">grandchild 2b</a> * <ul> * <li><a href="#">grandgrandchild 1bA</a></li> * <li><a href="#">grandgrandchild 1bB</a></li> * </ul> * </li> * </ul> * </li> * <li><a href="#">child 3</a></li> * </ul> * </li> * </ul> * <script> * Ink.requireModules( ['Ink.Dom.Selector_1','Ink.UI.TreeView_1'], function( Selector, TreeView ){ * var treeViewElement = Ink.s('.ink-tree-view'); * var treeViewObj = new TreeView( treeViewElement ); * }); * </script> */ var TreeView = function(selector, options){ this._element = Common.elOrSelector(selector, '[Ink.UI.TreeView_1]'); this._options = Common.options('Treeview', { 'node': ['String', 'li'], // [3.0.1] Deprecate this terrible, terrible name 'child': ['String','ul'], 'children': ['String','ul'], 'parentClass': ['String','parent'], // [3.0.0] use these classes because you'll have font-awesome 4 // 'openClass': ['String','fa fa-minus-circle'], // 'closedClass': ['String','fa fa-plus-circle'], 'openNodeClass': ['String', 'open'], 'openClass': ['String','icon-minus-sign'], 'closedClass': ['String','icon-plus-sign'], 'hideClass': ['String','hide-all'], 'iconTag': ['String', 'i'], 'stopDefault' : ['Boolean', true] }, options || {}, this._element); if (this._options.child) { Ink.warn('Ink.UI.TreeView: options.child is being renamed to options.children.'); this._options.children = this._options.child; } this._init(); }; TreeView.prototype = { /** * Init function called by the constructor. Sets the necessary event handlers. * * @method _init * @private */ _init: function(){ this._handlers = { click: Ink.bindEvent(this._onClick,this) }; Event.on(this._element, 'click', this._options.node, this._handlers.click); InkArray.each(Ink.ss(this._options.node, this._element), Ink.bind(function(item){ if( this.isParent(item) ) { Css.addClassName(item, this._options.parentClass); var isOpen = this.isOpen(item); if( !this._getIcon(item) ){ Element.create(this._options.iconTag, { insertTop: item }); } this._setNodeOpen(item, isOpen); } },this)); }, _getIcon: function (node) { return Ink.s('> ' + this._options.iconTag, node); }, isOpen: function (node) { if (!this._getChild(node)) { throw new Error('not a node!'); } return Element.data(node).open === 'true' || Css.hasClassName(node, this._options.openNodeClass); }, isParent: function (node) { return Css.hasClassName(node, this._options.parentClass) || this._getChild(node) != null; }, _setNodeOpen: function (node, beOpen) { var child = this._getChild(node); if (child) { Css.setClassName(child, this._options.hideClass, !beOpen); var icon = this._getIcon(node); node.setAttribute('data-open', beOpen); Css.setClassName(icon, this._options.openClass, beOpen); Css.setClassName(icon, this._options.closedClass, !beOpen); Css.setClassName(node, this._options.openNodeClass, beOpen); } else { Ink.error('Ink.UI.TreeView: node', node, 'is not a node!'); } }, open: function (node) { this._setNodeOpen(node, true); }, close: function (node) { this._setNodeOpen(node, false); }, toggle: function (node) { if (this.isOpen(node)) { this.close(node); } else { this.open(node); } }, _getChild: function (node) { return Selector.select(this._options.child, node)[0] || null; }, /** * Handles the click event (as specified in the _init function). * * @method _onClick * @param {Event} event * @private */ _onClick: function(ev){ /** * Summary: * If the clicked element is a "node" as defined in the options, will check if it has any "child". * If so, will toggle its state and stop the event's default behavior if the stopDefault option is true. **/ if (!this.isParent(ev.currentTarget) || Selector.matchesSelector(ev.target, this._options.node) || Selector.matchesSelector(ev.target, this._options.child)) { return; } if (this._options.stopDefault){ ev.preventDefault(); } this.toggle(ev.currentTarget); } }; return TreeView; }); Ink.createModule('Ink.UI.Upload', '1', [ 'Ink.Dom.Event_1', 'Ink.Dom.Element_1', 'Ink.Dom.Browser_1', 'Ink.UI.Common_1' ], function(Event, Element, Browser, Common) { 'use strict'; var DirectoryReader = function(options) { this.init(options); }; DirectoryReader.prototype = { init: function(options) { this.options = Ink.extendObj({ entry: undefined, maxDepth: 10 }, options || {}); try { this._read(); } catch(e) { Ink.error(e); } }, _read: function() { if(!this.options.entry) { throw("The entry specify you must"); } try { this._readDirectories(); } catch(e) { Ink.error(e); } }, _readDirectories: function() { var entries = [], running = false, maxDepth = 0; /* TODO return as tree because much better well */ var _readEntries = Ink.bind(function(currentEntry) { var dir = currentEntry.createReader(); running = true; dir.readEntries(Ink.bind(function(res) { if(res.length > 0) { for(var i = 0, len = res.length; i<len; i++) { entries.push(res[i]); if(!res[i].isDirectory) { continue; } maxDepth = this.clearArray(res[i].fullPath.split('/')); maxDepth.shift(); maxDepth = maxDepth.length; if(maxDepth <= this.options.maxDepth) { _readEntries(res[i]); } } if(this._stopActivityTimeout) { clearTimeout(this._stopActivityTimeout); } this._stopActivityTimeout = setTimeout(function() { running = false; }, 250); } if(!res.length) { running = false; } }, this), Ink.bind(function(err) { this.options.readError(err, currentEntry); }, this)); }, this); _readEntries(this.options.entry); var activity; var checkActivity = function() { if(running) { return false; } clearInterval(activity); if(this.options.readComplete && typeof this.options.readComplete === 'function') { this.options.readComplete(entries); } return true; }; activity = setInterval(Ink.bind(checkActivity, this), 250); }, clearArray: function(arr) { for(var i = arr.length - 1; i>=0; i--) { if(typeof(arr[i]) === 'undefined' || arr[i] === null || arr[i] === '') { arr.splice(i, 1); } } return arr; } }; var Queue = { lists: [], items: [], /** * @function {Public} ? Create new queue list * @param {String} list name * @param {Function} function to iterate on items * @return {Object} list id */ create: function(name) { var id; name = String(name); this.lists.push({name: name}); id = this.lists.length - 1; return id; }, getItems: function(parentId) { if(!parentId) { return this.items; } var items = []; for(var i = 0, len = this.items.length; i<len; i++) { if(this.items[i].parentId === parentId) { items.push(this.items[i]); } } return items; }, /** * @function {Public} ? Delete list * @param {String} List name * @return {Object} removed list */ purge: function(id, keepList) { if(typeof(id) !== 'number' || isNaN(Number(id))) { return false; } try { for(var i = this.items.length; i>=0; i--) { if(this.items[i] && id === this.items[i].parentId) { this.remove(this.items[i].parentId, this.items[i].pid); } } if(!keepList) { this.lists.splice(id, 1); } return true; } catch(e) { Ink.error('Purge: invalid id'); return false; } }, /** * @function {Public} ? add an item to a list * @param {String} name * @param {Object} item * @return {Number} pid */ add: function(parentId, item, priority) { if(!this.lists[parentId]) { return false; } if(typeof(item) !== 'object') { item = String(item); } var pid = parseInt(Math.round(Math.random() * 100000) + "" + Math.round(Math.random() * 100000), 10); priority = priority || 0; this.items.push({parentId: parentId, item: item, priority: priority || 0, pid: pid}); return pid; }, /** * @function {Public} ? view list * @param {Number} list id * @param {Number} process id * @return {Object} item */ view: function(parentId, pid) { var id = this._searchByPid(parentId, pid); if(id === false) { return false; } return this.items[id]; }, /** * @function {Public} ? remove an item * @param {Object} item * @return {Object|Boolean} removed item or false if not found */ remove: function(parentId, pid) { try { var id = this._searchByPid(parentId, pid); if(id === false) { return false; } this.items.splice(id, 1); return true; } catch(e) { Ink.error('Remove: invalid id'); return false; } }, _searchByPid: function(parentId, pid) { if(!parentId && typeof(parentId) === 'boolean' || !pid) { return false; } parentId = parseInt(parentId, 10); pid = parseInt(pid, 10); if(isNaN(parentId) || isNaN(pid)) { return false; } for(var i = 0, len = this.items.length; i<len; i++) { if(this.items[i].parentId === parentId && this.items[i].pid === pid) { return i; } } return false; } }; var UI = function(Upload) { this.Upload = Upload; this.init(); }; UI.prototype = { init: function() { this._fileButton = this.Upload.options.fileButton; this._dropzone = this.Upload.options.dropzone; this._setDropEvent(); this._setFileButton(); }, _setDropEvent: function() { var dropzones = this._dropzone; for(var i = 0, len = dropzones.length; i<len; i++) { dropzones[i].ondrop = Ink.bindEvent(this.Upload._dropEventHandler, this.Upload); dropzones[i].ondragleave = Ink.bindEvent(this._onDragLeave, this); dropzones[i].ondragend = Ink.bindEvent(this._onDragEndEventHandler, this); dropzones[i].ondragenter = Ink.bindEvent(this._onDragEnterHandler, this); dropzones[i].ondragover = Ink.bindEvent(this._onDragOverHandler, this); } }, _onDragEnterHandler: function(ev) { if(ev && ev.stopPropagation) { ev.stopPropagation(); } if(ev && ev.preventDefault) { ev.preventDefault(); } if(ev) { ev.returnValue = false; } this.Upload.publish('DragEnter', ev); return false; }, _onDragOverHandler: function(ev) { if(!ev) { return false; } ev.preventDefault(); ev.stopPropagation(); ev.returnValue = false; return true; }, _onDragLeave: function(ev) { return this.Upload.publish('DragLeave', ev); }, _onDragEndEventHandler: function(ev) { return this.Upload.publish('DragEnd', ev); }, _setFileButton: function() { var btns = this._fileButton; Event.observeMulti(btns, 'change', Ink.bindEvent(this._fileChangeHandler, this)); }, _fileChangeHandler: function(ev) { var btn = Event.element(ev); var files = btn.files; var form = Element.findUpwardsByTag(btn, 'form'); if(!files || !window.FormData || !('withCredentials' in new XMLHttpRequest())) { form.parentNode.submit(); return false; } this.Upload._addFilesToQueue(files); btn.value = ""; } }; var Upload = function(options) { this.Queue = Queue; this.init(options); this._events = {}; }; Upload.prototype = { //_events: {}, init: function(options) { if (typeof options === 'string') { options = Element.data(Common.elOrSelector(options, '1st argument')); } this.options = Ink.extendObj({ extraData: {}, fileFormName: 'Ink_Filelist', dropzone: undefined, fileButton: undefined, endpoint: '', endpointChunk: '', endpointChunkCommit:'', maxFilesize: 300 << 20, //300mb chunkSize: 4194304, // 4MB minSizeToUseChunks: 20971520, // 20mb INVALID_FILE_NAME: undefined, foldersEnabled: true, useChunks: true, directoryMaxDepth: 10 }, options || {}); this._queueId = Queue.create('Ink_UPLOAD'); this._queueRunning = false; this._folders = {}; if(this.options.dropzone) { Common.elOrSelector(this.options.dropzone, 'Upload - dropzone'); } if(this.options.fileButton) { Common.elOrSelector(this.options.fileButton, 'Upload - fileButton'); } if(!this.options.dropzone && ! this.options.fileButton) { throw new TypeError('A file button or dropzone, specify you must, my young padawan'); } this.options.dropzone = Ink.ss(this.options.dropzone); this.options.fileButton= Ink.ss(this.options.fileButton); new UI(this); }, _supportChunks: function(size) { return this.options.useChunks && 'Blob' in window && (new Blob()).slice && size > this.options.minSizeToUseChunks; }, _dropEventHandler: function(ev) { if(ev && ev.stopPropagation) { ev.stopPropagation(); } if(ev && ev.preventDefault) { ev.preventDefault(); } if(ev) { ev.returnValue = false; } this.publish('DropComplete', ev.dataTransfer); var data = ev.dataTransfer; if(!data || !data.files || !data.files.length) { return false; } this._files = data.files; this._files = Array.prototype.slice.call(this._files || [], 0); // check if webkitGetAsEntry exists on first item if(data.items && data.items[0] && data.items[0].webkitGetAsEntry) { if(!this.options.foldersEnabled) { return setTimeout(Ink.bind(this._addFilesToQueue, this, this._files), 0); } var entry, folders = []; for(var i = ev.dataTransfer.items.length-1; i>=0; i--) { entry = ev.dataTransfer.items[i].webkitGetAsEntry(); if(entry && entry.isDirectory) { folders.push(entry); this._files[i].isDirectory = true; this._files.splice(i, 1); } } // starting callback hell this._addFolderToQueue(folders, Ink.bind(function() { setTimeout(Ink.bind(this._addFilesToQueue, this, this._files), 0); }, this)); } else { setTimeout(Ink.bind(this._addFilesToQueue, this, this._files), 0); } return true; }, _addFolderToQueue: function(folders, cb) { var files = [], invalidFolders = {}; if(!folders || !folders.length) { cb(); return files; } var getFiles = function(entries) { var files = []; for(var i = 0, len = entries.length; i<len; i++) { if(entries[i].isFile) { files.push(entries[i]); } } return files; }; var convertToFile = function(cb, index) { var fullPath; index = index || 0; if(!this._files[index]) { cb(); return files; } if(this._files[index].constructor.name.toLowerCase() !== 'fileentry') { return convertToFile.apply(this, [cb, ++index]); } this._files[index].file(Ink.bind(function(res) { fullPath = this._files[index].fullPath; // bug this._files[index] = res; this._files[index].hasParent = true; // if browser don't have it natively, set it if(!this._files[index].fullPath) { this._files[index].fullPath = fullPath; } convertToFile.apply(this, [cb, ++index]); }, this), Ink.bind(function() { this._files.splice(index, 1); convertToFile.apply(this, [cb, index]); }, this)); }; var getSubDirs = Ink.bind(function(index) { if(!folders[index]) { this._files = this._files.concat(files); convertToFile.call(this, cb); return false; } new DirectoryReader({ entry: folders[index], maxDepth: this.options.directoryMaxDepth, readComplete: Ink.bind(function(entries) { files = files.concat(getFiles(entries)); // adding root dirs if(!folders[index] || folders[index].fullPath in this._folders) { return; } this._folders[folders[index].fullPath] = { items: entries, files: files, length: entries.length, created: false, root: true }; // adding sub dirs for(var i = 0, len = entries.length; i<len; i++) { if(entries[i].isFile) { continue; } if(entries[i].fullPath in invalidFolders) { delete invalidFolders[entries[i].fullPath]; continue; } this._folders[entries[i].fullPath] = { created: false, root: false }; } getSubDirs(++index); }, this), readError: Ink.bind(function(err, dir) { invalidFolders[dir.fullPath] = {}; invalidFolders[dir.fullPath].error = err; }, this) }); }, this); getSubDirs(0); return files; }, _addFilesToQueue: function(files) { var file, fileID, o; for(var i = 0, len = files.length; i<len; i++) { file = files[i]; if(!file.isDirectory) { // dirty hack to allow 0B files avoiding folders on GECKO if(file === null || (!file.type && file.size % 4096 === 0 && (!Browser.CHROME || !this.options.foldersEnabled))) { this.publish('InvalidFile', file, 'size'); continue; } } if(file.size > this.options.maxFilesize) { this.publish('MaxSizeFailure', file, this.options.maxFilesize); continue; } fileID = parseInt(Math.round(Math.random() * 100000) + "" + Math.round(Math.random() * 100000), 10); o = { id: i, data: file, fileID: fileID, directory: file.isDirectory }; Queue.add(this._queueId, o); this.publish('FileAddedToQueue', o); } this._processQueue(true); this._files = []; }, _processQueue: function(internalUpload) { if(this._queueRunning) { return false; } this.running = 0; var max = 1, i = 0, items, queueLen = Queue.items.length; this._queueRunning = true; this.interval = setInterval(Ink.bind(function() { if(Queue.items.length === i && this.running === 0) { Queue.purge(this._queueId, true); this._queueRunning = false; clearInterval(this.interval); this.publish('QueueEnd', this._queueId, queueLen); } items = Queue.getItems(this._queueId); if(this.running < max && items[i]) { if(!items[i].canceled) { _doRequest.call(this, items[i].pid, items[i].item.data, items[i].item.fileID, items[i].item.directory, internalUpload); this.running++; i++; } else { var j = i; while(items[j] && items[j].canceled) { i++; j++; } } return true; } return false; }, this), 100); var _doRequest = function(pid, data, fileID, directory, internalUpload) { var o = { file: data, fileID: fileID, cb: Ink.bind(function() { this.running--; }, this) }; if(internalUpload) { if(directory) { // do magic o.cb(); } else { this._upload(o); } } }; return true; }, _upload: function(o) { var file = o.file, xhr = new XMLHttpRequest(), fileID = o.fileID; this.publish('BeforeUpload', file, this.options.extraData, fileID, xhr, this._supportChunks(file.size)); var forceAbort = function(showError) { if(o.cb && typeof(o.cb === 'function')) { o.cb(); } this.publish('OnProgress', { length: file.size, lengthComputable: true, loaded: file.size, total: file.size }, file, fileID); this.publish('EndUpload', file, fileID, (showError ? { error: true } : true)); this.publish('InvalidFile', file, 'name'); xhr.abort(); }; if(this.options.INVALID_FILE_NAME && this.options.INVALID_FILE_NAME instanceof RegExp) { if(this.options.INVALID_FILE_NAME.test(o.file.name)) { forceAbort.call(this); return; } } // If file was renamed, abort it // FU OPERA: Opera always return lastModified date as null if(!file.lastModifiedDate && !Ink.Dom.Browser.OPERA) { forceAbort.call(this, true); return; } xhr.upload.onprogress = Ink.bind(this.publish, this, 'OnProgress', file, fileID); var endpoint, method; if(this._supportChunks(file.size)) { if(file.size <= file.chunk_offset) { endpoint = this.options.endpointChunkCommit; method = 'POST'; } else { endpoint = this.options.endpointChunk; if(file.chunk_upload_id) { endpoint += '?upload_id=' + file.chunk_upload_id; } if(file.chunk_offset) { endpoint += '&offset=' + file.chunk_offset; } method = 'PUT'; } } else { endpoint = this.options.endpoint; method = 'POST'; } xhr.open(method, endpoint, true); xhr.withCredentials = true; xhr.setRequestHeader("x-requested-with", "XMLHttpRequest"); if(this._supportChunks(file.size)) { xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); } var fd = new FormData(), blob; if("Blob" in window && typeof Blob === 'function') { blob = new Blob([file], { type: file.type }); if(this._supportChunks(file.size)) { file.chunk_offset = file.chunk_offset || 0; blob = blob.slice(file.chunk_offset, file.chunk_offset + this.options.chunkSize); } else { fd.append(this.options.fileFormName, blob, file.name); } } else { fd.append(this.options.fileFormName, file); } if(!this._supportChunks(file.size)) { for(var k in this.options.extraData) { if(this.options.extraData.hasOwnProperty(k)) { fd.append(k, this.options.extraData[k]); } } } else { fd.append('upload_id', file.chunk_upload_id); fd.append('path', file.upload_path); } if(!file.hasParent) { if(!this._supportChunks(file.size)) { xhr.send(fd); } else { if(file.size <= file.chunk_offset) { xhr.send('upload_id=' + file.chunk_upload_id + '&path=' + file.upload_path + '/' + file.name); } else { xhr.send(blob); } } } else { this.publish('cbCreateFolder', file.parentID, file.fullPath, this.options.extraData, this._folders, file.rootPath, Ink.bind(function() { if(!this._supportChunks(file.size)) { xhr.send(fd); } else { if(file.size <= file.chunk_offset) { xhr.send('upload_id=' + file.chunk_upload_id + '&path=' + file.upload_path + '/' + file.name); } else { xhr.send(blob); } } }, this)); } xhr.onload = Ink.bindEvent(function() { /* jshint boss:true */ if(this._supportChunks(file.size) && file.size > file.chunk_offset) { if(xhr.response) { var response = JSON.parse(xhr.response); // check expected offset var invalidOffset = file.chunk_offset && response.offset !== (file.chunk_offset + this.options.chunkSize) && file.size !== response.offset; if(invalidOffset) { if(o.cb) { o.cb(); } this.publish('ErrorUpload', file, fileID); } else { file.chunk_upload_id = response.upload_id; file.chunk_offset = response.offset; file.chunk_expires = response.expires; this._upload(o); } } else { if(o.cb) { o.cb(); } this.publish('ErrorUpload', file, fileID); } return (xhr = null); } if(o.cb) { o.cb(); } if(xhr.responseText && xhr['status'] < 400) { this.publish('EndUpload', file, fileID, xhr.responseText); } else { this.publish('ErrorUpload', file, fileID); } return (xhr = null); }, this); xhr.onerror = Ink.bindEvent(function() { if(o.cb) { o.cb(); } this.publish('ErrorUpload', file, fileID); }, this); xhr.onabort = Ink.bindEvent(function() { if(o.cb) { o.cb(); } this.publish('AbortUpload', file, fileID, { abortAll: Ink.bind(this.abortAll, this), abortOne: Ink.bind(this.abortOne, this) }); }, this); }, abortAll: function() { if(!this._queueRunning) { return false; } clearInterval(this.interval); this._queueRunning = false; Queue.purge(this._queueId, true); return true; }, abortOne: function(id, cb) { var items = Queue.getItems(0), o; for(var i = 0, len = items.length; i<len; i++) { if(items[i].item.fileID === id) { o = { id: items[i].item.fileID, name: items[i].item.data.name, size: items[i].item.data.size, hasParent: items[i].item.data.hasParent }; Queue.remove(0, items[i].pid); if(cb) { cb(o); } return true; } } return false; }, subscribe: function(eventName, fn) { if(!this._events[eventName]) { this._events[eventName] = []; } this._events[eventName].push(fn); return this._events[eventName]; }, publish: function(eventName) { var events = this._events[eventName], args = Array.prototype.slice.call(arguments || [], 0); if(!events) { return; } for(var i = 0, len = events.length; i<len; i++) { try { events[i].apply(this, args.splice(1, args.length)); } catch(err) { Ink.error(eventName + ": " + err); } } } }; return Upload; });
wenzhixin/cdnjs
ajax/libs/ink/2.3.0/js/ink-all.js
JavaScript
mit
911,499
/* * # Semantic UI * https://github.com/Semantic-Org/Semantic-UI * http://www.semantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ /******************************* Activity Feed *******************************/ .ui.feed { margin: 1em 0em; } .ui.feed:first-child { margin-top: 0em; } .ui.feed:last-child { margin-top: 0em; } /******************************* Content *******************************/ /* Event */ .ui.feed > .event { display: table; width: 100%; padding: 0.5rem 0em; margin: 0em; background: none; border-top: none; } .ui.feed > .event:first-child { border-top: 0px; padding-top: 0em; } .ui.feed > .event:last-child { padding-bottom: 0em; } /* Event Label */ .ui.feed > .event > .label { display: table-cell; width: 2.5em; height: 2.5em; vertical-align: top; text-align: left; } .ui.feed > .event > .label .icon { opacity: 1; font-size: 1.5em; width: 100%; padding: 0.25em; background: none; border: none; border-radius: none; color: rgba(0, 0, 0, 0.6); } .ui.feed > .event > .label img { width: 100%; height: auto; border-radius: 500rem; } .ui.feed > .event > .label + .content { padding: 0.5em 0em 0.5em 1.25em; } /* Content */ .ui.feed > .event > .content { display: table-cell; vertical-align: top; text-align: left; word-wrap: break-word; } .ui.feed > .event:last-child > .content { padding-bottom: 0em; } /* Link */ .ui.feed > .event > .content a { cursor: pointer; } /*-------------- Date ---------------*/ .ui.feed > .event > .content .date { margin: -0.5rem 0em 0em; padding: 0em; font-weight: normal; font-size: 1em; font-style: normal; color: rgba(0, 0, 0, 0.4); } /*-------------- Summary ---------------*/ .ui.feed > .event > .content .summary { margin: 0em; font-size: 1em; font-weight: bold; color: rgba(0, 0, 0, 0.8); } /* Summary Image */ .ui.feed > .event > .content .summary img { display: inline-block; width: auto; height: 2em; margin: -0.25em 0.25em 0em 0em; border-radius: 0.25em; vertical-align: middle; } /*-------------- User ---------------*/ .ui.feed > .event > .content .user { display: inline-block; font-weight: bold; margin-right: 0em; vertical-align: baseline; } .ui.feed > .event > .content .user img { margin: -0.25em 0.25em 0em 0em; width: auto; height: 2em; vertical-align: middle; } /*-------------- Inline Date ---------------*/ /* Date inside Summary */ .ui.feed > .event > .content .summary > .date { display: inline-block; float: none; font-weight: normal; font-size: 0.875em; font-style: normal; margin: 0em 0em 0em 0.5em; padding: 0em; color: rgba(0, 0, 0, 0.4); } /*-------------- Extra Summary ---------------*/ .ui.feed > .event > .content .extra { margin: 0.5em 0em 0em; background: none; padding: 0em; color: rgba(0, 0, 0, 0.8); } /* Images */ .ui.feed > .event > .content .extra.images img { display: inline-block; margin: 0em 0.25em 0em 0em; width: 6em; } /* Text */ .ui.feed > .event > .content .extra.text { padding: 0.5em 1em; border-left: 3px solid rgba(0, 0, 0, 0.2); font-size: 1em; max-width: 500px; line-height: 1.33; } /*-------------- Meta ---------------*/ .ui.feed > .event > .content .meta { display: inline-block; font-size: 0.875em; margin: 0.5em 0em 0em; background: none; border: none; border-radius: 0; box-shadow: none; padding: 0em; color: rgba(0, 0, 0, 0.6); } .ui.feed > .event > .content .meta > * { position: relative; margin-left: 0.75em; } .ui.feed > .event > .content .meta > *:after { content: ''; color: rgba(0, 0, 0, 0.2); top: 0em; left: -1em; opacity: 1; position: absolute; vertical-align: top; } .ui.feed > .event > .content .meta .like { color: ''; -webkit-transition: 0.2s color ease; transition: 0.2s color ease; } .ui.feed > .event > .content .meta .like:hover .icon { color: #ff2733; } .ui.feed > .event > .content .meta .active.like .icon { color: #ef404a; } /* First element */ .ui.feed > .event > .content .meta > :first-child { margin-left: 0em; } .ui.feed > .event > .content .meta > :first-child::after { display: none; } /* Action */ .ui.feed > .event > .content .meta a, .ui.feed > .event > .content .meta > .icon { cursor: pointer; opacity: 1; color: rgba(0, 0, 0, 0.5); -webkit-transition: color 0.2s ease; transition: color 0.2s ease; } .ui.feed > .event > .content .meta a:hover, .ui.feed > .event > .content .meta a:hover .icon, .ui.feed > .event > .content .meta > .icon:hover { color: rgba(0, 0, 0, 0.8); } /******************************* Variations *******************************/ .ui.small.feed { font-size: 0.9em; } .ui.feed { font-size: 1em; } .ui.large.feed { font-size: 1.1em; } /******************************* Theme Overrides *******************************/ /******************************* User Variable Overrides *******************************/
dominicrico/cdnjs
ajax/libs/semantic-ui/1.0.1/components/feed.css
CSS
mit
5,112
/* * # Semantic UI * https://github.com/Semantic-Org/Semantic-UI * http://www.semantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ /******************************* Activity Feed *******************************/ .ui.feed { margin: 1em 0em; } .ui.feed:first-child { margin-top: 0em; } .ui.feed:last-child { margin-top: 0em; } /******************************* Content *******************************/ /* Event */ .ui.feed > .event { display: table; width: 100%; padding: 0.5rem 0em; margin: 0em; background: none; border-top: none; } .ui.feed > .event:first-child { border-top: 0px; padding-top: 0em; } .ui.feed > .event:last-child { padding-bottom: 0em; } /* Event Label */ .ui.feed > .event > .label { display: table-cell; width: 2.5em; height: 2.5em; vertical-align: top; text-align: left; } .ui.feed > .event > .label .icon { opacity: 1; font-size: 1.5em; width: 100%; padding: 0.25em; background: none; border: none; border-radius: none; color: rgba(0, 0, 0, 0.6); } .ui.feed > .event > .label img { width: 100%; height: auto; border-radius: 500rem; } .ui.feed > .event > .label + .content { padding: 0.5em 0em 0.5em 1.25em; } /* Content */ .ui.feed > .event > .content { display: table-cell; vertical-align: top; text-align: left; word-wrap: break-word; } .ui.feed > .event:last-child > .content { padding-bottom: 0em; } /* Link */ .ui.feed > .event > .content a { cursor: pointer; } /*-------------- Date ---------------*/ .ui.feed > .event > .content .date { margin: -0.5rem 0em 0em; padding: 0em; font-weight: normal; font-size: 1em; font-style: normal; color: rgba(0, 0, 0, 0.4); } /*-------------- Summary ---------------*/ .ui.feed > .event > .content .summary { margin: 0em; font-size: 1em; font-weight: bold; color: rgba(0, 0, 0, 0.8); } /* Summary Image */ .ui.feed > .event > .content .summary img { display: inline-block; width: auto; height: 2em; margin: -0.25em 0.25em 0em 0em; border-radius: 0.25em; vertical-align: middle; } /*-------------- User ---------------*/ .ui.feed > .event > .content .user { display: inline-block; font-weight: bold; margin-right: 0em; vertical-align: baseline; } .ui.feed > .event > .content .user img { margin: -0.25em 0.25em 0em 0em; width: auto; height: 2em; vertical-align: middle; } /*-------------- Inline Date ---------------*/ /* Date inside Summary */ .ui.feed > .event > .content .summary > .date { display: inline-block; float: none; font-weight: normal; font-size: 0.875em; font-style: normal; margin: 0em 0em 0em 0.5em; padding: 0em; color: rgba(0, 0, 0, 0.4); } /*-------------- Extra Summary ---------------*/ .ui.feed > .event > .content .extra { margin: 0.5em 0em 0em; background: none; padding: 0em; color: rgba(0, 0, 0, 0.8); } /* Images */ .ui.feed > .event > .content .extra.images img { display: inline-block; margin: 0em 0.25em 0em 0em; width: 6em; } /* Text */ .ui.feed > .event > .content .extra.text { padding: 0.5em 1em; border-left: 3px solid rgba(0, 0, 0, 0.2); font-size: 1em; max-width: 500px; line-height: 1.33; } /*-------------- Meta ---------------*/ .ui.feed > .event > .content .meta { display: inline-block; font-size: 0.875em; margin: 0.5em 0em 0em; background: none; border: none; border-radius: 0; box-shadow: none; padding: 0em; color: rgba(0, 0, 0, 0.6); } .ui.feed > .event > .content .meta > * { position: relative; margin-left: 0.75em; } .ui.feed > .event > .content .meta > *:after { content: ''; color: rgba(0, 0, 0, 0.2); top: 0em; left: -1em; opacity: 1; position: absolute; vertical-align: top; } .ui.feed > .event > .content .meta .like { color: ''; -webkit-transition: 0.2s color ease; transition: 0.2s color ease; } .ui.feed > .event > .content .meta .like:hover .icon { color: #ff2733; } .ui.feed > .event > .content .meta .active.like .icon { color: #ef404a; } /* First element */ .ui.feed > .event > .content .meta > :first-child { margin-left: 0em; } .ui.feed > .event > .content .meta > :first-child::after { display: none; } /* Action */ .ui.feed > .event > .content .meta a, .ui.feed > .event > .content .meta > .icon { cursor: pointer; opacity: 1; color: rgba(0, 0, 0, 0.5); -webkit-transition: color 0.2s ease; transition: color 0.2s ease; } .ui.feed > .event > .content .meta a:hover, .ui.feed > .event > .content .meta a:hover .icon, .ui.feed > .event > .content .meta > .icon:hover { color: rgba(0, 0, 0, 0.8); } /******************************* Variations *******************************/ .ui.small.feed { font-size: 0.9em; } .ui.feed { font-size: 1em; } .ui.large.feed { font-size: 1.1em; } /******************************* Theme Overrides *******************************/ /******************************* User Variable Overrides *******************************/
Nadeermalangadan/cdnjs
ajax/libs/semantic-ui/1.5.0/components/feed.css
CSS
mit
5,112
/* Modernizr 2.7.1 (Custom Build) | MIT & BSD * Build: http://modernizr.com/download/#-canvas-audio-video-input-inputtypes-geolocation-shiv-addtest-prefixed-testprop-testallprops-prefixes-domprefixes */ ; window.Modernizr = (function( window, document, undefined ) { var version = '2.7.1', Modernizr = {}, docElement = document.documentElement, mod = 'modernizr', modElem = document.createElement(mod), mStyle = modElem.style, inputElem = document.createElement('input') , smile = ':)', toString = {}.toString, prefixes = ' -webkit- -moz- -o- -ms- '.split(' '), omPrefixes = 'Webkit Moz O ms', cssomPrefixes = omPrefixes.split(' '), domPrefixes = omPrefixes.toLowerCase().split(' '), tests = {}, inputs = {}, attrs = {}, classes = [], slice = classes.slice, featureName, _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp; if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) { hasOwnProp = function (object, property) { return _hasOwnProperty.call(object, property); }; } else { hasOwnProp = function (object, property) { return ((property in object) && is(object.constructor.prototype[property], 'undefined')); }; } if (!Function.prototype.bind) { Function.prototype.bind = function bind(that) { var target = this; if (typeof target != "function") { throw new TypeError(); } var args = slice.call(arguments, 1), bound = function () { if (this instanceof bound) { var F = function(){}; F.prototype = target.prototype; var self = new F(); var result = target.apply( self, args.concat(slice.call(arguments)) ); if (Object(result) === result) { return result; } return self; } else { return target.apply( that, args.concat(slice.call(arguments)) ); } }; return bound; }; } function setCss( str ) { mStyle.cssText = str; } function setCssAll( str1, str2 ) { return setCss(prefixes.join(str1 + ';') + ( str2 || '' )); } function is( obj, type ) { return typeof obj === type; } function contains( str, substr ) { return !!~('' + str).indexOf(substr); } function testProps( props, prefixed ) { for ( var i in props ) { var prop = props[i]; if ( !contains(prop, "-") && mStyle[prop] !== undefined ) { return prefixed == 'pfx' ? prop : true; } } return false; } function testDOMProps( props, obj, elem ) { for ( var i in props ) { var item = obj[props[i]]; if ( item !== undefined) { if (elem === false) return props[i]; if (is(item, 'function')){ return item.bind(elem || obj); } return item; } } return false; } function testPropsAll( prop, prefixed, elem ) { var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' '); if(is(prefixed, "string") || is(prefixed, "undefined")) { return testProps(props, prefixed); } else { props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' '); return testDOMProps(props, prefixed, elem); } } tests['canvas'] = function() { var elem = document.createElement('canvas'); return !!(elem.getContext && elem.getContext('2d')); }; tests['geolocation'] = function() { return 'geolocation' in navigator; }; tests['video'] = function() { var elem = document.createElement('video'), bool = false; try { if ( bool = !!elem.canPlayType ) { bool = new Boolean(bool); bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,''); bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,''); bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,''); } } catch(e) { } return bool; }; tests['audio'] = function() { var elem = document.createElement('audio'), bool = false; try { if ( bool = !!elem.canPlayType ) { bool = new Boolean(bool); bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,''); bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,''); bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,''); bool.m4a = ( elem.canPlayType('audio/x-m4a;') || elem.canPlayType('audio/aac;')) .replace(/^no$/,''); } } catch(e) { } return bool; }; function webforms() { Modernizr['input'] = (function( props ) { for ( var i = 0, len = props.length; i < len; i++ ) { attrs[ props[i] ] = !!(props[i] in inputElem); } if (attrs.list){ attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement); } return attrs; })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' ')); Modernizr['inputtypes'] = (function(props) { for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) { inputElem.setAttribute('type', inputElemType = props[i]); bool = inputElem.type !== 'text'; if ( bool ) { inputElem.value = smile; inputElem.style.cssText = 'position:absolute;visibility:hidden;'; if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) { docElement.appendChild(inputElem); defaultView = document.defaultView; bool = defaultView.getComputedStyle && defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' && (inputElem.offsetHeight !== 0); docElement.removeChild(inputElem); } else if ( /^(search|tel)$/.test(inputElemType) ){ } else if ( /^(url|email)$/.test(inputElemType) ) { bool = inputElem.checkValidity && inputElem.checkValidity() === false; } else { bool = inputElem.value != smile; } } inputs[ props[i] ] = !!bool; } return inputs; })('search tel url email datetime date month week time datetime-local number range color'.split(' ')); } for ( var feature in tests ) { if ( hasOwnProp(tests, feature) ) { featureName = feature.toLowerCase(); Modernizr[featureName] = tests[feature](); classes.push((Modernizr[featureName] ? '' : 'no-') + featureName); } } Modernizr.input || webforms(); Modernizr.addTest = function ( feature, test ) { if ( typeof feature == 'object' ) { for ( var key in feature ) { if ( hasOwnProp( feature, key ) ) { Modernizr.addTest( key, feature[ key ] ); } } } else { feature = feature.toLowerCase(); if ( Modernizr[feature] !== undefined ) { return Modernizr; } test = typeof test == 'function' ? test() : test; if (typeof enableClasses !== "undefined" && enableClasses) { docElement.className += ' ' + (test ? '' : 'no-') + feature; } Modernizr[feature] = test; } return Modernizr; }; setCss(''); modElem = inputElem = null; ;(function(window, document) { var version = '3.7.0'; var options = window.html5 || {}; var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; var supportsHtml5Styles; var expando = '_html5shiv'; var expanID = 0; var expandoData = {}; var supportsUnknownElements; (function() { try { var a = document.createElement('a'); a.innerHTML = '<xyz></xyz>'; supportsHtml5Styles = ('hidden' in a); supportsUnknownElements = a.childNodes.length == 1 || (function() { (document.createElement)('a'); var frag = document.createDocumentFragment(); return ( typeof frag.cloneNode == 'undefined' || typeof frag.createDocumentFragment == 'undefined' || typeof frag.createElement == 'undefined' ); }()); } catch(e) { supportsHtml5Styles = true; supportsUnknownElements = true; } }()); function addStyleSheet(ownerDocument, cssText) { var p = ownerDocument.createElement('p'), parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; p.innerHTML = 'x<style>' + cssText + '</style>'; return parent.insertBefore(p.lastChild, parent.firstChild); } function getElements() { var elements = html5.elements; return typeof elements == 'string' ? elements.split(' ') : elements; } function getExpandoData(ownerDocument) { var data = expandoData[ownerDocument[expando]]; if (!data) { data = {}; expanID++; ownerDocument[expando] = expanID; expandoData[expanID] = data; } return data; } function createElement(nodeName, ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createElement(nodeName); } if (!data) { data = getExpandoData(ownerDocument); } var node; if (data.cache[nodeName]) { node = data.cache[nodeName].cloneNode(); } else if (saveClones.test(nodeName)) { node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); } else { node = data.createElem(nodeName); } return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node; } function createDocumentFragment(ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createDocumentFragment(); } data = data || getExpandoData(ownerDocument); var clone = data.frag.cloneNode(), i = 0, elems = getElements(), l = elems.length; for(;i<l;i++){ clone.createElement(elems[i]); } return clone; } function shivMethods(ownerDocument, data) { if (!data.cache) { data.cache = {}; data.createElem = ownerDocument.createElement; data.createFrag = ownerDocument.createDocumentFragment; data.frag = data.createFrag(); } ownerDocument.createElement = function(nodeName) { if (!html5.shivMethods) { return data.createElem(nodeName); } return createElement(nodeName, ownerDocument, data); }; ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' + 'var n=f.cloneNode(),c=n.createElement;' + 'h.shivMethods&&(' + getElements().join().replace(/[\w\-]+/g, function(nodeName) { data.createElem(nodeName); data.frag.createElement(nodeName); return 'c("' + nodeName + '")'; }) + ');return n}' )(html5, data.frag); } function shivDocument(ownerDocument) { if (!ownerDocument) { ownerDocument = document; } var data = getExpandoData(ownerDocument); if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) { data.hasCSS = !!addStyleSheet(ownerDocument, 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' + 'mark{background:#FF0;color:#000}' + 'template{display:none}' ); } if (!supportsUnknownElements) { shivMethods(ownerDocument, data); } return ownerDocument; } var html5 = { 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video', 'version': version, 'shivCSS': (options.shivCSS !== false), 'supportsUnknownElements': supportsUnknownElements, 'shivMethods': (options.shivMethods !== false), 'type': 'default', 'shivDocument': shivDocument, createElement: createElement, createDocumentFragment: createDocumentFragment }; window.html5 = html5; shivDocument(document); }(this, document)); Modernizr._version = version; Modernizr._prefixes = prefixes; Modernizr._domPrefixes = domPrefixes; Modernizr._cssomPrefixes = cssomPrefixes; Modernizr.testProp = function(prop){ return testProps([prop]); }; Modernizr.testAllProps = testPropsAll; Modernizr.prefixed = function(prop, obj, elem){ if(!obj) { return testPropsAll(prop, 'pfx'); } else { return testPropsAll(prop, obj, elem); } }; return Modernizr; })(this, this.document); ;
hare1039/cdnjs
ajax/libs/webshim/1.12.7/dev/extras/modernizr-custom.js
JavaScript
mit
12,314
.pace { -webkit-pointer-events: none; pointer-events: none; -webkit-user-select: none; -moz-user-select: none; user-select: none; } .pace-inactive { display: none; } .pace .pace-progress { background: `args.color || "#29d"`; position: fixed; z-index: 2000; top: 0; left: 0; height: 2px; -webkit-transition: width 1s; -moz-transition: width 1s; -o-transition: width 1s; transition: width 1s; } .pace .pace-progress-inner { display: block; position: absolute; right: 0px; width: 100px; height: 100%; box-shadow: 0 0 10px `args.color || '#29d'`, 0 0 5px `args.color || '#29d'`; opacity: 1.0; -webkit-transform: rotate(3deg) translate(0px, -4px); -moz-transform: rotate(3deg) translate(0px, -4px); -ms-transform: rotate(3deg) translate(0px, -4px); -o-transform: rotate(3deg) translate(0px, -4px); transform: rotate(3deg) translate(0px, -4px); } .pace .pace-activity { display: block; position: fixed; z-index: 2000; top: 15px; right: 15px; width: 14px; height: 14px; border: solid 2px transparent; border-top-color: `args.color || '#29d'`; border-left-color: `args.color || '#29d'`; border-radius: 10px; -webkit-animation: pace-spinner 400ms linear infinite; -moz-animation: pace-spinner 400ms linear infinite; -ms-animation: pace-spinner 400ms linear infinite; -o-animation: pace-spinner 400ms linear infinite; animation: pace-spinner 400ms linear infinite; } @-webkit-keyframes pace-spinner { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } @-moz-keyframes pace-spinner { 0% { -moz-transform: rotate(0deg); transform: rotate(0deg); } 100% { -moz-transform: rotate(360deg); transform: rotate(360deg); } } @-o-keyframes pace-spinner { 0% { -o-transform: rotate(0deg); transform: rotate(0deg); } 100% { -o-transform: rotate(360deg); transform: rotate(360deg); } } @-ms-keyframes pace-spinner { 0% { -ms-transform: rotate(0deg); transform: rotate(0deg); } 100% { -ms-transform: rotate(360deg); transform: rotate(360deg); } } @keyframes pace-spinner { 0% { transform: rotate(0deg); transform: rotate(0deg); } 100% { transform: rotate(360deg); transform: rotate(360deg); } }
binaek89/cdnjs
ajax/libs/pace/0.4.7/templates/pace-theme-flash.tmpl.css
CSS
mit
2,271
var arrayFilter = require('../internal/arrayFilter'), arrayMap = require('../internal/arrayMap'), baseProperty = require('../internal/baseProperty'), isArrayLike = require('../internal/isArrayLike'); /* Native method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; /** * This method is like `_.zip` except that it accepts an array of grouped * elements and creates an array regrouping the elements to their pre-zip * configuration. * * @static * @memberOf _ * @category Array * @param {Array} array The array of grouped elements to process. * @returns {Array} Returns the new array of regrouped elements. * @example * * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]); * // => [['fred', 30, true], ['barney', 40, false]] * * _.unzip(zipped); * // => [['fred', 'barney'], [30, 40], [true, false]] */ function unzip(array) { if (!(array && array.length)) { return []; } var index = -1, length = 0; array = arrayFilter(array, function(group) { if (isArrayLike(group)) { length = nativeMax(group.length, length); return true; } }); var result = Array(length); while (++index < length) { result[index] = arrayMap(array, baseProperty(index)); } return result; } module.exports = unzip;
amitkas/savebuy
node_modules/bower/lib/node_modules/inquirer/node_modules/lodash/array/unzip.js
JavaScript
mit
1,329
<?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\Bundle\DoctrineCacheBundle\Tests\Functional; use Doctrine\Bundle\DoctrineCacheBundle\Tests\FunctionalTestCase; /** * @group Functional */ abstract class BaseCacheTest extends FunctionalTestCase { /** * @return \Doctrine\Common\Cache\Cache */ abstract protected function createCacheDriver(); public function testCacheDriver() { $cache = $this->createCacheDriver(); $this->assertNotNull($cache); $this->assertInstanceOf('Doctrine\Common\Cache\Cache', $cache); $this->assertTrue($cache->save('key', 'value')); $this->assertTrue($cache->contains('key')); $this->assertEquals('value', $cache->fetch('key')); $this->assertTrue($cache->delete('key')); $this->assertFalse($cache->contains('key')); } }
dhaywael/eventro
vendor/doctrine/doctrine-cache-bundle/Doctrine/Bundle/DoctrineCacheBundle/Tests/Functional/BaseCacheTest.php
PHP
mit
1,803
<!doctype html> <title>CodeMirror: sTeX mode</title> <meta charset="utf-8"/> <link rel=stylesheet href="../../doc/docs.css"> <link rel="stylesheet" href="../../lib/codemirror.css"> <script src="../../lib/codemirror.js"></script> <script src="stex.js"></script> <style>.CodeMirror {background: #f8f8f8;}</style> <div id=nav> <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a> <ul> <li><a href="../../index.html">Home</a> <li><a href="../../doc/manual.html">Manual</a> <li><a href="https://github.com/marijnh/codemirror">Code</a> </ul> <ul> <li><a href="../index.html">Language modes</a> <li><a class=active href="#">sTeX</a> </ul> </div> <article> <h2>sTeX mode</h2> <form><textarea id="code" name="code"> \begin{module}[id=bbt-size] \importmodule[balanced-binary-trees]{balanced-binary-trees} \importmodule[\KWARCslides{dmath/en/cardinality}]{cardinality} \begin{frame} \frametitle{Size Lemma for Balanced Trees} \begin{itemize} \item \begin{assertion}[id=size-lemma,type=lemma] Let $G=\tup{V,E}$ be a \termref[cd=binary-trees]{balanced binary tree} of \termref[cd=graph-depth,name=vertex-depth]{depth}$n>i$, then the set $\defeq{\livar{V}i}{\setst{\inset{v}{V}}{\gdepth{v} = i}}$ of \termref[cd=graphs-intro,name=node]{nodes} at \termref[cd=graph-depth,name=vertex-depth]{depth} $i$ has \termref[cd=cardinality,name=cardinality]{cardinality} $\power2i$. \end{assertion} \item \begin{sproof}[id=size-lemma-pf,proofend=,for=size-lemma]{via induction over the depth $i$.} \begin{spfcases}{We have to consider two cases} \begin{spfcase}{$i=0$} \begin{spfstep}[display=flow] then $\livar{V}i=\set{\livar{v}r}$, where $\livar{v}r$ is the root, so $\eq{\card{\livar{V}0},\card{\set{\livar{v}r}},1,\power20}$. \end{spfstep} \end{spfcase} \begin{spfcase}{$i>0$} \begin{spfstep}[display=flow] then $\livar{V}{i-1}$ contains $\power2{i-1}$ vertexes \begin{justification}[method=byIH](IH)\end{justification} \end{spfstep} \begin{spfstep} By the \begin{justification}[method=byDef]definition of a binary tree\end{justification}, each $\inset{v}{\livar{V}{i-1}}$ is a leaf or has two children that are at depth $i$. \end{spfstep} \begin{spfstep} As $G$ is \termref[cd=balanced-binary-trees,name=balanced-binary-tree]{balanced} and $\gdepth{G}=n>i$, $\livar{V}{i-1}$ cannot contain leaves. \end{spfstep} \begin{spfstep}[type=conclusion] Thus $\eq{\card{\livar{V}i},{\atimes[cdot]{2,\card{\livar{V}{i-1}}}},{\atimes[cdot]{2,\power2{i-1}}},\power2i}$. \end{spfstep} \end{spfcase} \end{spfcases} \end{sproof} \item \begin{assertion}[id=fbbt,type=corollary] A fully balanced tree of depth $d$ has $\power2{d+1}-1$ nodes. \end{assertion} \item \begin{sproof}[for=fbbt,id=fbbt-pf]{} \begin{spfstep} Let $\defeq{G}{\tup{V,E}}$ be a fully balanced tree \end{spfstep} \begin{spfstep} Then $\card{V}=\Sumfromto{i}1d{\power2i}= \power2{d+1}-1$. \end{spfstep} \end{sproof} \end{itemize} \end{frame} \begin{note} \begin{omtext}[type=conclusion,for=binary-tree] This shows that balanced binary trees grow in breadth very quickly, a consequence of this is that they are very shallow (and this compute very fast), which is the essence of the next result. \end{omtext} \end{note} \end{module} %%% Local Variables: %%% mode: LaTeX %%% TeX-master: "all" %%% End: \end{document} </textarea></form> <script> var editor = CodeMirror.fromTextArea(document.getElementById("code"), {}); </script> <p><strong>MIME types defined:</strong> <code>text/x-stex</code>.</p> <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#stex_*">normal</a>, <a href="../../test/index.html#verbose,stex_*">verbose</a>.</p> </article>
SeanPlusPlus/cdnjs
ajax/libs/codemirror/3.17.0/mode/stex/index.html
HTML
mit
4,110
'use strict'; exports.__esModule = true; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _container = require('./container'); var _container2 = _interopRequireDefault(_container); var _warnOnce = require('./warn-once'); var _warnOnce2 = _interopRequireDefault(_warnOnce); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** * Represents an at-rule. * * If it’s followed in the CSS by a {} block, this node will have * a nodes property representing its children. * * @extends Container * * @example * const root = postcss.parse('@charset "UTF-8"; @media print {}'); * * const charset = root.first; * charset.type //=> 'atrule' * charset.nodes //=> undefined * * const media = root.last; * media.nodes //=> [] */ var AtRule = function (_Container) { _inherits(AtRule, _Container); function AtRule(defaults) { _classCallCheck(this, AtRule); var _this = _possibleConstructorReturn(this, _Container.call(this, defaults)); _this.type = 'atrule'; return _this; } AtRule.prototype.append = function append() { var _Container$prototype$; if (!this.nodes) this.nodes = []; for (var _len = arguments.length, children = Array(_len), _key = 0; _key < _len; _key++) { children[_key] = arguments[_key]; } return (_Container$prototype$ = _Container.prototype.append).call.apply(_Container$prototype$, [this].concat(children)); }; AtRule.prototype.prepend = function prepend() { var _Container$prototype$2; if (!this.nodes) this.nodes = []; for (var _len2 = arguments.length, children = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { children[_key2] = arguments[_key2]; } return (_Container$prototype$2 = _Container.prototype.prepend).call.apply(_Container$prototype$2, [this].concat(children)); }; _createClass(AtRule, [{ key: 'afterName', get: function get() { (0, _warnOnce2.default)('AtRule#afterName was deprecated. Use AtRule#raws.afterName'); return this.raws.afterName; }, set: function set(val) { (0, _warnOnce2.default)('AtRule#afterName was deprecated. Use AtRule#raws.afterName'); this.raws.afterName = val; } }, { key: '_params', get: function get() { (0, _warnOnce2.default)('AtRule#_params was deprecated. Use AtRule#raws.params'); return this.raws.params; }, set: function set(val) { (0, _warnOnce2.default)('AtRule#_params was deprecated. Use AtRule#raws.params'); this.raws.params = val; } /** * @memberof AtRule# * @member {string} name - the at-rule’s name immediately follows the `@` * * @example * const root = postcss.parse('@media print {}'); * media.name //=> 'media' * const media = root.first; */ /** * @memberof AtRule# * @member {string} params - the at-rule’s parameters, the values * that follow the at-rule’s name but precede * any {} block * * @example * const root = postcss.parse('@media print, screen {}'); * const media = root.first; * media.params //=> 'print, screen' */ /** * @memberof AtRule# * @member {object} raws - Information to generate byte-to-byte equal * node string as it was in the origin input. * * Every parser saves its own properties, * but the default CSS parser uses: * * * `before`: the space symbols before the node. It also stores `*` * and `_` symbols before the declaration (IE hack). * * `after`: the space symbols after the last child of the node * to the end of the node. * * `between`: the symbols between the property and value * for declarations, selector and `{` for rules, or last parameter * and `{` for at-rules. * * `semicolon`: contains true if the last child has * an (optional) semicolon. * * `afterName`: the space between the at-rule name and its parameters. * * PostCSS cleans at-rule parameters from comments and extra spaces, * but it stores origin content in raws properties. * As such, if you don’t change a declaration’s value, * PostCSS will use the raw value with comments. * * @example * const root = postcss.parse(' @media\nprint {\n}') * root.first.first.raws //=> { before: ' ', * // between: ' ', * // afterName: '\n', * // after: '\n' } */ }]); return AtRule; }(_container2.default); exports.default = AtRule; module.exports = exports['default']; //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImF0LXJ1bGUuZXM2Il0sIm5hbWVzIjpbIkF0UnVsZSIsImRlZmF1bHRzIiwidHlwZSIsImFwcGVuZCIsIm5vZGVzIiwiY2hpbGRyZW4iLCJwcmVwZW5kIiwicmF3cyIsImFmdGVyTmFtZSIsInZhbCIsInBhcmFtcyJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7Ozs7QUFDQTs7Ozs7Ozs7Ozs7O0FBRUE7Ozs7Ozs7Ozs7Ozs7Ozs7OztJQWtCTUEsTTs7O0FBRUYsb0JBQVlDLFFBQVosRUFBc0I7QUFBQTs7QUFBQSxxREFDbEIsc0JBQU1BLFFBQU4sQ0FEa0I7O0FBRWxCLGNBQUtDLElBQUwsR0FBWSxRQUFaO0FBRmtCO0FBR3JCOztxQkFFREMsTSxxQkFBb0I7QUFBQTs7QUFDaEIsWUFBSyxDQUFDLEtBQUtDLEtBQVgsRUFBbUIsS0FBS0EsS0FBTCxHQUFhLEVBQWI7O0FBREgsMENBQVZDLFFBQVU7QUFBVkEsb0JBQVU7QUFBQTs7QUFFaEIsZUFBTyw4Q0FBTUYsTUFBTixrREFBZ0JFLFFBQWhCLEVBQVA7QUFDSCxLOztxQkFFREMsTyxzQkFBcUI7QUFBQTs7QUFDakIsWUFBSyxDQUFDLEtBQUtGLEtBQVgsRUFBbUIsS0FBS0EsS0FBTCxHQUFhLEVBQWI7O0FBREYsMkNBQVZDLFFBQVU7QUFBVkEsb0JBQVU7QUFBQTs7QUFFakIsZUFBTywrQ0FBTUMsT0FBTixtREFBaUJELFFBQWpCLEVBQVA7QUFDSCxLOzs7OzRCQUVlO0FBQ1osb0NBQVMsNERBQVQ7QUFDQSxtQkFBTyxLQUFLRSxJQUFMLENBQVVDLFNBQWpCO0FBQ0gsUzswQkFFYUMsRyxFQUFLO0FBQ2Ysb0NBQVMsNERBQVQ7QUFDQSxpQkFBS0YsSUFBTCxDQUFVQyxTQUFWLEdBQXNCQyxHQUF0QjtBQUNIOzs7NEJBRWE7QUFDVixvQ0FBUyx1REFBVDtBQUNBLG1CQUFPLEtBQUtGLElBQUwsQ0FBVUcsTUFBakI7QUFDSCxTOzBCQUVXRCxHLEVBQUs7QUFDYixvQ0FBUyx1REFBVDtBQUNBLGlCQUFLRixJQUFMLENBQVVHLE1BQVYsR0FBbUJELEdBQW5CO0FBQ0g7O0FBRUQ7Ozs7Ozs7Ozs7QUFVQTs7Ozs7Ozs7Ozs7O0FBWUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7a0JBaUNXVCxNIiwiZmlsZSI6ImF0LXJ1bGUuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgQ29udGFpbmVyIGZyb20gJy4vY29udGFpbmVyJztcbmltcG9ydCB3YXJuT25jZSAgZnJvbSAnLi93YXJuLW9uY2UnO1xuXG4vKipcbiAqIFJlcHJlc2VudHMgYW4gYXQtcnVsZS5cbiAqXG4gKiBJZiBpdOKAmXMgZm9sbG93ZWQgaW4gdGhlIENTUyBieSBhIHt9IGJsb2NrLCB0aGlzIG5vZGUgd2lsbCBoYXZlXG4gKiBhIG5vZGVzIHByb3BlcnR5IHJlcHJlc2VudGluZyBpdHMgY2hpbGRyZW4uXG4gKlxuICogQGV4dGVuZHMgQ29udGFpbmVyXG4gKlxuICogQGV4YW1wbGVcbiAqIGNvbnN0IHJvb3QgPSBwb3N0Y3NzLnBhcnNlKCdAY2hhcnNldCBcIlVURi04XCI7IEBtZWRpYSBwcmludCB7fScpO1xuICpcbiAqIGNvbnN0IGNoYXJzZXQgPSByb290LmZpcnN0O1xuICogY2hhcnNldC50eXBlICAvLz0+ICdhdHJ1bGUnXG4gKiBjaGFyc2V0Lm5vZGVzIC8vPT4gdW5kZWZpbmVkXG4gKlxuICogY29uc3QgbWVkaWEgPSByb290Lmxhc3Q7XG4gKiBtZWRpYS5ub2RlcyAgIC8vPT4gW11cbiAqL1xuY2xhc3MgQXRSdWxlIGV4dGVuZHMgQ29udGFpbmVyIHtcblxuICAgIGNvbnN0cnVjdG9yKGRlZmF1bHRzKSB7XG4gICAgICAgIHN1cGVyKGRlZmF1bHRzKTtcbiAgICAgICAgdGhpcy50eXBlID0gJ2F0cnVsZSc7XG4gICAgfVxuXG4gICAgYXBwZW5kKC4uLmNoaWxkcmVuKSB7XG4gICAgICAgIGlmICggIXRoaXMubm9kZXMgKSB0aGlzLm5vZGVzID0gW107XG4gICAgICAgIHJldHVybiBzdXBlci5hcHBlbmQoLi4uY2hpbGRyZW4pO1xuICAgIH1cblxuICAgIHByZXBlbmQoLi4uY2hpbGRyZW4pIHtcbiAgICAgICAgaWYgKCAhdGhpcy5ub2RlcyApIHRoaXMubm9kZXMgPSBbXTtcbiAgICAgICAgcmV0dXJuIHN1cGVyLnByZXBlbmQoLi4uY2hpbGRyZW4pO1xuICAgIH1cblxuICAgIGdldCBhZnRlck5hbWUoKSB7XG4gICAgICAgIHdhcm5PbmNlKCdBdFJ1bGUjYWZ0ZXJOYW1lIHdhcyBkZXByZWNhdGVkLiBVc2UgQXRSdWxlI3Jhd3MuYWZ0ZXJOYW1lJyk7XG4gICAgICAgIHJldHVybiB0aGlzLnJhd3MuYWZ0ZXJOYW1lO1xuICAgIH1cblxuICAgIHNldCBhZnRlck5hbWUodmFsKSB7XG4gICAgICAgIHdhcm5PbmNlKCdBdFJ1bGUjYWZ0ZXJOYW1lIHdhcyBkZXByZWNhdGVkLiBVc2UgQXRSdWxlI3Jhd3MuYWZ0ZXJOYW1lJyk7XG4gICAgICAgIHRoaXMucmF3cy5hZnRlck5hbWUgPSB2YWw7XG4gICAgfVxuXG4gICAgZ2V0IF9wYXJhbXMoKSB7XG4gICAgICAgIHdhcm5PbmNlKCdBdFJ1bGUjX3BhcmFtcyB3YXMgZGVwcmVjYXRlZC4gVXNlIEF0UnVsZSNyYXdzLnBhcmFtcycpO1xuICAgICAgICByZXR1cm4gdGhpcy5yYXdzLnBhcmFtcztcbiAgICB9XG5cbiAgICBzZXQgX3BhcmFtcyh2YWwpIHtcbiAgICAgICAgd2Fybk9uY2UoJ0F0UnVsZSNfcGFyYW1zIHdhcyBkZXByZWNhdGVkLiBVc2UgQXRSdWxlI3Jhd3MucGFyYW1zJyk7XG4gICAgICAgIHRoaXMucmF3cy5wYXJhbXMgPSB2YWw7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlcm9mIEF0UnVsZSNcbiAgICAgKiBAbWVtYmVyIHtzdHJpbmd9IG5hbWUgLSB0aGUgYXQtcnVsZeKAmXMgbmFtZSBpbW1lZGlhdGVseSBmb2xsb3dzIHRoZSBgQGBcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogY29uc3Qgcm9vdCAgPSBwb3N0Y3NzLnBhcnNlKCdAbWVkaWEgcHJpbnQge30nKTtcbiAgICAgKiBtZWRpYS5uYW1lIC8vPT4gJ21lZGlhJ1xuICAgICAqIGNvbnN0IG1lZGlhID0gcm9vdC5maXJzdDtcbiAgICAgKi9cblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJvZiBBdFJ1bGUjXG4gICAgICogQG1lbWJlciB7c3RyaW5nfSBwYXJhbXMgLSB0aGUgYXQtcnVsZeKAmXMgcGFyYW1ldGVycywgdGhlIHZhbHVlc1xuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhhdCBmb2xsb3cgdGhlIGF0LXJ1bGXigJlzIG5hbWUgYnV0IHByZWNlZGVcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgIGFueSB7fSBibG9ja1xuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBjb25zdCByb290ICA9IHBvc3Rjc3MucGFyc2UoJ0BtZWRpYSBwcmludCwgc2NyZWVuIHt9Jyk7XG4gICAgICogY29uc3QgbWVkaWEgPSByb290LmZpcnN0O1xuICAgICAqIG1lZGlhLnBhcmFtcyAvLz0+ICdwcmludCwgc2NyZWVuJ1xuICAgICAqL1xuXG4gICAgLyoqXG4gICAgICogQG1lbWJlcm9mIEF0UnVsZSNcbiAgICAgKiBAbWVtYmVyIHtvYmplY3R9IHJhd3MgLSBJbmZvcm1hdGlvbiB0byBnZW5lcmF0ZSBieXRlLXRvLWJ5dGUgZXF1YWxcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBub2RlIHN0cmluZyBhcyBpdCB3YXMgaW4gdGhlIG9yaWdpbiBpbnB1dC5cbiAgICAgKlxuICAgICAqIEV2ZXJ5IHBhcnNlciBzYXZlcyBpdHMgb3duIHByb3BlcnRpZXMsXG4gICAgICogYnV0IHRoZSBkZWZhdWx0IENTUyBwYXJzZXIgdXNlczpcbiAgICAgKlxuICAgICAqICogYGJlZm9yZWA6IHRoZSBzcGFjZSBzeW1ib2xzIGJlZm9yZSB0aGUgbm9kZS4gSXQgYWxzbyBzdG9yZXMgYCpgXG4gICAgICogICBhbmQgYF9gIHN5bWJvbHMgYmVmb3JlIHRoZSBkZWNsYXJhdGlvbiAoSUUgaGFjaykuXG4gICAgICogKiBgYWZ0ZXJgOiB0aGUgc3BhY2Ugc3ltYm9scyBhZnRlciB0aGUgbGFzdCBjaGlsZCBvZiB0aGUgbm9kZVxuICAgICAqICAgdG8gdGhlIGVuZCBvZiB0aGUgbm9kZS5cbiAgICAgKiAqIGBiZXR3ZWVuYDogdGhlIHN5bWJvbHMgYmV0d2VlbiB0aGUgcHJvcGVydHkgYW5kIHZhbHVlXG4gICAgICogICBmb3IgZGVjbGFyYXRpb25zLCBzZWxlY3RvciBhbmQgYHtgIGZvciBydWxlcywgb3IgbGFzdCBwYXJhbWV0ZXJcbiAgICAgKiAgIGFuZCBge2AgZm9yIGF0LXJ1bGVzLlxuICAgICAqICogYHNlbWljb2xvbmA6IGNvbnRhaW5zIHRydWUgaWYgdGhlIGxhc3QgY2hpbGQgaGFzXG4gICAgICogICBhbiAob3B0aW9uYWwpIHNlbWljb2xvbi5cbiAgICAgKiAqIGBhZnRlck5hbWVgOiB0aGUgc3BhY2UgYmV0d2VlbiB0aGUgYXQtcnVsZSBuYW1lIGFuZCBpdHMgcGFyYW1ldGVycy5cbiAgICAgKlxuICAgICAqIFBvc3RDU1MgY2xlYW5zIGF0LXJ1bGUgcGFyYW1ldGVycyBmcm9tIGNvbW1lbnRzIGFuZCBleHRyYSBzcGFjZXMsXG4gICAgICogYnV0IGl0IHN0b3JlcyBvcmlnaW4gY29udGVudCBpbiByYXdzIHByb3BlcnRpZXMuXG4gICAgICogQXMgc3VjaCwgaWYgeW91IGRvbuKAmXQgY2hhbmdlIGEgZGVjbGFyYXRpb27igJlzIHZhbHVlLFxuICAgICAqIFBvc3RDU1Mgd2lsbCB1c2UgdGhlIHJhdyB2YWx1ZSB3aXRoIGNvbW1lbnRzLlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBjb25zdCByb290ID0gcG9zdGNzcy5wYXJzZSgnICBAbWVkaWFcXG5wcmludCB7XFxufScpXG4gICAgICogcm9vdC5maXJzdC5maXJzdC5yYXdzIC8vPT4geyBiZWZvcmU6ICcgICcsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgIC8vICAgICBiZXR3ZWVuOiAnICcsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgIC8vICAgICBhZnRlck5hbWU6ICdcXG4nLFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAvLyAgICAgYWZ0ZXI6ICdcXG4nIH1cbiAgICAgKi9cbn1cblxuZXhwb3J0IGRlZmF1bHQgQXRSdWxlO1xuIl19
jleonhard/angular2-webpack-jquery-bootstrap
node_modules/postcss-convert-values/node_modules/postcss/lib/at-rule.js
JavaScript
mit
12,827
!function(){function a(a){return a=+a,a!==a?a=0:0!==a&&a!==1/0&&a!==-(1/0)&&(a=(a>0||-1)*Math.floor(Math.abs(a))),a}function b(a){var b=typeof a;return null===a||"undefined"===b||"boolean"===b||"number"===b||"string"===b}function c(a){var c,d,e;if(b(a))return a;if(d=a.valueOf,p(d)&&(c=d.call(a),b(c)))return c;if(e=a.toString,p(e)&&(c=e.call(a),b(c)))return c;throw new TypeError}function d(){}setTimeout(function(){webshims.isReady("es5",!0)});var e,f=Array.prototype,g=Object.prototype,h=Function.prototype,i=String.prototype,j=Number.prototype,k=f.slice,l=f.splice,m=(f.push,f.unshift),n=h.call,o=g.toString,p=function(a){return"[object Function]"===g.toString.call(a)},q=function(a){return"[object RegExp]"===g.toString.call(a)},r=function(a){return"[object Array]"===o.call(a)},s=function(a){return"[object String]"===o.call(a)},t=function(a){var b=o.call(a),c="[object Arguments]"===b;return c||(c=!r(a)&&null!==a&&"object"==typeof a&&"number"==typeof a.length&&a.length>=0&&p(a.callee)),c},u=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(a){return!1}}();e=u?function(a,b,c,d){!d&&b in a||Object.defineProperty(a,b,{configurable:!0,enumerable:!1,writable:!0,value:c})}:function(a,b,c,d){!d&&b in a||(a[b]=c)};var v=function(a,b,c){for(var d in b)g.hasOwnProperty.call(b,d)&&e(a,d,b[d],c)},w=function(a){if(null==a)throw new TypeError("can't convert "+a+" to object");return Object(a)},x=function(a){return a>>>0};v(h,{bind:function(a){var b=this;if(!p(b))throw new TypeError("Function.prototype.bind called on incompatible "+b);for(var c=k.call(arguments,1),e=function(){if(this instanceof i){var d=b.apply(this,c.concat(k.call(arguments)));return Object(d)===d?d:this}return b.apply(a,c.concat(k.call(arguments)))},f=Math.max(0,b.length-c.length),g=[],h=0;f>h;h++)g.push("$"+h);var i=Function("binder","return function ("+g.join(",")+"){return binder.apply(this,arguments)}")(e);return b.prototype&&(d.prototype=b.prototype,i.prototype=new d,d.prototype=null),i}});var y,z,A,B,C,D=n.bind(g.hasOwnProperty);(C=D(g,"__defineGetter__"))&&(y=n.bind(g.__defineGetter__),z=n.bind(g.__defineSetter__),A=n.bind(g.__lookupGetter__),B=n.bind(g.__lookupSetter__));var E=function(){var a=[1,2],b=a.splice();return 2===a.length&&r(b)&&0===b.length}();v(f,{splice:function(){return 0===arguments.length?[]:l.apply(this,arguments)}},E);var F=function(){var a={};return f.splice.call(a,0,0,1),1===a.length}();v(f,{splice:function(b,c){if(0===arguments.length)return[];var d=arguments;return this.length=Math.max(a(this.length),0),arguments.length>0&&"number"!=typeof c&&(d=k.call(arguments),d.length<2?d.push(this.length-b):d[1]=a(c)),l.apply(this,d)}},!F);var G=1!==[].unshift(0);v(f,{unshift:function(){return m.apply(this,arguments),this.length}},G),v(Array,{isArray:r});var H=Object("a"),I="a"!==H[0]||!(0 in H),J=function(a){var b=!0,c=!0;return a&&(a.call("foo",function(a,c,d){"object"!=typeof d&&(b=!1)}),a.call([1],function(){"use strict";c="string"==typeof this},"x")),!!a&&b&&c};v(f,{forEach:function(a){var b=w(this),c=I&&s(this)?this.split(""):b,d=arguments[1],e=-1,f=c.length>>>0;if(!p(a))throw new TypeError;for(;++e<f;)e in c&&a.call(d,c[e],e,b)}},!J(f.forEach)),v(f,{map:function(a){var b=w(this),c=I&&s(this)?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if(!p(a))throw new TypeError(a+" is not a function");for(var g=0;d>g;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}},!J(f.map)),v(f,{filter:function(a){var b,c=w(this),d=I&&s(this)?this.split(""):c,e=d.length>>>0,f=[],g=arguments[1];if(!p(a))throw new TypeError(a+" is not a function");for(var h=0;e>h;h++)h in d&&(b=d[h],a.call(g,b,h,c)&&f.push(b));return f}},!J(f.filter)),v(f,{every:function(a){var b=w(this),c=I&&s(this)?this.split(""):b,d=c.length>>>0,e=arguments[1];if(!p(a))throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}},!J(f.every)),v(f,{some:function(a){var b=w(this),c=I&&s(this)?this.split(""):b,d=c.length>>>0,e=arguments[1];if(!p(a))throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&a.call(e,c[f],f,b))return!0;return!1}},!J(f.some));var K=!1;f.reduce&&(K="object"==typeof f.reduce.call("es5",function(a,b,c,d){return d})),v(f,{reduce:function(a){var b=w(this),c=I&&s(this)?this.split(""):b,d=c.length>>>0;if(!p(a))throw new TypeError(a+" is not a function");if(!d&&1===arguments.length)throw new TypeError("reduce of empty array with no initial value");var e,f=0;if(arguments.length>=2)e=arguments[1];else for(;;){if(f in c){e=c[f++];break}if(++f>=d)throw new TypeError("reduce of empty array with no initial value")}for(;d>f;f++)f in c&&(e=a.call(void 0,e,c[f],f,b));return e}},!K);var L=!1;f.reduceRight&&(L="object"==typeof f.reduceRight.call("es5",function(a,b,c,d){return d})),v(f,{reduceRight:function(a){var b=w(this),c=I&&s(this)?this.split(""):b,d=c.length>>>0;if(!p(a))throw new TypeError(a+" is not a function");if(!d&&1===arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var e,f=d-1;if(arguments.length>=2)e=arguments[1];else for(;;){if(f in c){e=c[f--];break}if(--f<0)throw new TypeError("reduceRight of empty array with no initial value")}if(0>f)return e;do f in c&&(e=a.call(void 0,e,c[f],f,b));while(f--);return e}},!L);var M=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);v(f,{indexOf:function(b){var c=I&&s(this)?this.split(""):w(this),d=c.length>>>0;if(!d)return-1;var e=0;for(arguments.length>1&&(e=a(arguments[1])),e=e>=0?e:Math.max(0,d+e);d>e;e++)if(e in c&&c[e]===b)return e;return-1}},M);var N=Array.prototype.lastIndexOf&&-1!==[0,1].lastIndexOf(0,-3);v(f,{lastIndexOf:function(b){var c=I&&s(this)?this.split(""):w(this),d=c.length>>>0;if(!d)return-1;var e=d-1;for(arguments.length>1&&(e=Math.min(e,a(arguments[1]))),e=e>=0?e:d-Math.abs(e);e>=0;e--)if(e in c&&b===c[e])return e;return-1}},N);var O=!{toString:null}.propertyIsEnumerable("toString"),P=function(){}.propertyIsEnumerable("prototype"),Q=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],R=Q.length;v(Object,{keys:function(a){var b=p(a),c=t(a),d=null!==a&&"object"==typeof a,e=d&&s(a);if(!d&&!b&&!c)throw new TypeError("Object.keys called on a non-object");var f=[],g=P&&b;if(e||c)for(var h=0;h<a.length;++h)f.push(String(h));else for(var i in a)g&&"prototype"===i||!D(a,i)||f.push(String(i));if(O)for(var j=a.constructor,k=j&&j.prototype===a,l=0;R>l;l++){var m=Q[l];k&&"constructor"===m||!D(a,m)||f.push(m)}return f}});var S=Object.keys&&function(){return 2===Object.keys(arguments).length}(1,2),T=Object.keys;v(Object,{keys:function(a){return T(t(a)?f.slice.call(a):a)}},!S);var U=-621987552e5,V="-000001",W=Date.prototype.toISOString&&-1===new Date(U).toISOString().indexOf(V);v(Date.prototype,{toISOString:function(){var a,b,c,d,e;if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");for(d=this.getUTCFullYear(),e=this.getUTCMonth(),d+=Math.floor(e/12),e=(e%12+12)%12,a=[e+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()],d=(0>d?"-":d>9999?"+":"")+("00000"+Math.abs(d)).slice(d>=0&&9999>=d?-4:-6),b=a.length;b--;)c=a[b],10>c&&(a[b]="0"+c);return d+"-"+a.slice(0,2).join("-")+"T"+a.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"}},W);var X=!1;try{X=Date.prototype.toJSON&&null===new Date(0/0).toJSON()&&-1!==new Date(U).toJSON().indexOf(V)&&Date.prototype.toJSON.call({toISOString:function(){return!0}})}catch(Y){}X||(Date.prototype.toJSON=function(){var a,b=Object(this),d=c(b);if("number"==typeof d&&!isFinite(d))return null;if(a=b.toISOString,"function"!=typeof a)throw new TypeError("toISOString property is not callable");return a.call(b)});var Z=1e15===Date.parse("+033658-09-27T01:46:40.000Z"),$=!isNaN(Date.parse("2012-04-04T24:00:00.500Z"))||!isNaN(Date.parse("2012-11-31T23:59:59.000Z")),_=isNaN(Date.parse("2000-01-01T00:00:00.000Z"));(!Date.parse||_||$||!Z)&&(Date=function(a){function b(c,d,e,f,g,h,i){var j=arguments.length;if(this instanceof a){var k=1===j&&String(c)===c?new a(b.parse(c)):j>=7?new a(c,d,e,f,g,h,i):j>=6?new a(c,d,e,f,g,h):j>=5?new a(c,d,e,f,g):j>=4?new a(c,d,e,f):j>=3?new a(c,d,e):j>=2?new a(c,d):j>=1?new a(c):new a;return k.constructor=b,k}return a.apply(this,arguments)}function c(a,b){var c=b>1?1:0;return f[b]+Math.floor((a-1969+c)/4)-Math.floor((a-1901+c)/100)+Math.floor((a-1601+c)/400)+365*(a-1970)}function d(b){return Number(new a(1970,0,1,0,0,0,b))}var e=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:(\\.\\d{1,}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),f=[0,31,59,90,120,151,181,212,243,273,304,334,365];for(var g in a)b[g]=a[g];return b.now=a.now,b.UTC=a.UTC,b.prototype=a.prototype,b.prototype.constructor=b,b.parse=function(b){var f=e.exec(b);if(f){var g,h=Number(f[1]),i=Number(f[2]||1)-1,j=Number(f[3]||1)-1,k=Number(f[4]||0),l=Number(f[5]||0),m=Number(f[6]||0),n=Math.floor(1e3*Number(f[7]||0)),o=Boolean(f[4]&&!f[8]),p="-"===f[9]?1:-1,q=Number(f[10]||0),r=Number(f[11]||0);return(l>0||m>0||n>0?24:25)>k&&60>l&&60>m&&1e3>n&&i>-1&&12>i&&24>q&&60>r&&j>-1&&j<c(h,i+1)-c(h,i)&&(g=60*(24*(c(h,i)+j)+k+q*p),g=1e3*(60*(g+l+r*p)+m)+n,o&&(g=d(g)),g>=-864e13&&864e13>=g)?g:0/0}return a.parse.apply(this,arguments)},b}(Date)),Date.now||(Date.now=function(){return(new Date).getTime()});var ab=j.toFixed&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==0xde0b6b3a7640080.toFixed(0)),bb={base:1e7,size:6,data:[0,0,0,0,0,0],multiply:function(a,b){for(var c=-1;++c<bb.size;)b+=a*bb.data[c],bb.data[c]=b%bb.base,b=Math.floor(b/bb.base)},divide:function(a){for(var b=bb.size,c=0;--b>=0;)c+=bb.data[b],bb.data[b]=Math.floor(c/a),c=c%a*bb.base},numToString:function(){for(var a=bb.size,b="";--a>=0;)if(""!==b||0===a||0!==bb.data[a]){var c=String(bb.data[a]);""===b?b=c:b+="0000000".slice(0,7-c.length)+c}return b},pow:function nb(a,b,c){return 0===b?c:b%2===1?nb(a,b-1,c*a):nb(a*a,b/2,c)},log:function(a){for(var b=0;a>=4096;)b+=12,a/=4096;for(;a>=2;)b+=1,a/=2;return b}};v(j,{toFixed:function(a){var b,c,d,e,f,g,h,i;if(b=Number(a),b=b!==b?0:Math.floor(b),0>b||b>20)throw new RangeError("Number.toFixed called with invalid number of decimals");if(c=Number(this),c!==c)return"NaN";if(-1e21>=c||c>=1e21)return String(c);if(d="",0>c&&(d="-",c=-c),e="0",c>1e-21)if(f=bb.log(c*bb.pow(2,69,1))-69,g=0>f?c*bb.pow(2,-f,1):c/bb.pow(2,f,1),g*=4503599627370496,f=52-f,f>0){for(bb.multiply(0,g),h=b;h>=7;)bb.multiply(1e7,0),h-=7;for(bb.multiply(bb.pow(10,h,1),0),h=f-1;h>=23;)bb.divide(1<<23),h-=23;bb.divide(1<<h),bb.multiply(1,1),bb.divide(2),e=bb.numToString()}else bb.multiply(0,g),bb.multiply(1<<-f,0),e=bb.numToString()+"0.00000000000000000000".slice(2,2+b);return b>0?(i=e.length,e=b>=i?d+"0.0000000000000000000".slice(0,b-i+2)+e:d+e.slice(0,i-b)+"."+e.slice(i-b)):e=d+e,e}},ab);var cb=i.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?!function(){var a=void 0===/()??/.exec("")[1];i.split=function(b,c){var d=this;if(void 0===b&&0===c)return[];if("[object RegExp]"!==o.call(b))return cb.call(this,b,c);var e,g,h,i,j=[],k=(b.ignoreCase?"i":"")+(b.multiline?"m":"")+(b.extended?"x":"")+(b.sticky?"y":""),l=0;for(b=new RegExp(b.source,k+"g"),d+="",a||(e=new RegExp("^"+b.source+"$(?!\\s)",k)),c=void 0===c?-1>>>0:x(c);(g=b.exec(d))&&(h=g.index+g[0].length,!(h>l&&(j.push(d.slice(l,g.index)),!a&&g.length>1&&g[0].replace(e,function(){for(var a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(g[a]=void 0)}),g.length>1&&g.index<d.length&&f.push.apply(j,g.slice(1)),i=g[0].length,l=h,j.length>=c)));)b.lastIndex===g.index&&b.lastIndex++;return l===d.length?(i||!b.test(""))&&j.push(""):j.push(d.slice(l)),j.length>c?j.slice(0,c):j}}():"0".split(void 0,0).length&&(i.split=function(a,b){return void 0===a&&0===b?[]:cb.call(this,a,b)});var db=i.replace,eb=function(){var a=[];return"x".replace(/x(.)?/g,function(b,c){a.push(c)}),1===a.length&&"undefined"==typeof a[0]}();eb||(i.replace=function(a,b){var c=p(b),d=q(a)&&/\)[*?]/.test(a.source);if(c&&d){var e=function(c){var d=arguments.length,e=a.lastIndex;a.lastIndex=0;var f=a.exec(c);return a.lastIndex=e,f.push(arguments[d-2],arguments[d-1]),b.apply(this,f)};return db.call(this,a,e)}return db.call(this,a,b)});var fb=i.substr,gb="".substr&&"b"!=="0b".substr(-1);v(i,{substr:function(a,b){return fb.call(this,0>a&&(a=this.length+a)<0?0:a,b)}},gb);var hb=" \n \f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff",ib="\u200b",jb="["+hb+"]",kb=new RegExp("^"+jb+jb+"*"),lb=new RegExp(jb+jb+"*$"),mb=i.trim&&(hb.trim()||!ib.trim());v(i,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(kb,"").replace(lb,"")}},mb),(8!==parseInt(hb+"08")||22!==parseInt(hb+"0x16"))&&(parseInt=function(a){var b=/^0[xX]/;return function(c,d){return c=String(c).trim(),Number(d)||(d=b.test(c)?16:10),a(c,d)}}(parseInt))}(),function(a,b){var c="defineProperty",d=!!(Object.create&&Object.defineProperties&&Object.getOwnPropertyDescriptor);d&&Object[c]&&Object.prototype.__defineGetter__&&!function(){try{var a=document.createElement("foo");Object[c](a,"bar",{get:function(){return!0}}),d=!!a.bar}catch(b){d=!1}a=null}();var e=webshims.support;if(e.objectAccessor=!!(d||Object.prototype.__defineGetter__&&Object.prototype.__lookupSetter__),e.advancedObjectProperties=d,!(d&&Object.create&&Object.defineProperties&&Object.getOwnPropertyDescriptor&&Object.defineProperty)){var f=Function.prototype.call,g=Object.prototype,h=f.bind(g.hasOwnProperty);b.objectCreate=function(c,d,f,g){var h,i=function(){};return i.prototype=c,h=new i,g||"__proto__"in h||e.objectAccessor||(h.__proto__=c),d&&b.defineProperties(h,d),f&&(h.options=a.extend(!0,{},h.options||{},f),f=h.options),h._create&&a.isFunction(h._create)&&h._create(f),h},b.defineProperties=function(a,c){for(var d in c)h(c,d)&&b.defineProperty(a,d,c[d]);return a};b.defineProperty=function(a,b,c){if("object"!=typeof c||null===c)return a;if(Object.defineProperty)try{return Object.defineProperty(a,b,c)}catch(d){}return h(c,"value")?(a[b]=c.value,a):(a.__defineGetter__&&("function"==typeof c.get&&a.__defineGetter__(b,c.get),"function"==typeof c.set&&a.__defineSetter__(b,c.set)),a)},b.getPrototypeOf=function(a){return Object.getPrototypeOf&&Object.getPrototypeOf(a)||a.__proto__||a.constructor&&a.constructor.prototype},b.getOwnPropertyDescriptor=function(a,b){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object");var c;if(Object.defineProperty&&Object.getOwnPropertyDescriptor)try{return c=Object.getOwnPropertyDescriptor(a,b)}catch(d){}c={configurable:!0,enumerable:!0,writable:!0,value:void 0};var e=a.__lookupGetter__&&a.__lookupGetter__(b),f=a.__lookupSetter__&&a.__lookupSetter__(b);if(!e&&!f){if(!h(a,b))return;return c.value=a[b],c}return delete c.writable,delete c.value,c.get=c.set=void 0,e&&(c.get=e),f&&(c.set=f),c}}webshims.isReady("es5",!0)}(webshims.$,webshims);
wackyapples/cdnjs
ajax/libs/webshim/1.15.6-RC1/minified/shims/es5.js
JavaScript
mit
15,280
(function() { "use strict"; // declare global: JSHINT var bogus = [ "Dangerous comment" ]; var warnings = [ [ "Expected '{'", "Statement body should be inside '{ }' braces." ] ]; var errors = [ "Missing semicolon", "Extra comma", "Missing property name", "Unmatched ", " and instead saw", " is not defined", "Unclosed string", "Stopping, unable to continue" ]; function validator(text, options) { JSHINT(text, options); var errors = JSHINT.data().errors, result = []; if (errors) parseErrors(errors, result); return result; } CodeMirror.registerHelper("lint", "javascript", validator); CodeMirror.javascriptValidator = CodeMirror.lint.javascript; // deprecated function cleanup(error) { // All problems are warnings by default fixWith(error, warnings, "warning", true); fixWith(error, errors, "error"); return isBogus(error) ? null : error; } function fixWith(error, fixes, severity, force) { var description, fix, find, replace, found; description = error.description; for ( var i = 0; i < fixes.length; i++) { fix = fixes[i]; find = (typeof fix === "string" ? fix : fix[0]); replace = (typeof fix === "string" ? null : fix[1]); found = description.indexOf(find) !== -1; if (force || found) { error.severity = severity; } if (found && replace) { error.description = replace; } } } function isBogus(error) { var description = error.description; for ( var i = 0; i < bogus.length; i++) { if (description.indexOf(bogus[i]) !== -1) { return true; } } return false; } function parseErrors(errors, output) { for ( var i = 0; i < errors.length; i++) { var error = errors[i]; if (error) { var linetabpositions, index; linetabpositions = []; // This next block is to fix a problem in jshint. Jshint // replaces // all tabs with spaces then performs some checks. The error // positions (character/space) are then reported incorrectly, // not taking the replacement step into account. Here we look // at the evidence line and try to adjust the character position // to the correct value. if (error.evidence) { // Tab positions are computed once per line and cached var tabpositions = linetabpositions[error.line]; if (!tabpositions) { var evidence = error.evidence; tabpositions = []; // ugggh phantomjs does not like this // forEachChar(evidence, function(item, index) { Array.prototype.forEach.call(evidence, function(item, index) { if (item === '\t') { // First col is 1 (not 0) to match error // positions tabpositions.push(index + 1); } }); linetabpositions[error.line] = tabpositions; } if (tabpositions.length > 0) { var pos = error.character; tabpositions.forEach(function(tabposition) { if (pos > tabposition) pos -= 1; }); error.character = pos; } } var start = error.character - 1, end = start + 1; if (error.evidence) { index = error.evidence.substring(start).search(/.\b/); if (index > -1) { end += index; } } // Convert to format expected by validation service error.description = error.reason;// + "(jshint)"; error.start = error.character; error.end = end; error = cleanup(error); if (error) output.push({message: error.description, severity: error.severity, from: CodeMirror.Pos(error.line - 1, start), to: CodeMirror.Pos(error.line - 1, end)}); } } } })();
catalinmiron/cdnjs
ajax/libs/codemirror/3.20.0/addon/lint/javascript-lint.js
JavaScript
mit
4,069
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); /** * Solarized Dark theme for reveal.js. * Author: Achim Staebler */ @font-face { font-family: 'League Gothic'; src: url("../../lib/font/league_gothic-webfont.eot"); src: url("../../lib/font/league_gothic-webfont.eot?#iefix") format("embedded-opentype"), url("../../lib/font/league_gothic-webfont.woff") format("woff"), url("../../lib/font/league_gothic-webfont.ttf") format("truetype"), url("../../lib/font/league_gothic-webfont.svg#LeagueGothicRegular") format("svg"); font-weight: normal; font-style: normal; } /** * Solarized colors by Ethan Schoonover */ html * { color-profile: sRGB; rendering-intent: auto; } /********************************************* * GLOBAL STYLES *********************************************/ body { background: #002b36; background-color: #002b36; } .reveal { font-family: "Lato", sans-serif; font-size: 36px; font-weight: 200; letter-spacing: -0.02em; color: #93a1a1; } ::selection { color: white; background: #d33682; text-shadow: none; } /********************************************* * HEADERS *********************************************/ .reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5, .reveal h6 { margin: 0 0 20px 0; color: #eee8d5; font-family: "League Gothic", Impact, sans-serif; line-height: 0.9em; letter-spacing: 0.02em; text-transform: uppercase; text-shadow: none; } .reveal h1 { text-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2); } /********************************************* * LINKS *********************************************/ .reveal a:not(.image) { color: #268bd2; text-decoration: none; -webkit-transition: color .15s ease; -moz-transition: color .15s ease; -ms-transition: color .15s ease; -o-transition: color .15s ease; transition: color .15s ease; } .reveal a:not(.image):hover { color: #78b9e6; text-shadow: none; border: none; } .reveal .roll span:after { color: #fff; background: #1a6091; } /********************************************* * IMAGES *********************************************/ .reveal section img { margin: 15px 0px; background: rgba(255, 255, 255, 0.12); border: 4px solid #93a1a1; box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); -webkit-transition: all .2s linear; -moz-transition: all .2s linear; -ms-transition: all .2s linear; -o-transition: all .2s linear; transition: all .2s linear; } .reveal a:hover img { background: rgba(255, 255, 255, 0.2); border-color: #268bd2; box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); } /********************************************* * NAVIGATION CONTROLS *********************************************/ .reveal .controls div.navigate-left, .reveal .controls div.navigate-left.enabled { border-right-color: #268bd2; } .reveal .controls div.navigate-right, .reveal .controls div.navigate-right.enabled { border-left-color: #268bd2; } .reveal .controls div.navigate-up, .reveal .controls div.navigate-up.enabled { border-bottom-color: #268bd2; } .reveal .controls div.navigate-down, .reveal .controls div.navigate-down.enabled { border-top-color: #268bd2; } .reveal .controls div.navigate-left.enabled:hover { border-right-color: #78b9e6; } .reveal .controls div.navigate-right.enabled:hover { border-left-color: #78b9e6; } .reveal .controls div.navigate-up.enabled:hover { border-bottom-color: #78b9e6; } .reveal .controls div.navigate-down.enabled:hover { border-top-color: #78b9e6; } /********************************************* * PROGRESS BAR *********************************************/ .reveal .progress { background: rgba(0, 0, 0, 0.2); } .reveal .progress span { background: #268bd2; -webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); -moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); -ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); -o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
pomutemu/category-seminar
css/theme/moon.css
CSS
mit
4,102
/* * # Semantic UI * https://github.com/Semantic-Org/Semantic-UI * http://www.semantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ /******************************* Video *******************************/ .ui.video { background-color: #dddddd; position: relative; max-width: 100%; padding-bottom: 56.25%; height: 0px; overflow: hidden; } /*-------------- Content ---------------*/ /* Placeholder Image */ .ui.video .placeholder { background-color: #333333; } /* Play Icon Overlay */ .ui.video .play { cursor: pointer; position: absolute; top: 0px; left: 0px; z-index: 10; width: 100%; height: 100%; opacity: 0.8; -webkit-transition: opacity 0.3s; transition: opacity 0.3s; } .ui.video .play.icon:before { position: absolute; top: 50%; left: 50%; z-index: 11; background: rgba(0, 0, 0, 0.3); width: 8rem; height: 8rem; line-height: 8rem; border-radius: 500rem; color: #ffffff; font-size: 8rem; text-shadow: none; -webkit-transform: translateX(-50%) translateY(-50%); -ms-transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%); } .ui.video .placeholder { position: absolute; top: 0px; left: 0px; display: block; width: 100%; height: 100%; } /* IFrame Embed */ .ui.video .embed iframe, .ui.video .embed embed, .ui.video .embed object { position: absolute; border: none; width: 100%; height: 100%; top: 0px; left: 0px; margin: 0em; padding: 0em; } /******************************* States *******************************/ /*-------------- Hover ---------------*/ .ui.video .play:hover { opacity: 1; } /*-------------- Active ---------------*/ .ui.video.active .play, .ui.video.active .placeholder { display: none; } .ui.video.active .embed { display: inline; } /******************************* Video Overrides *******************************/ /******************************* Site Overrides *******************************/
taydakov/cdnjs
ajax/libs/semantic-ui/1.3.0/components/video.css
CSS
mit
2,129
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/app-transitions/app-transitions.js']) { __coverage__['build/app-transitions/app-transitions.js'] = {"path":"build/app-transitions/app-transitions.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},"b":{"1":[0,0],"2":[0,0]},"f":{"1":0,"2":0,"3":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":46}}},"2":{"name":"AppTransitions","line":40,"loc":{"start":{"line":40,"column":0},"end":{"line":40,"column":26}}},"3":{"name":"(anonymous_3)","line":222,"loc":{"start":{"line":222,"column":21},"end":{"line":222,"column":44}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":242,"column":44}},"2":{"start":{"line":40,"column":0},"end":{"line":40,"column":28}},"3":{"start":{"line":42,"column":0},"end":{"line":60,"column":2}},"4":{"start":{"line":76,"column":0},"end":{"line":91,"column":2}},"5":{"start":{"line":93,"column":0},"end":{"line":231,"column":2}},"6":{"start":{"line":223,"column":8},"end":{"line":223,"column":46}},"7":{"start":{"line":225,"column":8},"end":{"line":227,"column":9}},"8":{"start":{"line":226,"column":12},"end":{"line":226,"column":43}},"9":{"start":{"line":229,"column":8},"end":{"line":229,"column":27}},"10":{"start":{"line":234,"column":0},"end":{"line":234,"column":35}},"11":{"start":{"line":235,"column":0},"end":{"line":235,"column":36}},"12":{"start":{"line":237,"column":0},"end":{"line":239,"column":3}}},"branchMap":{"1":{"line":225,"type":"if","locations":[{"start":{"line":225,"column":8},"end":{"line":225,"column":8}},{"start":{"line":225,"column":8},"end":{"line":225,"column":8}}]},"2":{"line":225,"type":"binary-expr","locations":[{"start":{"line":225,"column":12},"end":{"line":225,"column":23}},{"start":{"line":225,"column":27},"end":{"line":225,"column":47}}]}},"code":["(function () { YUI.add('app-transitions', function (Y, NAME) {","","/**","`Y.App` extension that provides view transitions in browsers which support","native CSS3 transitions.","","@module app","@submodule app-transitions","@since 3.5.0","**/","","/**","`Y.App` extension that provides view transitions in browsers which support","native CSS3 transitions.","","View transitions provide an nice way to move from one \"page\" to the next that is","both pleasant to the user and helps to communicate a hierarchy between sections","of an application.","","When the `\"app-transitions\"` module is used, it will automatically mix itself","into `Y.App` and transition between `activeView` changes using the following","effects:",""," - **`fade`**: Cross-fades between the old an new active views.",""," - **`slideLeft`**: The old and new active views are positioned next to each"," other and both slide to the left.",""," - **`slideRight`**: The old and new active views are positioned next to each"," other and both slide to the right.","","**Note:** Transitions are an opt-in feature and are enabled via an app's","`transitions` attribute.","","@class App.Transitions","@uses App.TransitionsNative","@extensionfor App","@since 3.5.0","**/","function AppTransitions() {}","","AppTransitions.ATTRS = {"," /**"," Whether or not this application should use view transitions, and if so then"," which ones or `true` for the defaults which are specified by the"," `transitions` prototype property.",""," **Note:** Transitions are an opt-in feature and will only be used in"," browsers which support native CSS3 transitions.",""," @attribute transitions"," @type Boolean|Object"," @default false"," @since 3.5.0"," **/"," transitions: {"," setter: '_setTransitions',"," value : false"," }","};","","/**","Collect of transitions -> fx.","","A transition (e.g. \"fade\") is a simple name given to a configuration of fx to","apply, consisting of `viewIn` and `viewOut` properties who's values are names of","fx registered on `Y.Transition.fx`.","","By default transitions: `fade`, `slideLeft`, and `slideRight` have fx defined.","","@property FX","@type Object","@static","@since 3.5.0","**/","AppTransitions.FX = {"," fade: {"," viewIn : 'app:fadeIn',"," viewOut: 'app:fadeOut'"," },",""," slideLeft: {"," viewIn : 'app:slideLeft',"," viewOut: 'app:slideLeft'"," },",""," slideRight: {"," viewIn : 'app:slideRight',"," viewOut: 'app:slideRight'"," }","};","","AppTransitions.prototype = {"," // -- Public Properties ----------------------------------------------------",""," /**"," Default transitions to use when the `activeView` changes.",""," The following are types of changes for which transitions can be defined that"," correspond to the relationship between the new and previous `activeView`:",""," * `navigate`: The default transition to use when changing the `activeView`"," of the application.",""," * `toChild`: The transition to use when the new `activeView` is configured"," as a child of the previously active view via its `parent` property as"," defined in this app's `views`.",""," * `toParent`: The transition to use when the new `activeView` is"," configured as the `parent` of the previously active view as defined in"," this app's `views`.",""," **Note:** Transitions are an opt-in feature and will only be used in"," browsers which support native CSS3 transitions.",""," @property transitions"," @type Object"," @default"," {"," navigate: 'fade',"," toChild : 'slideLeft',"," toParent: 'slideRight'"," }"," @since 3.5.0"," **/"," transitions: {"," navigate: 'fade',"," toChild : 'slideLeft',"," toParent: 'slideRight'"," },",""," // -- Public Methods -------------------------------------------------------",""," /**"," Sets which view is active/visible for the application. This will set the"," app's `activeView` attribute to the specified `view`.",""," The `view` will be \"attached\" to this app, meaning it will be both rendered"," into this app's `viewContainer` node and all of its events will bubble to"," the app. The previous `activeView` will be \"detached\" from this app.",""," When a string-name is provided for a view which has been registered on this"," app's `views` object, the referenced metadata will be used and the"," `activeView` will be set to either a preserved view instance, or a new"," instance of the registered view will be created using the specified `config`"," object passed-into this method.",""," A callback function can be specified as either the third or fourth argument,"," and this function will be called after the new `view` becomes the"," `activeView`, is rendered to the `viewContainer`, and is ready to use.",""," @example"," var app = new Y.App({"," views: {"," usersView: {"," // Imagine that `Y.UsersView` has been defined."," type: Y.UsersView"," }"," },",""," transitions: true,"," users : new Y.ModelList()"," });",""," app.route('/users/', function () {"," this.showView('usersView', {users: this.get('users')});"," });",""," app.render();"," app.navigate('/uses/');"," // => Creates a new `Y.UsersView` and transitions to it.",""," @method showView"," @param {String|View} view The name of a view defined in the `views` object,"," or a view instance which should become this app's `activeView`."," @param {Object} [config] Optional configuration to use when creating a new"," view instance. This config object can also be used to update an existing"," or preserved view's attributes when `options.update` is `true`."," @param {Object} [options] Optional object containing any of the following"," properties:"," @param {Function} [options.callback] Optional callback function to call"," after new `activeView` is ready to use, the function will be passed:"," @param {View} options.callback.view A reference to the new"," `activeView`."," @param {Boolean} [options.prepend=false] Whether the `view` should be"," prepended instead of appended to the `viewContainer`."," @param {Boolean} [options.render] Whether the `view` should be rendered."," **Note:** If no value is specified, a view instance will only be"," rendered if it's newly created by this method."," @param {Boolean|String} [options.transition] Optional transition override."," A transition can be specified which will override the default, or"," `false` for no transition."," @param {Boolean} [options.update=false] Whether an existing view should"," have its attributes updated by passing the `config` object to its"," `setAttrs()` method. **Note:** This option does not have an effect if"," the `view` instance is created as a result of calling this method."," @param {Function} [callback] Optional callback Function to call after the"," new `activeView` is ready to use. **Note:** this will override"," `options.callback` and it can be specified as either the third or fourth"," argument. The function will be passed the following:"," @param {View} callback.view A reference to the new `activeView`."," @chainable"," @since 3.5.0"," **/"," // Does not override `showView()` but does use `options.transitions`.",""," // -- Protected Methods ----------------------------------------------------",""," /**"," Setter for `transitions` attribute.",""," When specified as `true`, the defaults will be use as specified by the"," `transitions` prototype property.",""," @method _setTransitions"," @param {Boolean|Object} transitions The new `transitions` attribute value."," @return {Mixed} The processed value which represents the new state."," @protected"," @see App.Base.showView()"," @since 3.5.0"," **/"," _setTransitions: function (transitions) {"," var defTransitions = this.transitions;",""," if (transitions && transitions === true) {"," return Y.merge(defTransitions);"," }",""," return transitions;"," }","};","","// -- Namespace ----------------------------------------------------------------","Y.App.Transitions = AppTransitions;","Y.Base.mix(Y.App, [AppTransitions]);","","Y.mix(Y.App.CLASS_NAMES, {"," transitioning: Y.ClassNameManager.getClassName('app', 'transitioning')","});","","","}, '@VERSION@', {\"requires\": [\"app-base\"]});","","}());"]}; } var __cov_2_u5xavh62mdqarWSEoI8Q = __coverage__['build/app-transitions/app-transitions.js']; __cov_2_u5xavh62mdqarWSEoI8Q.s['1']++;YUI.add('app-transitions',function(Y,NAME){__cov_2_u5xavh62mdqarWSEoI8Q.f['1']++;__cov_2_u5xavh62mdqarWSEoI8Q.s['2']++;function AppTransitions(){__cov_2_u5xavh62mdqarWSEoI8Q.f['2']++;}__cov_2_u5xavh62mdqarWSEoI8Q.s['3']++;AppTransitions.ATTRS={transitions:{setter:'_setTransitions',value:false}};__cov_2_u5xavh62mdqarWSEoI8Q.s['4']++;AppTransitions.FX={fade:{viewIn:'app:fadeIn',viewOut:'app:fadeOut'},slideLeft:{viewIn:'app:slideLeft',viewOut:'app:slideLeft'},slideRight:{viewIn:'app:slideRight',viewOut:'app:slideRight'}};__cov_2_u5xavh62mdqarWSEoI8Q.s['5']++;AppTransitions.prototype={transitions:{navigate:'fade',toChild:'slideLeft',toParent:'slideRight'},_setTransitions:function(transitions){__cov_2_u5xavh62mdqarWSEoI8Q.f['3']++;__cov_2_u5xavh62mdqarWSEoI8Q.s['6']++;var defTransitions=this.transitions;__cov_2_u5xavh62mdqarWSEoI8Q.s['7']++;if((__cov_2_u5xavh62mdqarWSEoI8Q.b['2'][0]++,transitions)&&(__cov_2_u5xavh62mdqarWSEoI8Q.b['2'][1]++,transitions===true)){__cov_2_u5xavh62mdqarWSEoI8Q.b['1'][0]++;__cov_2_u5xavh62mdqarWSEoI8Q.s['8']++;return Y.merge(defTransitions);}else{__cov_2_u5xavh62mdqarWSEoI8Q.b['1'][1]++;}__cov_2_u5xavh62mdqarWSEoI8Q.s['9']++;return transitions;}};__cov_2_u5xavh62mdqarWSEoI8Q.s['10']++;Y.App.Transitions=AppTransitions;__cov_2_u5xavh62mdqarWSEoI8Q.s['11']++;Y.Base.mix(Y.App,[AppTransitions]);__cov_2_u5xavh62mdqarWSEoI8Q.s['12']++;Y.mix(Y.App.CLASS_NAMES,{transitioning:Y.ClassNameManager.getClassName('app','transitioning')});},'@VERSION@',{'requires':['app-base']});
tharakauka/cdnjs
ajax/libs/yui/3.12.0/app-transitions/app-transitions-coverage.js
JavaScript
mit
12,430
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/transition-timer/transition-timer.js']) { __coverage__['build/transition-timer/transition-timer.js'] = {"path":"build/transition-timer/transition-timer.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},"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,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]},"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},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":47}}},"2":{"name":"(anonymous_2)","line":14,"loc":{"start":{"line":14,"column":12},"end":{"line":14,"column":23}}},"3":{"name":"(anonymous_3)","line":22,"loc":{"start":{"line":22,"column":15},"end":{"line":22,"column":26}}},"4":{"name":"(anonymous_4)","line":31,"loc":{"start":{"line":31,"column":15},"end":{"line":31,"column":26}}},"5":{"name":"(anonymous_5)","line":37,"loc":{"start":{"line":37,"column":15},"end":{"line":37,"column":26}}},"6":{"name":"(anonymous_6)","line":42,"loc":{"start":{"line":42,"column":15},"end":{"line":42,"column":30}}},"7":{"name":"(anonymous_7)","line":109,"loc":{"start":{"line":109,"column":16},"end":{"line":109,"column":27}}},"8":{"name":"(anonymous_8)","line":169,"loc":{"start":{"line":169,"column":13},"end":{"line":169,"column":24}}},"9":{"name":"(anonymous_9)","line":210,"loc":{"start":{"line":210,"column":17},"end":{"line":210,"column":38}}},"10":{"name":"(anonymous_10)","line":222,"loc":{"start":{"line":222,"column":20},"end":{"line":222,"column":79}}},"11":{"name":"(anonymous_11)","line":247,"loc":{"start":{"line":247,"column":20},"end":{"line":247,"column":40}}},"12":{"name":"(anonymous_12)","line":258,"loc":{"start":{"line":258,"column":17},"end":{"line":258,"column":28}}},"13":{"name":"(anonymous_13)","line":264,"loc":{"start":{"line":264,"column":16},"end":{"line":264,"column":27}}},"14":{"name":"(anonymous_14)","line":275,"loc":{"start":{"line":275,"column":15},"end":{"line":275,"column":26}}},"15":{"name":"(anonymous_15)","line":290,"loc":{"start":{"line":290,"column":17},"end":{"line":290,"column":32}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":334,"column":46}},"2":{"start":{"line":11,"column":0},"end":{"line":11,"column":30}},"3":{"start":{"line":13,"column":0},"end":{"line":173,"column":9}},"4":{"start":{"line":15,"column":8},"end":{"line":19,"column":9}},"5":{"start":{"line":16,"column":12},"end":{"line":16,"column":30}},"6":{"start":{"line":18,"column":12},"end":{"line":18,"column":29}},"7":{"start":{"line":23,"column":8},"end":{"line":23,"column":24}},"8":{"start":{"line":24,"column":8},"end":{"line":24,"column":26}},"9":{"start":{"line":26,"column":8},"end":{"line":26,"column":50}},"10":{"start":{"line":27,"column":8},"end":{"line":27,"column":37}},"11":{"start":{"line":28,"column":8},"end":{"line":28,"column":33}},"12":{"start":{"line":32,"column":8},"end":{"line":32,"column":24}},"13":{"start":{"line":33,"column":8},"end":{"line":33,"column":50}},"14":{"start":{"line":34,"column":8},"end":{"line":34,"column":31}},"15":{"start":{"line":38,"column":8},"end":{"line":38,"column":45}},"16":{"start":{"line":39,"column":8},"end":{"line":39,"column":26}},"17":{"start":{"line":43,"column":8},"end":{"line":59,"column":14}},"18":{"start":{"line":61,"column":8},"end":{"line":106,"column":9}},"19":{"start":{"line":62,"column":12},"end":{"line":105,"column":13}},"20":{"start":{"line":63,"column":16},"end":{"line":63,"column":39}},"21":{"start":{"line":64,"column":16},"end":{"line":64,"column":40}},"22":{"start":{"line":65,"column":16},"end":{"line":65,"column":48}},"23":{"start":{"line":66,"column":16},"end":{"line":66,"column":25}},"24":{"start":{"line":67,"column":16},"end":{"line":72,"column":18}},"25":{"start":{"line":74,"column":16},"end":{"line":75,"column":70}},"26":{"start":{"line":77,"column":16},"end":{"line":77,"column":32}},"27":{"start":{"line":79,"column":16},"end":{"line":81,"column":17}},"28":{"start":{"line":80,"column":20},"end":{"line":80,"column":26}},"29":{"start":{"line":83,"column":16},"end":{"line":103,"column":17}},"30":{"start":{"line":84,"column":20},"end":{"line":85,"column":58}},"31":{"start":{"line":87,"column":20},"end":{"line":102,"column":21}},"32":{"start":{"line":88,"column":24},"end":{"line":88,"column":43}},"33":{"start":{"line":89,"column":24},"end":{"line":89,"column":38}},"34":{"start":{"line":91,"column":24},"end":{"line":93,"column":25}},"35":{"start":{"line":92,"column":28},"end":{"line":92,"column":72}},"36":{"start":{"line":97,"column":24},"end":{"line":101,"column":25}},"37":{"start":{"line":98,"column":28},"end":{"line":98,"column":43}},"38":{"start":{"line":99,"column":28},"end":{"line":99,"column":47}},"39":{"start":{"line":100,"column":28},"end":{"line":100,"column":45}},"40":{"start":{"line":110,"column":8},"end":{"line":122,"column":29}},"41":{"start":{"line":124,"column":8},"end":{"line":166,"column":9}},"42":{"start":{"line":125,"column":12},"end":{"line":165,"column":13}},"43":{"start":{"line":126,"column":16},"end":{"line":126,"column":53}},"44":{"start":{"line":127,"column":16},"end":{"line":127,"column":47}},"45":{"start":{"line":128,"column":16},"end":{"line":128,"column":42}},"46":{"start":{"line":129,"column":16},"end":{"line":129,"column":38}},"47":{"start":{"line":132,"column":16},"end":{"line":164,"column":17}},"48":{"start":{"line":133,"column":20},"end":{"line":134,"column":101}},"49":{"start":{"line":136,"column":20},"end":{"line":136,"column":60}},"50":{"start":{"line":137,"column":20},"end":{"line":137,"column":56}},"51":{"start":{"line":139,"column":20},"end":{"line":139,"column":53}},"52":{"start":{"line":140,"column":20},"end":{"line":140,"column":45}},"53":{"start":{"line":141,"column":20},"end":{"line":141,"column":65}},"54":{"start":{"line":143,"column":20},"end":{"line":145,"column":21}},"55":{"start":{"line":144,"column":24},"end":{"line":144,"column":55}},"56":{"start":{"line":147,"column":20},"end":{"line":153,"column":21}},"57":{"start":{"line":148,"column":24},"end":{"line":152,"column":25}},"58":{"start":{"line":149,"column":28},"end":{"line":149,"column":88}},"59":{"start":{"line":150,"column":31},"end":{"line":152,"column":25}},"60":{"start":{"line":151,"column":28},"end":{"line":151,"column":64}},"61":{"start":{"line":155,"column":20},"end":{"line":155,"column":51}},"62":{"start":{"line":156,"column":20},"end":{"line":156,"column":47}},"63":{"start":{"line":157,"column":20},"end":{"line":157,"column":42}},"64":{"start":{"line":158,"column":20},"end":{"line":158,"column":46}},"65":{"start":{"line":159,"column":20},"end":{"line":159,"column":58}},"66":{"start":{"line":160,"column":20},"end":{"line":160,"column":44}},"67":{"start":{"line":162,"column":20},"end":{"line":162,"column":39}},"68":{"start":{"line":163,"column":20},"end":{"line":163,"column":34}},"69":{"start":{"line":170,"column":8},"end":{"line":170,"column":25}},"70":{"start":{"line":171,"column":8},"end":{"line":171,"column":26}},"71":{"start":{"line":175,"column":0},"end":{"line":327,"column":9}},"72":{"start":{"line":211,"column":16},"end":{"line":211,"column":62}},"73":{"start":{"line":223,"column":8},"end":{"line":223,"column":28}},"74":{"start":{"line":224,"column":8},"end":{"line":224,"column":24}},"75":{"start":{"line":226,"column":8},"end":{"line":227,"column":65}},"76":{"start":{"line":229,"column":8},"end":{"line":229,"column":42}},"77":{"start":{"line":231,"column":8},"end":{"line":238,"column":9}},"78":{"start":{"line":232,"column":12},"end":{"line":235,"column":13}},"79":{"start":{"line":233,"column":16},"end":{"line":233,"column":34}},"80":{"start":{"line":234,"column":16},"end":{"line":234,"column":54}},"81":{"start":{"line":237,"column":12},"end":{"line":237,"column":24}},"82":{"start":{"line":248,"column":8},"end":{"line":249,"column":21}},"83":{"start":{"line":251,"column":8},"end":{"line":253,"column":9}},"84":{"start":{"line":252,"column":12},"end":{"line":252,"column":52}},"85":{"start":{"line":255,"column":8},"end":{"line":255,"column":19}},"86":{"start":{"line":259,"column":8},"end":{"line":261,"column":9}},"87":{"start":{"line":260,"column":12},"end":{"line":260,"column":91}},"88":{"start":{"line":265,"column":8},"end":{"line":265,"column":41}},"89":{"start":{"line":266,"column":8},"end":{"line":266,"column":33}},"90":{"start":{"line":276,"column":8},"end":{"line":277,"column":17}},"91":{"start":{"line":278,"column":8},"end":{"line":283,"column":9}},"92":{"start":{"line":279,"column":12},"end":{"line":282,"column":13}},"93":{"start":{"line":280,"column":16},"end":{"line":280,"column":29}},"94":{"start":{"line":281,"column":16},"end":{"line":281,"column":54}},"95":{"start":{"line":285,"column":8},"end":{"line":287,"column":9}},"96":{"start":{"line":286,"column":12},"end":{"line":286,"column":36}},"97":{"start":{"line":291,"column":8},"end":{"line":310,"column":42}},"98":{"start":{"line":312,"column":8},"end":{"line":312,"column":22}},"99":{"start":{"line":329,"column":0},"end":{"line":329,"column":112}},"100":{"start":{"line":331,"column":0},"end":{"line":331,"column":26}}},"branchMap":{"1":{"line":15,"type":"if","locations":[{"start":{"line":15,"column":8},"end":{"line":15,"column":8}},{"start":{"line":15,"column":8},"end":{"line":15,"column":8}}]},"2":{"line":62,"type":"if","locations":[{"start":{"line":62,"column":12},"end":{"line":62,"column":12}},{"start":{"line":62,"column":12},"end":{"line":62,"column":12}}]},"3":{"line":62,"type":"binary-expr","locations":[{"start":{"line":62,"column":17},"end":{"line":62,"column":40}},{"start":{"line":62,"column":45},"end":{"line":62,"column":74}}]},"4":{"line":74,"type":"cond-expr","locations":[{"start":{"line":75,"column":24},"end":{"line":75,"column":41}},{"start":{"line":75,"column":44},"end":{"line":75,"column":69}}]},"5":{"line":74,"type":"binary-expr","locations":[{"start":{"line":74,"column":26},"end":{"line":74,"column":41}},{"start":{"line":74,"column":45},"end":{"line":74,"column":67}}]},"6":{"line":79,"type":"if","locations":[{"start":{"line":79,"column":16},"end":{"line":79,"column":16}},{"start":{"line":79,"column":16},"end":{"line":79,"column":16}}]},"7":{"line":83,"type":"if","locations":[{"start":{"line":83,"column":16},"end":{"line":83,"column":16}},{"start":{"line":83,"column":16},"end":{"line":83,"column":16}}]},"8":{"line":83,"type":"binary-expr","locations":[{"start":{"line":83,"column":20},"end":{"line":83,"column":26}},{"start":{"line":83,"column":30},"end":{"line":83,"column":43}}]},"9":{"line":87,"type":"if","locations":[{"start":{"line":87,"column":20},"end":{"line":87,"column":20}},{"start":{"line":87,"column":20},"end":{"line":87,"column":20}}]},"10":{"line":91,"type":"if","locations":[{"start":{"line":91,"column":24},"end":{"line":91,"column":24}},{"start":{"line":91,"column":24},"end":{"line":91,"column":24}}]},"11":{"line":91,"type":"binary-expr","locations":[{"start":{"line":91,"column":28},"end":{"line":91,"column":40}},{"start":{"line":91,"column":44},"end":{"line":91,"column":59}},{"start":{"line":91,"column":63},"end":{"line":91,"column":82}}]},"12":{"line":97,"type":"if","locations":[{"start":{"line":97,"column":24},"end":{"line":97,"column":24}},{"start":{"line":97,"column":24},"end":{"line":97,"column":24}}]},"13":{"line":97,"type":"binary-expr","locations":[{"start":{"line":97,"column":28},"end":{"line":97,"column":36}},{"start":{"line":97,"column":40},"end":{"line":97,"column":56}}]},"14":{"line":125,"type":"if","locations":[{"start":{"line":125,"column":12},"end":{"line":125,"column":12}},{"start":{"line":125,"column":12},"end":{"line":125,"column":12}}]},"15":{"line":125,"type":"binary-expr","locations":[{"start":{"line":125,"column":17},"end":{"line":125,"column":40}},{"start":{"line":125,"column":45},"end":{"line":125,"column":74}}]},"16":{"line":132,"type":"if","locations":[{"start":{"line":132,"column":16},"end":{"line":132,"column":16}},{"start":{"line":132,"column":16},"end":{"line":132,"column":16}}]},"17":{"line":132,"type":"binary-expr","locations":[{"start":{"line":132,"column":20},"end":{"line":132,"column":44}},{"start":{"line":132,"column":48},"end":{"line":132,"column":75}}]},"18":{"line":133,"type":"cond-expr","locations":[{"start":{"line":134,"column":28},"end":{"line":134,"column":60}},{"start":{"line":134,"column":63},"end":{"line":134,"column":100}}]},"19":{"line":133,"type":"binary-expr","locations":[{"start":{"line":133,"column":29},"end":{"line":133,"column":47}},{"start":{"line":133,"column":51},"end":{"line":133,"column":76}}]},"20":{"line":139,"type":"cond-expr","locations":[{"start":{"line":139,"column":36},"end":{"line":139,"column":44}},{"start":{"line":139,"column":47},"end":{"line":139,"column":52}}]},"21":{"line":140,"type":"cond-expr","locations":[{"start":{"line":140,"column":32},"end":{"line":140,"column":38}},{"start":{"line":140,"column":41},"end":{"line":140,"column":44}}]},"22":{"line":141,"type":"cond-expr","locations":[{"start":{"line":141,"column":33},"end":{"line":141,"column":39}},{"start":{"line":141,"column":42},"end":{"line":141,"column":64}}]},"23":{"line":141,"type":"cond-expr","locations":[{"start":{"line":141,"column":51},"end":{"line":141,"column":59}},{"start":{"line":141,"column":62},"end":{"line":141,"column":64}}]},"24":{"line":143,"type":"if","locations":[{"start":{"line":143,"column":20},"end":{"line":143,"column":20}},{"start":{"line":143,"column":20},"end":{"line":143,"column":20}}]},"25":{"line":143,"type":"binary-expr","locations":[{"start":{"line":143,"column":24},"end":{"line":143,"column":29}},{"start":{"line":143,"column":33},"end":{"line":143,"column":70}}]},"26":{"line":147,"type":"if","locations":[{"start":{"line":147,"column":20},"end":{"line":147,"column":20}},{"start":{"line":147,"column":20},"end":{"line":147,"column":20}}]},"27":{"line":148,"type":"if","locations":[{"start":{"line":148,"column":24},"end":{"line":148,"column":24}},{"start":{"line":148,"column":24},"end":{"line":148,"column":24}}]},"28":{"line":150,"type":"if","locations":[{"start":{"line":150,"column":31},"end":{"line":150,"column":31}},{"start":{"line":150,"column":31},"end":{"line":150,"column":31}}]},"29":{"line":231,"type":"if","locations":[{"start":{"line":231,"column":8},"end":{"line":231,"column":8}},{"start":{"line":231,"column":8},"end":{"line":231,"column":8}}]},"30":{"line":232,"type":"if","locations":[{"start":{"line":232,"column":12},"end":{"line":232,"column":12}},{"start":{"line":232,"column":12},"end":{"line":232,"column":12}}]},"31":{"line":232,"type":"binary-expr","locations":[{"start":{"line":232,"column":16},"end":{"line":232,"column":33}},{"start":{"line":232,"column":37},"end":{"line":232,"column":63}}]},"32":{"line":233,"type":"binary-expr","locations":[{"start":{"line":233,"column":23},"end":{"line":233,"column":27}},{"start":{"line":233,"column":31},"end":{"line":233,"column":33}}]},"33":{"line":251,"type":"if","locations":[{"start":{"line":251,"column":8},"end":{"line":251,"column":8}},{"start":{"line":251,"column":8},"end":{"line":251,"column":8}}]},"34":{"line":251,"type":"binary-expr","locations":[{"start":{"line":251,"column":12},"end":{"line":251,"column":29}},{"start":{"line":251,"column":33},"end":{"line":251,"column":59}}]},"35":{"line":259,"type":"if","locations":[{"start":{"line":259,"column":8},"end":{"line":259,"column":8}},{"start":{"line":259,"column":8},"end":{"line":259,"column":8}}]},"36":{"line":279,"type":"if","locations":[{"start":{"line":279,"column":12},"end":{"line":279,"column":12}},{"start":{"line":279,"column":12},"end":{"line":279,"column":12}}]},"37":{"line":285,"type":"if","locations":[{"start":{"line":285,"column":8},"end":{"line":285,"column":8}},{"start":{"line":285,"column":8},"end":{"line":285,"column":8}}]}},"code":["(function () { YUI.add('transition-timer', function (Y, NAME) {","","/**","* Provides the base Transition class, for animating numeric properties.","*","* @module transition","* @submodule transition-timer","*/","","","var Transition = Y.Transition;","","Y.mix(Transition.prototype, {"," _start: function() {"," if (Transition.useNative) {"," this._runNative();"," } else {"," this._runTimer();"," }"," },",""," _runTimer: function() {"," var anim = this;"," anim._initAttrs();",""," Transition._running[Y.stamp(anim)] = anim;"," anim._startTime = new Date();"," Transition._startTimer();"," },",""," _endTimer: function() {"," var anim = this;"," delete Transition._running[Y.stamp(anim)];"," anim._startTime = null;"," },",""," _runFrame: function() {"," var t = new Date() - this._startTime;"," this._runAttrs(t);"," },",""," _runAttrs: function(time) {"," var anim = this,"," node = anim._node,"," config = anim._config,"," uid = Y.stamp(node),"," attrs = Transition._nodeAttrs[uid],"," customAttr = Transition.behaviors,"," done = false,"," allDone = false,"," data,"," name,"," attribute,"," setter,"," elapsed,"," delay,"," d,"," t,"," i;",""," for (name in attrs) {"," if ((attribute = attrs[name]) && attribute.transition === anim) {"," d = attribute.duration;"," delay = attribute.delay;"," elapsed = (time - delay) / 1000;"," t = time;"," data = {"," type: 'propertyEnd',"," propertyName: name,"," config: config,"," elapsedTime: elapsed"," };",""," setter = (i in customAttr && 'set' in customAttr[i]) ?"," customAttr[i].set : Transition.DEFAULT_SETTER;",""," done = (t >= d);",""," if (t > d) {"," t = d;"," }",""," if (!delay || time >= delay) {"," setter(anim, name, attribute.from, attribute.to, t - delay, d - delay,"," attribute.easing, attribute.unit);",""," if (done) {"," delete attrs[name];"," anim._count--;",""," if (config[name] && config[name].on && config[name].on.end) {"," config[name].on.end.call(Y.one(node), data);"," }",""," //node.fire('transition:propertyEnd', data);",""," if (!allDone && anim._count <= 0) {"," allDone = true;"," anim._end(elapsed);"," anim._endTimer();"," }"," }"," }",""," }"," }"," },",""," _initAttrs: function() {"," var anim = this,"," customAttr = Transition.behaviors,"," uid = Y.stamp(anim._node),"," attrs = Transition._nodeAttrs[uid],"," attribute,"," duration,"," delay,"," easing,"," val,"," name,"," mTo,"," mFrom,"," unit, begin, end;",""," for (name in attrs) {"," if ((attribute = attrs[name]) && attribute.transition === anim) {"," duration = attribute.duration * 1000;"," delay = attribute.delay * 1000;"," easing = attribute.easing;"," val = attribute.value;",""," // only allow supported properties"," if (name in anim._node.style || name in Y.DOM.CUSTOM_STYLES) {"," begin = (name in customAttr && 'get' in customAttr[name]) ?"," customAttr[name].get(anim, name) : Transition.DEFAULT_GETTER(anim, name);",""," mFrom = Transition.RE_UNITS.exec(begin);"," mTo = Transition.RE_UNITS.exec(val);",""," begin = mFrom ? mFrom[1] : begin;"," end = mTo ? mTo[1] : val;"," unit = mTo ? mTo[2] : mFrom ? mFrom[2] : ''; // one might be zero TODO: mixed units",""," if (!unit && Transition.RE_DEFAULT_UNIT.test(name)) {"," unit = Transition.DEFAULT_UNIT;"," }",""," if (typeof easing === 'string') {"," if (easing.indexOf('cubic-bezier') > -1) {"," easing = easing.substring(13, easing.length - 1).split(',');"," } else if (Transition.easings[easing]) {"," easing = Transition.easings[easing];"," }"," }",""," attribute.from = Number(begin);"," attribute.to = Number(end);"," attribute.unit = unit;"," attribute.easing = easing;"," attribute.duration = duration + delay;"," attribute.delay = delay;"," } else {"," delete attrs[name];"," anim._count--;"," }"," }"," }"," },",""," destroy: function() {"," this.detachAll();"," this._node = null;"," }","}, true);","","Y.mix(Y.Transition, {"," _runtimeAttrs: {},"," /*"," * Regex of properties that should use the default unit."," *"," * @property RE_DEFAULT_UNIT"," * @static"," */"," RE_DEFAULT_UNIT: /^width|height|top|right|bottom|left|margin.*|padding.*|border.*$/i,",""," /*"," * The default unit to use with properties that pass the RE_DEFAULT_UNIT test."," *"," * @property DEFAULT_UNIT"," * @static"," */"," DEFAULT_UNIT: 'px',",""," /*"," * Time in milliseconds passed to setInterval for frame processing"," *"," * @property intervalTime"," * @default 20"," * @static"," */"," intervalTime: 20,",""," /*"," * Bucket for custom getters and setters"," *"," * @property behaviors"," * @static"," */"," behaviors: {"," left: {"," get: function(anim, attr) {"," return Y.DOM._getAttrOffset(anim._node, attr);"," }"," }"," },",""," /*"," * The default setter to use when setting object properties."," *"," * @property DEFAULT_SETTER"," * @static"," */"," DEFAULT_SETTER: function(anim, att, from, to, elapsed, duration, fn, unit) {"," from = Number(from);"," to = Number(to);",""," var node = anim._node,"," val = Transition.cubicBezier(fn, elapsed / duration);",""," val = from + val[0] * (to - from);",""," if (node) {"," if (att in node.style || att in Y.DOM.CUSTOM_STYLES) {"," unit = unit || '';"," Y.DOM.setStyle(node, att, val + unit);"," }"," } else {"," anim._end();"," }"," },",""," /*"," * The default getter to use when getting object properties."," *"," * @property DEFAULT_GETTER"," * @static"," */"," DEFAULT_GETTER: function(anim, att) {"," var node = anim._node,"," val = '';",""," if (att in node.style || att in Y.DOM.CUSTOM_STYLES) {"," val = Y.DOM.getComputedStyle(node, att);"," }",""," return val;"," },",""," _startTimer: function() {"," if (!Transition._timer) {"," Transition._timer = setInterval(Transition._runFrame, Transition.intervalTime);"," }"," },",""," _stopTimer: function() {"," clearInterval(Transition._timer);"," Transition._timer = null;"," },",""," /*"," * Called per Interval to handle each animation frame."," * @method _runFrame"," * @private"," * @static"," */"," _runFrame: function() {"," var done = true,"," anim;"," for (anim in Transition._running) {"," if (Transition._running[anim]._runFrame) {"," done = false;"," Transition._running[anim]._runFrame();"," }"," }",""," if (done) {"," Transition._stopTimer();"," }"," },",""," cubicBezier: function(p, t) {"," var x0 = 0,"," y0 = 0,"," x1 = p[0],"," y1 = p[1],"," x2 = p[2],"," y2 = p[3],"," x3 = 1,"," y3 = 0,",""," A = x3 - 3 * x2 + 3 * x1 - x0,"," B = 3 * x2 - 6 * x1 + 3 * x0,"," C = 3 * x1 - 3 * x0,"," D = x0,"," E = y3 - 3 * y2 + 3 * y1 - y0,"," F = 3 * y2 - 6 * y1 + 3 * y0,"," G = 3 * y1 - 3 * y0,"," H = y0,",""," x = (((A*t) + B)*t + C)*t + D,"," y = (((E*t) + F)*t + G)*t + H;",""," return [x, y];"," },",""," easings: {"," ease: [0.25, 0, 1, 0.25],"," linear: [0, 0, 1, 1],"," 'ease-in': [0.42, 0, 1, 1],"," 'ease-out': [0, 0, 0.58, 1],"," 'ease-in-out': [0.42, 0, 0.58, 1]"," },",""," _running: {},"," _timer: null,",""," RE_UNITS: /^(-?\\d*\\.?\\d*){1}(em|ex|px|in|cm|mm|pt|pc|%)*$/","}, true);","","Transition.behaviors.top = Transition.behaviors.bottom = Transition.behaviors.right = Transition.behaviors.left;","","Y.Transition = Transition;","","","}, '@VERSION@', {\"requires\": [\"transition\"]});","","}());"]}; } var __cov_P9MyqHY8ItAFRxYCk9oI0w = __coverage__['build/transition-timer/transition-timer.js']; __cov_P9MyqHY8ItAFRxYCk9oI0w.s['1']++;YUI.add('transition-timer',function(Y,NAME){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['1']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['2']++;var Transition=Y.Transition;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['3']++;Y.mix(Transition.prototype,{_start:function(){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['2']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['4']++;if(Transition.useNative){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['1'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['5']++;this._runNative();}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['1'][1]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['6']++;this._runTimer();}},_runTimer:function(){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['3']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['7']++;var anim=this;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['8']++;anim._initAttrs();__cov_P9MyqHY8ItAFRxYCk9oI0w.s['9']++;Transition._running[Y.stamp(anim)]=anim;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['10']++;anim._startTime=new Date();__cov_P9MyqHY8ItAFRxYCk9oI0w.s['11']++;Transition._startTimer();},_endTimer:function(){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['4']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['12']++;var anim=this;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['13']++;delete Transition._running[Y.stamp(anim)];__cov_P9MyqHY8ItAFRxYCk9oI0w.s['14']++;anim._startTime=null;},_runFrame:function(){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['5']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['15']++;var t=new Date()-this._startTime;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['16']++;this._runAttrs(t);},_runAttrs:function(time){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['6']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['17']++;var anim=this,node=anim._node,config=anim._config,uid=Y.stamp(node),attrs=Transition._nodeAttrs[uid],customAttr=Transition.behaviors,done=false,allDone=false,data,name,attribute,setter,elapsed,delay,d,t,i;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['18']++;for(name in attrs){__cov_P9MyqHY8ItAFRxYCk9oI0w.s['19']++;if((__cov_P9MyqHY8ItAFRxYCk9oI0w.b['3'][0]++,attribute=attrs[name])&&(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['3'][1]++,attribute.transition===anim)){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['2'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['20']++;d=attribute.duration;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['21']++;delay=attribute.delay;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['22']++;elapsed=(time-delay)/1000;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['23']++;t=time;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['24']++;data={type:'propertyEnd',propertyName:name,config:config,elapsedTime:elapsed};__cov_P9MyqHY8ItAFRxYCk9oI0w.s['25']++;setter=(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['5'][0]++,i in customAttr)&&(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['5'][1]++,'set'in customAttr[i])?(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['4'][0]++,customAttr[i].set):(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['4'][1]++,Transition.DEFAULT_SETTER);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['26']++;done=t>=d;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['27']++;if(t>d){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['6'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['28']++;t=d;}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['6'][1]++;}__cov_P9MyqHY8ItAFRxYCk9oI0w.s['29']++;if((__cov_P9MyqHY8ItAFRxYCk9oI0w.b['8'][0]++,!delay)||(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['8'][1]++,time>=delay)){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['7'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['30']++;setter(anim,name,attribute.from,attribute.to,t-delay,d-delay,attribute.easing,attribute.unit);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['31']++;if(done){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['9'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['32']++;delete attrs[name];__cov_P9MyqHY8ItAFRxYCk9oI0w.s['33']++;anim._count--;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['34']++;if((__cov_P9MyqHY8ItAFRxYCk9oI0w.b['11'][0]++,config[name])&&(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['11'][1]++,config[name].on)&&(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['11'][2]++,config[name].on.end)){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['10'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['35']++;config[name].on.end.call(Y.one(node),data);}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['10'][1]++;}__cov_P9MyqHY8ItAFRxYCk9oI0w.s['36']++;if((__cov_P9MyqHY8ItAFRxYCk9oI0w.b['13'][0]++,!allDone)&&(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['13'][1]++,anim._count<=0)){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['12'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['37']++;allDone=true;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['38']++;anim._end(elapsed);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['39']++;anim._endTimer();}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['12'][1]++;}}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['9'][1]++;}}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['7'][1]++;}}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['2'][1]++;}}},_initAttrs:function(){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['7']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['40']++;var anim=this,customAttr=Transition.behaviors,uid=Y.stamp(anim._node),attrs=Transition._nodeAttrs[uid],attribute,duration,delay,easing,val,name,mTo,mFrom,unit,begin,end;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['41']++;for(name in attrs){__cov_P9MyqHY8ItAFRxYCk9oI0w.s['42']++;if((__cov_P9MyqHY8ItAFRxYCk9oI0w.b['15'][0]++,attribute=attrs[name])&&(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['15'][1]++,attribute.transition===anim)){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['14'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['43']++;duration=attribute.duration*1000;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['44']++;delay=attribute.delay*1000;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['45']++;easing=attribute.easing;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['46']++;val=attribute.value;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['47']++;if((__cov_P9MyqHY8ItAFRxYCk9oI0w.b['17'][0]++,name in anim._node.style)||(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['17'][1]++,name in Y.DOM.CUSTOM_STYLES)){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['16'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['48']++;begin=(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['19'][0]++,name in customAttr)&&(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['19'][1]++,'get'in customAttr[name])?(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['18'][0]++,customAttr[name].get(anim,name)):(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['18'][1]++,Transition.DEFAULT_GETTER(anim,name));__cov_P9MyqHY8ItAFRxYCk9oI0w.s['49']++;mFrom=Transition.RE_UNITS.exec(begin);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['50']++;mTo=Transition.RE_UNITS.exec(val);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['51']++;begin=mFrom?(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['20'][0]++,mFrom[1]):(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['20'][1]++,begin);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['52']++;end=mTo?(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['21'][0]++,mTo[1]):(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['21'][1]++,val);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['53']++;unit=mTo?(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['22'][0]++,mTo[2]):(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['22'][1]++,mFrom?(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['23'][0]++,mFrom[2]):(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['23'][1]++,''));__cov_P9MyqHY8ItAFRxYCk9oI0w.s['54']++;if((__cov_P9MyqHY8ItAFRxYCk9oI0w.b['25'][0]++,!unit)&&(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['25'][1]++,Transition.RE_DEFAULT_UNIT.test(name))){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['24'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['55']++;unit=Transition.DEFAULT_UNIT;}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['24'][1]++;}__cov_P9MyqHY8ItAFRxYCk9oI0w.s['56']++;if(typeof easing==='string'){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['26'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['57']++;if(easing.indexOf('cubic-bezier')>-1){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['27'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['58']++;easing=easing.substring(13,easing.length-1).split(',');}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['27'][1]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['59']++;if(Transition.easings[easing]){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['28'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['60']++;easing=Transition.easings[easing];}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['28'][1]++;}}}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['26'][1]++;}__cov_P9MyqHY8ItAFRxYCk9oI0w.s['61']++;attribute.from=Number(begin);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['62']++;attribute.to=Number(end);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['63']++;attribute.unit=unit;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['64']++;attribute.easing=easing;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['65']++;attribute.duration=duration+delay;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['66']++;attribute.delay=delay;}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['16'][1]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['67']++;delete attrs[name];__cov_P9MyqHY8ItAFRxYCk9oI0w.s['68']++;anim._count--;}}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['14'][1]++;}}},destroy:function(){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['8']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['69']++;this.detachAll();__cov_P9MyqHY8ItAFRxYCk9oI0w.s['70']++;this._node=null;}},true);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['71']++;Y.mix(Y.Transition,{_runtimeAttrs:{},RE_DEFAULT_UNIT:/^width|height|top|right|bottom|left|margin.*|padding.*|border.*$/i,DEFAULT_UNIT:'px',intervalTime:20,behaviors:{left:{get:function(anim,attr){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['9']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['72']++;return Y.DOM._getAttrOffset(anim._node,attr);}}},DEFAULT_SETTER:function(anim,att,from,to,elapsed,duration,fn,unit){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['10']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['73']++;from=Number(from);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['74']++;to=Number(to);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['75']++;var node=anim._node,val=Transition.cubicBezier(fn,elapsed/duration);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['76']++;val=from+val[0]*(to-from);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['77']++;if(node){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['29'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['78']++;if((__cov_P9MyqHY8ItAFRxYCk9oI0w.b['31'][0]++,att in node.style)||(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['31'][1]++,att in Y.DOM.CUSTOM_STYLES)){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['30'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['79']++;unit=(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['32'][0]++,unit)||(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['32'][1]++,'');__cov_P9MyqHY8ItAFRxYCk9oI0w.s['80']++;Y.DOM.setStyle(node,att,val+unit);}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['30'][1]++;}}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['29'][1]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['81']++;anim._end();}},DEFAULT_GETTER:function(anim,att){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['11']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['82']++;var node=anim._node,val='';__cov_P9MyqHY8ItAFRxYCk9oI0w.s['83']++;if((__cov_P9MyqHY8ItAFRxYCk9oI0w.b['34'][0]++,att in node.style)||(__cov_P9MyqHY8ItAFRxYCk9oI0w.b['34'][1]++,att in Y.DOM.CUSTOM_STYLES)){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['33'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['84']++;val=Y.DOM.getComputedStyle(node,att);}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['33'][1]++;}__cov_P9MyqHY8ItAFRxYCk9oI0w.s['85']++;return val;},_startTimer:function(){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['12']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['86']++;if(!Transition._timer){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['35'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['87']++;Transition._timer=setInterval(Transition._runFrame,Transition.intervalTime);}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['35'][1]++;}},_stopTimer:function(){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['13']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['88']++;clearInterval(Transition._timer);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['89']++;Transition._timer=null;},_runFrame:function(){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['14']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['90']++;var done=true,anim;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['91']++;for(anim in Transition._running){__cov_P9MyqHY8ItAFRxYCk9oI0w.s['92']++;if(Transition._running[anim]._runFrame){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['36'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['93']++;done=false;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['94']++;Transition._running[anim]._runFrame();}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['36'][1]++;}}__cov_P9MyqHY8ItAFRxYCk9oI0w.s['95']++;if(done){__cov_P9MyqHY8ItAFRxYCk9oI0w.b['37'][0]++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['96']++;Transition._stopTimer();}else{__cov_P9MyqHY8ItAFRxYCk9oI0w.b['37'][1]++;}},cubicBezier:function(p,t){__cov_P9MyqHY8ItAFRxYCk9oI0w.f['15']++;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['97']++;var x0=0,y0=0,x1=p[0],y1=p[1],x2=p[2],y2=p[3],x3=1,y3=0,A=x3-3*x2+3*x1-x0,B=3*x2-6*x1+3*x0,C=3*x1-3*x0,D=x0,E=y3-3*y2+3*y1-y0,F=3*y2-6*y1+3*y0,G=3*y1-3*y0,H=y0,x=((A*t+B)*t+C)*t+D,y=((E*t+F)*t+G)*t+H;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['98']++;return[x,y];},easings:{ease:[0.25,0,1,0.25],linear:[0,0,1,1],'ease-in':[0.42,0,1,1],'ease-out':[0,0,0.58,1],'ease-in-out':[0.42,0,0.58,1]},_running:{},_timer:null,RE_UNITS:/^(-?\d*\.?\d*){1}(em|ex|px|in|cm|mm|pt|pc|%)*$/},true);__cov_P9MyqHY8ItAFRxYCk9oI0w.s['99']++;Transition.behaviors.top=Transition.behaviors.bottom=Transition.behaviors.right=Transition.behaviors.left;__cov_P9MyqHY8ItAFRxYCk9oI0w.s['100']++;Y.Transition=Transition;},'@VERSION@',{'requires':['transition']});
mxgit1090/cdnjs
ajax/libs/yui/3.13.0/transition-timer/transition-timer-coverage.js
JavaScript
mit
38,902
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/intl-base/intl-base.js']) { __coverage__['build/intl-base/intl-base.js'] = {"path":"build/intl-base/intl-base.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},"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]},"f":{"1":0,"2":0,"3":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":40}}},"2":{"name":"(anonymous_2)","line":36,"loc":{"start":{"line":36,"column":20},"end":{"line":36,"column":69}}},"3":{"name":"scan","line":42,"loc":{"start":{"line":42,"column":8},"end":{"line":42,"column":32}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":88,"column":44}},"2":{"start":{"line":12,"column":0},"end":{"line":12,"column":25}},"3":{"start":{"line":14,"column":0},"end":{"line":85,"column":3}},"4":{"start":{"line":38,"column":8},"end":{"line":38,"column":39}},"5":{"start":{"line":42,"column":8},"end":{"line":50,"column":9}},"6":{"start":{"line":43,"column":12},"end":{"line":43,"column":18}},"7":{"start":{"line":44,"column":12},"end":{"line":49,"column":13}},"8":{"start":{"line":45,"column":16},"end":{"line":48,"column":17}},"9":{"start":{"line":47,"column":20},"end":{"line":47,"column":49}},"10":{"start":{"line":52,"column":8},"end":{"line":54,"column":9}},"11":{"start":{"line":53,"column":12},"end":{"line":53,"column":71}},"12":{"start":{"line":56,"column":8},"end":{"line":81,"column":9}},"13":{"start":{"line":57,"column":12},"end":{"line":57,"column":45}},"14":{"start":{"line":58,"column":12},"end":{"line":60,"column":13}},"15":{"start":{"line":59,"column":16},"end":{"line":59,"column":25}},"16":{"start":{"line":62,"column":12},"end":{"line":80,"column":13}},"17":{"start":{"line":63,"column":16},"end":{"line":63,"column":40}},"18":{"start":{"line":64,"column":16},"end":{"line":79,"column":17}},"19":{"start":{"line":65,"column":20},"end":{"line":65,"column":34}},"20":{"start":{"line":67,"column":20},"end":{"line":67,"column":54}},"21":{"start":{"line":68,"column":20},"end":{"line":78,"column":21}},"22":{"start":{"line":69,"column":24},"end":{"line":69,"column":64}},"23":{"start":{"line":72,"column":24},"end":{"line":74,"column":25}},"24":{"start":{"line":73,"column":28},"end":{"line":73,"column":72}},"25":{"start":{"line":77,"column":24},"end":{"line":77,"column":30}},"26":{"start":{"line":83,"column":8},"end":{"line":83,"column":18}}},"branchMap":{"1":{"line":45,"type":"if","locations":[{"start":{"line":45,"column":16},"end":{"line":45,"column":16}},{"start":{"line":45,"column":16},"end":{"line":45,"column":16}}]},"2":{"line":52,"type":"if","locations":[{"start":{"line":52,"column":8},"end":{"line":52,"column":8}},{"start":{"line":52,"column":8},"end":{"line":52,"column":8}}]},"3":{"line":58,"type":"if","locations":[{"start":{"line":58,"column":12},"end":{"line":58,"column":12}},{"start":{"line":58,"column":12},"end":{"line":58,"column":12}}]},"4":{"line":58,"type":"binary-expr","locations":[{"start":{"line":58,"column":16},"end":{"line":58,"column":25}},{"start":{"line":58,"column":29},"end":{"line":58,"column":45}}]},"5":{"line":64,"type":"if","locations":[{"start":{"line":64,"column":16},"end":{"line":64,"column":16}},{"start":{"line":64,"column":16},"end":{"line":64,"column":16}}]},"6":{"line":68,"type":"if","locations":[{"start":{"line":68,"column":20},"end":{"line":68,"column":20}},{"start":{"line":68,"column":20},"end":{"line":68,"column":20}}]},"7":{"line":72,"type":"if","locations":[{"start":{"line":72,"column":24},"end":{"line":72,"column":24}},{"start":{"line":72,"column":24},"end":{"line":72,"column":24}}]},"8":{"line":72,"type":"binary-expr","locations":[{"start":{"line":72,"column":28},"end":{"line":72,"column":38}},{"start":{"line":72,"column":42},"end":{"line":72,"column":76}}]}},"code":["(function () { YUI.add('intl-base', function (Y, NAME) {","","/**"," * The Intl utility provides a central location for managing sets of"," * localized resources (strings and formatting patterns)."," *"," * @class Intl"," * @uses EventTarget"," * @static"," */","","var SPLIT_REGEX = /[, ]/;","","Y.mix(Y.namespace('Intl'), {",""," /**"," * Returns the language among those available that"," * best matches the preferred language list, using the Lookup"," * algorithm of BCP 47."," * If none of the available languages meets the user's preferences,"," * then \"\" is returned."," * Extended language ranges are not supported."," *"," * @method lookupBestLang"," * @param {String[] | String} preferredLanguages The list of preferred"," * languages in descending preference order, represented as BCP 47"," * language tags. A string array or a comma-separated list."," * @param {String[]} availableLanguages The list of languages"," * that the application supports, represented as BCP 47 language"," * tags."," *"," * @return {String} The available language that best matches the"," * preferred language list, or \"\"."," * @since 3.1.0"," */"," lookupBestLang: function(preferredLanguages, availableLanguages) {",""," var i, language, result, index;",""," // check whether the list of available languages contains language;"," // if so return it"," function scan(language) {"," var i;"," for (i = 0; i < availableLanguages.length; i += 1) {"," if (language.toLowerCase() ==="," availableLanguages[i].toLowerCase()) {"," return availableLanguages[i];"," }"," }"," }",""," if (Y.Lang.isString(preferredLanguages)) {"," preferredLanguages = preferredLanguages.split(SPLIT_REGEX);"," }",""," for (i = 0; i < preferredLanguages.length; i += 1) {"," language = preferredLanguages[i];"," if (!language || language === '*') {"," continue;"," }"," // check the fallback sequence for one language"," while (language.length > 0) {"," result = scan(language);"," if (result) {"," return result;"," } else {"," index = language.lastIndexOf('-');"," if (index >= 0) {"," language = language.substring(0, index);"," // one-character subtags get cut along with the"," // following subtag"," if (index >= 2 && language.charAt(index - 2) === '-') {"," language = language.substring(0, index - 2);"," }"," } else {"," // nothing available for this language"," break;"," }"," }"," }"," }",""," return '';"," }","});","","","}, '@VERSION@', {\"requires\": [\"yui-base\"]});","","}());"]}; } var __cov_AozP7VJyVhImPsJEySoFxg = __coverage__['build/intl-base/intl-base.js']; __cov_AozP7VJyVhImPsJEySoFxg.s['1']++;YUI.add('intl-base',function(Y,NAME){__cov_AozP7VJyVhImPsJEySoFxg.f['1']++;__cov_AozP7VJyVhImPsJEySoFxg.s['2']++;var SPLIT_REGEX=/[, ]/;__cov_AozP7VJyVhImPsJEySoFxg.s['3']++;Y.mix(Y.namespace('Intl'),{lookupBestLang:function(preferredLanguages,availableLanguages){__cov_AozP7VJyVhImPsJEySoFxg.f['2']++;__cov_AozP7VJyVhImPsJEySoFxg.s['4']++;var i,language,result,index;__cov_AozP7VJyVhImPsJEySoFxg.s['5']++;function scan(language){__cov_AozP7VJyVhImPsJEySoFxg.f['3']++;__cov_AozP7VJyVhImPsJEySoFxg.s['6']++;var i;__cov_AozP7VJyVhImPsJEySoFxg.s['7']++;for(i=0;i<availableLanguages.length;i+=1){__cov_AozP7VJyVhImPsJEySoFxg.s['8']++;if(language.toLowerCase()===availableLanguages[i].toLowerCase()){__cov_AozP7VJyVhImPsJEySoFxg.b['1'][0]++;__cov_AozP7VJyVhImPsJEySoFxg.s['9']++;return availableLanguages[i];}else{__cov_AozP7VJyVhImPsJEySoFxg.b['1'][1]++;}}}__cov_AozP7VJyVhImPsJEySoFxg.s['10']++;if(Y.Lang.isString(preferredLanguages)){__cov_AozP7VJyVhImPsJEySoFxg.b['2'][0]++;__cov_AozP7VJyVhImPsJEySoFxg.s['11']++;preferredLanguages=preferredLanguages.split(SPLIT_REGEX);}else{__cov_AozP7VJyVhImPsJEySoFxg.b['2'][1]++;}__cov_AozP7VJyVhImPsJEySoFxg.s['12']++;for(i=0;i<preferredLanguages.length;i+=1){__cov_AozP7VJyVhImPsJEySoFxg.s['13']++;language=preferredLanguages[i];__cov_AozP7VJyVhImPsJEySoFxg.s['14']++;if((__cov_AozP7VJyVhImPsJEySoFxg.b['4'][0]++,!language)||(__cov_AozP7VJyVhImPsJEySoFxg.b['4'][1]++,language==='*')){__cov_AozP7VJyVhImPsJEySoFxg.b['3'][0]++;__cov_AozP7VJyVhImPsJEySoFxg.s['15']++;continue;}else{__cov_AozP7VJyVhImPsJEySoFxg.b['3'][1]++;}__cov_AozP7VJyVhImPsJEySoFxg.s['16']++;while(language.length>0){__cov_AozP7VJyVhImPsJEySoFxg.s['17']++;result=scan(language);__cov_AozP7VJyVhImPsJEySoFxg.s['18']++;if(result){__cov_AozP7VJyVhImPsJEySoFxg.b['5'][0]++;__cov_AozP7VJyVhImPsJEySoFxg.s['19']++;return result;}else{__cov_AozP7VJyVhImPsJEySoFxg.b['5'][1]++;__cov_AozP7VJyVhImPsJEySoFxg.s['20']++;index=language.lastIndexOf('-');__cov_AozP7VJyVhImPsJEySoFxg.s['21']++;if(index>=0){__cov_AozP7VJyVhImPsJEySoFxg.b['6'][0]++;__cov_AozP7VJyVhImPsJEySoFxg.s['22']++;language=language.substring(0,index);__cov_AozP7VJyVhImPsJEySoFxg.s['23']++;if((__cov_AozP7VJyVhImPsJEySoFxg.b['8'][0]++,index>=2)&&(__cov_AozP7VJyVhImPsJEySoFxg.b['8'][1]++,language.charAt(index-2)==='-')){__cov_AozP7VJyVhImPsJEySoFxg.b['7'][0]++;__cov_AozP7VJyVhImPsJEySoFxg.s['24']++;language=language.substring(0,index-2);}else{__cov_AozP7VJyVhImPsJEySoFxg.b['7'][1]++;}}else{__cov_AozP7VJyVhImPsJEySoFxg.b['6'][1]++;__cov_AozP7VJyVhImPsJEySoFxg.s['25']++;break;}}}}__cov_AozP7VJyVhImPsJEySoFxg.s['26']++;return'';}});},'@VERSION@',{'requires':['yui-base']});
viskin/cdnjs
ajax/libs/yui/3.10.2/intl-base/intl-base-coverage.js
JavaScript
mit
9,912
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/axis-stacked/axis-stacked.js']) { __coverage__['build/axis-stacked/axis-stacked.js'] = {"path":"build/axis-stacked/axis-stacked.js","s":{"1":0,"2":0},"b":{},"f":{"1":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":43}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":23,"column":69}},"2":{"start":{"line":19,"column":0},"end":{"line":19,"column":77}}},"branchMap":{},"code":["(function () { YUI.add('axis-stacked', function (Y, NAME) {","","/**"," * Provides functionality for drawing a stacked numeric axis for use with a chart."," *"," * @module charts"," * @submodule axis-stacked"," */","/**"," * StackedAxis draws a stacked numeric axis for a chart."," *"," * @class StackedAxis"," * @constructor"," * @param {Object} config (optional) Configuration parameters."," * @extends NumericAxis"," * @uses StackedImpl"," * @submodule axis-stacked"," */","Y.StackedAxis = Y.Base.create(\"stackedAxis\", Y.NumericAxis, [Y.StackedImpl]);","","","","}, '@VERSION@', {\"requires\": [\"axis-numeric\", \"axis-stacked-base\"]});","","}());"]}; } var __cov_PBBzFuQXOKkl1sZvW2L$7w = __coverage__['build/axis-stacked/axis-stacked.js']; __cov_PBBzFuQXOKkl1sZvW2L$7w.s['1']++;YUI.add('axis-stacked',function(Y,NAME){__cov_PBBzFuQXOKkl1sZvW2L$7w.f['1']++;__cov_PBBzFuQXOKkl1sZvW2L$7w.s['2']++;Y.StackedAxis=Y.Base.create('stackedAxis',Y.NumericAxis,[Y.StackedImpl]);},'@VERSION@',{'requires':['axis-numeric','axis-stacked-base']});
manorius/cdnjs
ajax/libs/yui/3.10.2/axis-stacked/axis-stacked-coverage.js
JavaScript
mit
1,592
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/anim-easing/anim-easing.js']) { __coverage__['build/anim-easing/anim-easing.js'] = {"path":"build/anim-easing/anim-easing.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},"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]},"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},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":42}}},"2":{"name":"(anonymous_2)","line":52,"loc":{"start":{"line":52,"column":14},"end":{"line":52,"column":36}}},"3":{"name":"(anonymous_3)","line":65,"loc":{"start":{"line":65,"column":12},"end":{"line":65,"column":34}}},"4":{"name":"(anonymous_4)","line":78,"loc":{"start":{"line":78,"column":13},"end":{"line":78,"column":35}}},"5":{"name":"(anonymous_5)","line":91,"loc":{"start":{"line":91,"column":14},"end":{"line":91,"column":36}}},"6":{"name":"(anonymous_6)","line":108,"loc":{"start":{"line":108,"column":18},"end":{"line":108,"column":40}}},"7":{"name":"(anonymous_7)","line":121,"loc":{"start":{"line":121,"column":19},"end":{"line":121,"column":41}}},"8":{"name":"(anonymous_8)","line":134,"loc":{"start":{"line":134,"column":20},"end":{"line":134,"column":42}}},"9":{"name":"(anonymous_9)","line":154,"loc":{"start":{"line":154,"column":15},"end":{"line":154,"column":43}}},"10":{"name":"(anonymous_10)","line":188,"loc":{"start":{"line":188,"column":16},"end":{"line":188,"column":44}}},"11":{"name":"(anonymous_11)","line":222,"loc":{"start":{"line":222,"column":17},"end":{"line":222,"column":45}}},"12":{"name":"(anonymous_12)","line":263,"loc":{"start":{"line":263,"column":12},"end":{"line":263,"column":37}}},"13":{"name":"(anonymous_13)","line":283,"loc":{"start":{"line":283,"column":13},"end":{"line":283,"column":38}}},"14":{"name":"(anonymous_14)","line":301,"loc":{"start":{"line":301,"column":14},"end":{"line":301,"column":39}}},"15":{"name":"(anonymous_15)","line":321,"loc":{"start":{"line":321,"column":14},"end":{"line":321,"column":36}}},"16":{"name":"(anonymous_16)","line":334,"loc":{"start":{"line":334,"column":15},"end":{"line":334,"column":37}}},"17":{"name":"(anonymous_17)","line":354,"loc":{"start":{"line":354,"column":16},"end":{"line":354,"column":38}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":365,"column":45}},"2":{"start":{"line":40,"column":0},"end":{"line":360,"column":2}},"3":{"start":{"line":53,"column":8},"end":{"line":53,"column":25}},"4":{"start":{"line":66,"column":8},"end":{"line":66,"column":30}},"5":{"start":{"line":79,"column":8},"end":{"line":79,"column":36}},"6":{"start":{"line":92,"column":8},"end":{"line":94,"column":9}},"7":{"start":{"line":93,"column":12},"end":{"line":93,"column":31}},"8":{"start":{"line":96,"column":8},"end":{"line":96,"column":44}},"9":{"start":{"line":109,"column":8},"end":{"line":109,"column":34}},"10":{"start":{"line":122,"column":8},"end":{"line":122,"column":46}},"11":{"start":{"line":135,"column":8},"end":{"line":137,"column":9}},"12":{"start":{"line":136,"column":12},"end":{"line":136,"column":35}},"13":{"start":{"line":139,"column":8},"end":{"line":139,"column":45}},"14":{"start":{"line":155,"column":8},"end":{"line":155,"column":14}},"15":{"start":{"line":156,"column":8},"end":{"line":158,"column":9}},"16":{"start":{"line":157,"column":12},"end":{"line":157,"column":21}},"17":{"start":{"line":159,"column":8},"end":{"line":161,"column":9}},"18":{"start":{"line":160,"column":12},"end":{"line":160,"column":23}},"19":{"start":{"line":162,"column":8},"end":{"line":164,"column":9}},"20":{"start":{"line":163,"column":12},"end":{"line":163,"column":23}},"21":{"start":{"line":166,"column":8},"end":{"line":172,"column":9}},"22":{"start":{"line":167,"column":12},"end":{"line":167,"column":18}},"23":{"start":{"line":168,"column":12},"end":{"line":168,"column":20}},"24":{"start":{"line":171,"column":12},"end":{"line":171,"column":48}},"25":{"start":{"line":174,"column":8},"end":{"line":174,"column":82}},"26":{"start":{"line":189,"column":8},"end":{"line":189,"column":14}},"27":{"start":{"line":190,"column":8},"end":{"line":192,"column":9}},"28":{"start":{"line":191,"column":12},"end":{"line":191,"column":21}},"29":{"start":{"line":193,"column":8},"end":{"line":195,"column":9}},"30":{"start":{"line":194,"column":12},"end":{"line":194,"column":23}},"31":{"start":{"line":196,"column":8},"end":{"line":198,"column":9}},"32":{"start":{"line":197,"column":12},"end":{"line":197,"column":22}},"33":{"start":{"line":200,"column":8},"end":{"line":206,"column":9}},"34":{"start":{"line":201,"column":12},"end":{"line":201,"column":18}},"35":{"start":{"line":202,"column":12},"end":{"line":202,"column":22}},"36":{"start":{"line":205,"column":12},"end":{"line":205,"column":48}},"37":{"start":{"line":208,"column":8},"end":{"line":208,"column":79}},"38":{"start":{"line":223,"column":8},"end":{"line":223,"column":14}},"39":{"start":{"line":224,"column":8},"end":{"line":226,"column":9}},"40":{"start":{"line":225,"column":12},"end":{"line":225,"column":21}},"41":{"start":{"line":228,"column":8},"end":{"line":230,"column":9}},"42":{"start":{"line":229,"column":12},"end":{"line":229,"column":23}},"43":{"start":{"line":232,"column":8},"end":{"line":234,"column":9}},"44":{"start":{"line":233,"column":12},"end":{"line":233,"column":28}},"45":{"start":{"line":236,"column":8},"end":{"line":242,"column":9}},"46":{"start":{"line":237,"column":12},"end":{"line":237,"column":18}},"47":{"start":{"line":238,"column":12},"end":{"line":238,"column":20}},"48":{"start":{"line":241,"column":12},"end":{"line":241,"column":48}},"49":{"start":{"line":244,"column":8},"end":{"line":247,"column":9}},"50":{"start":{"line":245,"column":12},"end":{"line":246,"column":59}},"51":{"start":{"line":248,"column":8},"end":{"line":249,"column":62}},"52":{"start":{"line":264,"column":8},"end":{"line":266,"column":9}},"53":{"start":{"line":265,"column":12},"end":{"line":265,"column":24}},"54":{"start":{"line":267,"column":8},"end":{"line":269,"column":9}},"55":{"start":{"line":268,"column":12},"end":{"line":268,"column":23}},"56":{"start":{"line":270,"column":8},"end":{"line":270,"column":44}},"57":{"start":{"line":284,"column":8},"end":{"line":286,"column":9}},"58":{"start":{"line":285,"column":12},"end":{"line":285,"column":24}},"59":{"start":{"line":287,"column":8},"end":{"line":287,"column":53}},"60":{"start":{"line":302,"column":8},"end":{"line":304,"column":9}},"61":{"start":{"line":303,"column":12},"end":{"line":303,"column":24}},"62":{"start":{"line":306,"column":8},"end":{"line":308,"column":9}},"63":{"start":{"line":307,"column":12},"end":{"line":307,"column":58}},"64":{"start":{"line":309,"column":8},"end":{"line":309,"column":63}},"65":{"start":{"line":322,"column":8},"end":{"line":322,"column":56}},"66":{"start":{"line":335,"column":8},"end":{"line":341,"column":9}},"67":{"start":{"line":336,"column":16},"end":{"line":336,"column":42}},"68":{"start":{"line":337,"column":15},"end":{"line":341,"column":9}},"69":{"start":{"line":338,"column":16},"end":{"line":338,"column":63}},"70":{"start":{"line":339,"column":15},"end":{"line":341,"column":9}},"71":{"start":{"line":340,"column":16},"end":{"line":340,"column":66}},"72":{"start":{"line":342,"column":8},"end":{"line":342,"column":61}},"73":{"start":{"line":355,"column":8},"end":{"line":357,"column":9}},"74":{"start":{"line":356,"column":12},"end":{"line":356,"column":63}},"75":{"start":{"line":358,"column":8},"end":{"line":358,"column":74}},"76":{"start":{"line":362,"column":0},"end":{"line":362,"column":18}}},"branchMap":{"1":{"line":92,"type":"if","locations":[{"start":{"line":92,"column":8},"end":{"line":92,"column":8}},{"start":{"line":92,"column":8},"end":{"line":92,"column":8}}]},"2":{"line":135,"type":"if","locations":[{"start":{"line":135,"column":8},"end":{"line":135,"column":8}},{"start":{"line":135,"column":8},"end":{"line":135,"column":8}}]},"3":{"line":156,"type":"if","locations":[{"start":{"line":156,"column":8},"end":{"line":156,"column":8}},{"start":{"line":156,"column":8},"end":{"line":156,"column":8}}]},"4":{"line":159,"type":"if","locations":[{"start":{"line":159,"column":8},"end":{"line":159,"column":8}},{"start":{"line":159,"column":8},"end":{"line":159,"column":8}}]},"5":{"line":162,"type":"if","locations":[{"start":{"line":162,"column":8},"end":{"line":162,"column":8}},{"start":{"line":162,"column":8},"end":{"line":162,"column":8}}]},"6":{"line":166,"type":"if","locations":[{"start":{"line":166,"column":8},"end":{"line":166,"column":8}},{"start":{"line":166,"column":8},"end":{"line":166,"column":8}}]},"7":{"line":166,"type":"binary-expr","locations":[{"start":{"line":166,"column":12},"end":{"line":166,"column":14}},{"start":{"line":166,"column":18},"end":{"line":166,"column":33}}]},"8":{"line":190,"type":"if","locations":[{"start":{"line":190,"column":8},"end":{"line":190,"column":8}},{"start":{"line":190,"column":8},"end":{"line":190,"column":8}}]},"9":{"line":193,"type":"if","locations":[{"start":{"line":193,"column":8},"end":{"line":193,"column":8}},{"start":{"line":193,"column":8},"end":{"line":193,"column":8}}]},"10":{"line":196,"type":"if","locations":[{"start":{"line":196,"column":8},"end":{"line":196,"column":8}},{"start":{"line":196,"column":8},"end":{"line":196,"column":8}}]},"11":{"line":200,"type":"if","locations":[{"start":{"line":200,"column":8},"end":{"line":200,"column":8}},{"start":{"line":200,"column":8},"end":{"line":200,"column":8}}]},"12":{"line":200,"type":"binary-expr","locations":[{"start":{"line":200,"column":12},"end":{"line":200,"column":14}},{"start":{"line":200,"column":18},"end":{"line":200,"column":33}}]},"13":{"line":224,"type":"if","locations":[{"start":{"line":224,"column":8},"end":{"line":224,"column":8}},{"start":{"line":224,"column":8},"end":{"line":224,"column":8}}]},"14":{"line":228,"type":"if","locations":[{"start":{"line":228,"column":8},"end":{"line":228,"column":8}},{"start":{"line":228,"column":8},"end":{"line":228,"column":8}}]},"15":{"line":232,"type":"if","locations":[{"start":{"line":232,"column":8},"end":{"line":232,"column":8}},{"start":{"line":232,"column":8},"end":{"line":232,"column":8}}]},"16":{"line":236,"type":"if","locations":[{"start":{"line":236,"column":8},"end":{"line":236,"column":8}},{"start":{"line":236,"column":8},"end":{"line":236,"column":8}}]},"17":{"line":236,"type":"binary-expr","locations":[{"start":{"line":236,"column":13},"end":{"line":236,"column":15}},{"start":{"line":236,"column":19},"end":{"line":236,"column":34}}]},"18":{"line":244,"type":"if","locations":[{"start":{"line":244,"column":8},"end":{"line":244,"column":8}},{"start":{"line":244,"column":8},"end":{"line":244,"column":8}}]},"19":{"line":264,"type":"if","locations":[{"start":{"line":264,"column":8},"end":{"line":264,"column":8}},{"start":{"line":264,"column":8},"end":{"line":264,"column":8}}]},"20":{"line":267,"type":"if","locations":[{"start":{"line":267,"column":8},"end":{"line":267,"column":8}},{"start":{"line":267,"column":8},"end":{"line":267,"column":8}}]},"21":{"line":284,"type":"if","locations":[{"start":{"line":284,"column":8},"end":{"line":284,"column":8}},{"start":{"line":284,"column":8},"end":{"line":284,"column":8}}]},"22":{"line":302,"type":"if","locations":[{"start":{"line":302,"column":8},"end":{"line":302,"column":8}},{"start":{"line":302,"column":8},"end":{"line":302,"column":8}}]},"23":{"line":306,"type":"if","locations":[{"start":{"line":306,"column":8},"end":{"line":306,"column":8}},{"start":{"line":306,"column":8},"end":{"line":306,"column":8}}]},"24":{"line":335,"type":"if","locations":[{"start":{"line":335,"column":8},"end":{"line":335,"column":8}},{"start":{"line":335,"column":8},"end":{"line":335,"column":8}}]},"25":{"line":337,"type":"if","locations":[{"start":{"line":337,"column":15},"end":{"line":337,"column":15}},{"start":{"line":337,"column":15},"end":{"line":337,"column":15}}]},"26":{"line":339,"type":"if","locations":[{"start":{"line":339,"column":15},"end":{"line":339,"column":15}},{"start":{"line":339,"column":15},"end":{"line":339,"column":15}}]},"27":{"line":355,"type":"if","locations":[{"start":{"line":355,"column":8},"end":{"line":355,"column":8}},{"start":{"line":355,"column":8},"end":{"line":355,"column":8}}]}},"code":["(function () { YUI.add('anim-easing', function (Y, NAME) {","","/*","TERMS OF USE - EASING EQUATIONS","Open source under the BSD License.","Copyright 2001 Robert Penner All rights reserved.","","Redistribution and use in source and binary forms, with or without modification,","are permitted provided that the following conditions are met:",""," * Redistributions of source code must retain the above copyright notice, this"," list of conditions and the following disclaimer."," * Redistributions in binary form must reproduce the above copyright notice,"," this list of conditions and the following disclaimer in the documentation"," and/or other materials provided with the distribution."," * Neither the name of the author nor the names of 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.","*/","","/**"," * The easing module provides methods for customizing"," * how an animation behaves during each run."," * @class Easing"," * @module anim"," * @submodule anim-easing"," */","","var Easing = {",""," /**"," * Uniform speed between points."," * @for Easing"," * @method easeNone"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @return {Number} The computed value for the current animation frame"," */"," easeNone: function (t, b, c, d) {"," return c*t/d + b;"," },",""," /**"," * Begins slowly and accelerates towards end. (quadratic)"," * @method easeIn"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @return {Number} The computed value for the current animation frame"," */"," easeIn: function (t, b, c, d) {"," return c*(t/=d)*t + b;"," },",""," /**"," * Begins quickly and decelerates towards end. (quadratic)"," * @method easeOut"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @return {Number} The computed value for the current animation frame"," */"," easeOut: function (t, b, c, d) {"," return -c *(t/=d)*(t-2) + b;"," },",""," /**"," * Begins slowly and decelerates towards end. (quadratic)"," * @method easeBoth"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @return {Number} The computed value for the current animation frame"," */"," easeBoth: function (t, b, c, d) {"," if ((t /= d/2) < 1) {"," return c/2*t*t + b;"," }",""," return -c/2 * ((--t)*(t-2) - 1) + b;"," },",""," /**"," * Begins slowly and accelerates towards end. (quartic)"," * @method easeInStrong"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @return {Number} The computed value for the current animation frame"," */"," easeInStrong: function (t, b, c, d) {"," return c*(t/=d)*t*t*t + b;"," },",""," /**"," * Begins quickly and decelerates towards end. (quartic)"," * @method easeOutStrong"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @return {Number} The computed value for the current animation frame"," */"," easeOutStrong: function (t, b, c, d) {"," return -c * ((t=t/d-1)*t*t*t - 1) + b;"," },",""," /**"," * Begins slowly and decelerates towards end. (quartic)"," * @method easeBothStrong"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @return {Number} The computed value for the current animation frame"," */"," easeBothStrong: function (t, b, c, d) {"," if ((t /= d/2) < 1) {"," return c/2*t*t*t*t + b;"," }",""," return -c/2 * ((t-=2)*t*t*t - 2) + b;"," },",""," /**"," * Snap in elastic effect."," * @method elasticIn"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @param {Number} a Amplitude (optional)"," * @param {Number} p Period (optional)"," * @return {Number} The computed value for the current animation frame"," */",""," elasticIn: function (t, b, c, d, a, p) {"," var s;"," if (t === 0) {"," return b;"," }"," if ( (t /= d) === 1 ) {"," return b+c;"," }"," if (!p) {"," p = d* 0.3;"," }",""," if (!a || a < Math.abs(c)) {"," a = c;"," s = p/4;"," }"," else {"," s = p/(2*Math.PI) * Math.asin (c/a);"," }",""," return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;"," },",""," /**"," * Snap out elastic effect."," * @method elasticOut"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @param {Number} a Amplitude (optional)"," * @param {Number} p Period (optional)"," * @return {Number} The computed value for the current animation frame"," */"," elasticOut: function (t, b, c, d, a, p) {"," var s;"," if (t === 0) {"," return b;"," }"," if ( (t /= d) === 1 ) {"," return b+c;"," }"," if (!p) {"," p=d * 0.3;"," }",""," if (!a || a < Math.abs(c)) {"," a = c;"," s = p / 4;"," }"," else {"," s = p/(2*Math.PI) * Math.asin (c/a);"," }",""," return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;"," },",""," /**"," * Snap both elastic effect."," * @method elasticBoth"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @param {Number} a Amplitude (optional)"," * @param {Number} p Period (optional)"," * @return {Number} The computed value for the current animation frame"," */"," elasticBoth: function (t, b, c, d, a, p) {"," var s;"," if (t === 0) {"," return b;"," }",""," if ( (t /= d/2) === 2 ) {"," return b+c;"," }",""," if (!p) {"," p = d*(0.3*1.5);"," }",""," if ( !a || a < Math.abs(c) ) {"," a = c;"," s = p/4;"," }"," else {"," s = p/(2*Math.PI) * Math.asin (c/a);"," }",""," if (t < 1) {"," return -0.5*(a*Math.pow(2,10*(t-=1)) *"," Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;"," }"," return a*Math.pow(2,-10*(t-=1)) *"," Math.sin( (t*d-s)*(2*Math.PI)/p )*0.5 + c + b;"," },","",""," /**"," * Backtracks slightly, then reverses direction and moves to end."," * @method backIn"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @param {Number} s Overshoot (optional)"," * @return {Number} The computed value for the current animation frame"," */"," backIn: function (t, b, c, d, s) {"," if (s === undefined) {"," s = 1.70158;"," }"," if (t === d) {"," t -= 0.001;"," }"," return c*(t/=d)*t*((s+1)*t - s) + b;"," },",""," /**"," * Overshoots end, then reverses and comes back to end."," * @method backOut"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @param {Number} s Overshoot (optional)"," * @return {Number} The computed value for the current animation frame"," */"," backOut: function (t, b, c, d, s) {"," if (typeof s === 'undefined') {"," s = 1.70158;"," }"," return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;"," },",""," /**"," * Backtracks slightly, then reverses direction, overshoots end,"," * then reverses and comes back to end."," * @method backBoth"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @param {Number} s Overshoot (optional)"," * @return {Number} The computed value for the current animation frame"," */"," backBoth: function (t, b, c, d, s) {"," if (typeof s === 'undefined') {"," s = 1.70158;"," }",""," if ((t /= d/2 ) < 1) {"," return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;"," }"," return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;"," },",""," /**"," * Bounce off of start."," * @method bounceIn"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @return {Number} The computed value for the current animation frame"," */"," bounceIn: function (t, b, c, d) {"," return c - Y.Easing.bounceOut(d-t, 0, c, d) + b;"," },",""," /**"," * Bounces off end."," * @method bounceOut"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @return {Number} The computed value for the current animation frame"," */"," bounceOut: function (t, b, c, d) {"," if ((t/=d) < (1/2.75)) {"," return c*(7.5625*t*t) + b;"," } else if (t < (2/2.75)) {"," return c*(7.5625*(t-=(1.5/2.75))*t + 0.75) + b;"," } else if (t < (2.5/2.75)) {"," return c*(7.5625*(t-=(2.25/2.75))*t + 0.9375) + b;"," }"," return c*(7.5625*(t-=(2.625/2.75))*t + 0.984375) + b;"," },",""," /**"," * Bounces off start and end."," * @method bounceBoth"," * @param {Number} t Time value used to compute current value"," * @param {Number} b Starting value"," * @param {Number} c Delta between start and end values"," * @param {Number} d Total length of animation"," * @return {Number} The computed value for the current animation frame"," */"," bounceBoth: function (t, b, c, d) {"," if (t < d/2) {"," return Y.Easing.bounceIn(t * 2, 0, c, d) * 0.5 + b;"," }"," return Y.Easing.bounceOut(t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b;"," }","};","","Y.Easing = Easing;","","","}, '@VERSION@', {\"requires\": [\"anim-base\"]});","","}());"]}; } var __cov_YIovT6krughe2nlH0KPcnA = __coverage__['build/anim-easing/anim-easing.js']; __cov_YIovT6krughe2nlH0KPcnA.s['1']++;YUI.add('anim-easing',function(Y,NAME){__cov_YIovT6krughe2nlH0KPcnA.f['1']++;__cov_YIovT6krughe2nlH0KPcnA.s['2']++;var Easing={easeNone:function(t,b,c,d){__cov_YIovT6krughe2nlH0KPcnA.f['2']++;__cov_YIovT6krughe2nlH0KPcnA.s['3']++;return c*t/d+b;},easeIn:function(t,b,c,d){__cov_YIovT6krughe2nlH0KPcnA.f['3']++;__cov_YIovT6krughe2nlH0KPcnA.s['4']++;return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){__cov_YIovT6krughe2nlH0KPcnA.f['4']++;__cov_YIovT6krughe2nlH0KPcnA.s['5']++;return-c*(t/=d)*(t-2)+b;},easeBoth:function(t,b,c,d){__cov_YIovT6krughe2nlH0KPcnA.f['5']++;__cov_YIovT6krughe2nlH0KPcnA.s['6']++;if((t/=d/2)<1){__cov_YIovT6krughe2nlH0KPcnA.b['1'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['7']++;return c/2*t*t+b;}else{__cov_YIovT6krughe2nlH0KPcnA.b['1'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['8']++;return-c/2*(--t*(t-2)-1)+b;},easeInStrong:function(t,b,c,d){__cov_YIovT6krughe2nlH0KPcnA.f['6']++;__cov_YIovT6krughe2nlH0KPcnA.s['9']++;return c*(t/=d)*t*t*t+b;},easeOutStrong:function(t,b,c,d){__cov_YIovT6krughe2nlH0KPcnA.f['7']++;__cov_YIovT6krughe2nlH0KPcnA.s['10']++;return-c*((t=t/d-1)*t*t*t-1)+b;},easeBothStrong:function(t,b,c,d){__cov_YIovT6krughe2nlH0KPcnA.f['8']++;__cov_YIovT6krughe2nlH0KPcnA.s['11']++;if((t/=d/2)<1){__cov_YIovT6krughe2nlH0KPcnA.b['2'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['12']++;return c/2*t*t*t*t+b;}else{__cov_YIovT6krughe2nlH0KPcnA.b['2'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['13']++;return-c/2*((t-=2)*t*t*t-2)+b;},elasticIn:function(t,b,c,d,a,p){__cov_YIovT6krughe2nlH0KPcnA.f['9']++;__cov_YIovT6krughe2nlH0KPcnA.s['14']++;var s;__cov_YIovT6krughe2nlH0KPcnA.s['15']++;if(t===0){__cov_YIovT6krughe2nlH0KPcnA.b['3'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['16']++;return b;}else{__cov_YIovT6krughe2nlH0KPcnA.b['3'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['17']++;if((t/=d)===1){__cov_YIovT6krughe2nlH0KPcnA.b['4'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['18']++;return b+c;}else{__cov_YIovT6krughe2nlH0KPcnA.b['4'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['19']++;if(!p){__cov_YIovT6krughe2nlH0KPcnA.b['5'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['20']++;p=d*0.3;}else{__cov_YIovT6krughe2nlH0KPcnA.b['5'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['21']++;if((__cov_YIovT6krughe2nlH0KPcnA.b['7'][0]++,!a)||(__cov_YIovT6krughe2nlH0KPcnA.b['7'][1]++,a<Math.abs(c))){__cov_YIovT6krughe2nlH0KPcnA.b['6'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['22']++;a=c;__cov_YIovT6krughe2nlH0KPcnA.s['23']++;s=p/4;}else{__cov_YIovT6krughe2nlH0KPcnA.b['6'][1]++;__cov_YIovT6krughe2nlH0KPcnA.s['24']++;s=p/(2*Math.PI)*Math.asin(c/a);}__cov_YIovT6krughe2nlH0KPcnA.s['25']++;return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticOut:function(t,b,c,d,a,p){__cov_YIovT6krughe2nlH0KPcnA.f['10']++;__cov_YIovT6krughe2nlH0KPcnA.s['26']++;var s;__cov_YIovT6krughe2nlH0KPcnA.s['27']++;if(t===0){__cov_YIovT6krughe2nlH0KPcnA.b['8'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['28']++;return b;}else{__cov_YIovT6krughe2nlH0KPcnA.b['8'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['29']++;if((t/=d)===1){__cov_YIovT6krughe2nlH0KPcnA.b['9'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['30']++;return b+c;}else{__cov_YIovT6krughe2nlH0KPcnA.b['9'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['31']++;if(!p){__cov_YIovT6krughe2nlH0KPcnA.b['10'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['32']++;p=d*0.3;}else{__cov_YIovT6krughe2nlH0KPcnA.b['10'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['33']++;if((__cov_YIovT6krughe2nlH0KPcnA.b['12'][0]++,!a)||(__cov_YIovT6krughe2nlH0KPcnA.b['12'][1]++,a<Math.abs(c))){__cov_YIovT6krughe2nlH0KPcnA.b['11'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['34']++;a=c;__cov_YIovT6krughe2nlH0KPcnA.s['35']++;s=p/4;}else{__cov_YIovT6krughe2nlH0KPcnA.b['11'][1]++;__cov_YIovT6krughe2nlH0KPcnA.s['36']++;s=p/(2*Math.PI)*Math.asin(c/a);}__cov_YIovT6krughe2nlH0KPcnA.s['37']++;return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},elasticBoth:function(t,b,c,d,a,p){__cov_YIovT6krughe2nlH0KPcnA.f['11']++;__cov_YIovT6krughe2nlH0KPcnA.s['38']++;var s;__cov_YIovT6krughe2nlH0KPcnA.s['39']++;if(t===0){__cov_YIovT6krughe2nlH0KPcnA.b['13'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['40']++;return b;}else{__cov_YIovT6krughe2nlH0KPcnA.b['13'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['41']++;if((t/=d/2)===2){__cov_YIovT6krughe2nlH0KPcnA.b['14'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['42']++;return b+c;}else{__cov_YIovT6krughe2nlH0KPcnA.b['14'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['43']++;if(!p){__cov_YIovT6krughe2nlH0KPcnA.b['15'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['44']++;p=d*(0.3*1.5);}else{__cov_YIovT6krughe2nlH0KPcnA.b['15'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['45']++;if((__cov_YIovT6krughe2nlH0KPcnA.b['17'][0]++,!a)||(__cov_YIovT6krughe2nlH0KPcnA.b['17'][1]++,a<Math.abs(c))){__cov_YIovT6krughe2nlH0KPcnA.b['16'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['46']++;a=c;__cov_YIovT6krughe2nlH0KPcnA.s['47']++;s=p/4;}else{__cov_YIovT6krughe2nlH0KPcnA.b['16'][1]++;__cov_YIovT6krughe2nlH0KPcnA.s['48']++;s=p/(2*Math.PI)*Math.asin(c/a);}__cov_YIovT6krughe2nlH0KPcnA.s['49']++;if(t<1){__cov_YIovT6krughe2nlH0KPcnA.b['18'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['50']++;return-0.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;}else{__cov_YIovT6krughe2nlH0KPcnA.b['18'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['51']++;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*0.5+c+b;},backIn:function(t,b,c,d,s){__cov_YIovT6krughe2nlH0KPcnA.f['12']++;__cov_YIovT6krughe2nlH0KPcnA.s['52']++;if(s===undefined){__cov_YIovT6krughe2nlH0KPcnA.b['19'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['53']++;s=1.70158;}else{__cov_YIovT6krughe2nlH0KPcnA.b['19'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['54']++;if(t===d){__cov_YIovT6krughe2nlH0KPcnA.b['20'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['55']++;t-=0.001;}else{__cov_YIovT6krughe2nlH0KPcnA.b['20'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['56']++;return c*(t/=d)*t*((s+1)*t-s)+b;},backOut:function(t,b,c,d,s){__cov_YIovT6krughe2nlH0KPcnA.f['13']++;__cov_YIovT6krughe2nlH0KPcnA.s['57']++;if(typeof s==='undefined'){__cov_YIovT6krughe2nlH0KPcnA.b['21'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['58']++;s=1.70158;}else{__cov_YIovT6krughe2nlH0KPcnA.b['21'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['59']++;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backBoth:function(t,b,c,d,s){__cov_YIovT6krughe2nlH0KPcnA.f['14']++;__cov_YIovT6krughe2nlH0KPcnA.s['60']++;if(typeof s==='undefined'){__cov_YIovT6krughe2nlH0KPcnA.b['22'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['61']++;s=1.70158;}else{__cov_YIovT6krughe2nlH0KPcnA.b['22'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['62']++;if((t/=d/2)<1){__cov_YIovT6krughe2nlH0KPcnA.b['23'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['63']++;return c/2*(t*t*(((s*=1.525)+1)*t-s))+b;}else{__cov_YIovT6krughe2nlH0KPcnA.b['23'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['64']++;return c/2*((t-=2)*t*(((s*=1.525)+1)*t+s)+2)+b;},bounceIn:function(t,b,c,d){__cov_YIovT6krughe2nlH0KPcnA.f['15']++;__cov_YIovT6krughe2nlH0KPcnA.s['65']++;return c-Y.Easing.bounceOut(d-t,0,c,d)+b;},bounceOut:function(t,b,c,d){__cov_YIovT6krughe2nlH0KPcnA.f['16']++;__cov_YIovT6krughe2nlH0KPcnA.s['66']++;if((t/=d)<1/2.75){__cov_YIovT6krughe2nlH0KPcnA.b['24'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['67']++;return c*(7.5625*t*t)+b;}else{__cov_YIovT6krughe2nlH0KPcnA.b['24'][1]++;__cov_YIovT6krughe2nlH0KPcnA.s['68']++;if(t<2/2.75){__cov_YIovT6krughe2nlH0KPcnA.b['25'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['69']++;return c*(7.5625*(t-=1.5/2.75)*t+0.75)+b;}else{__cov_YIovT6krughe2nlH0KPcnA.b['25'][1]++;__cov_YIovT6krughe2nlH0KPcnA.s['70']++;if(t<2.5/2.75){__cov_YIovT6krughe2nlH0KPcnA.b['26'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['71']++;return c*(7.5625*(t-=2.25/2.75)*t+0.9375)+b;}else{__cov_YIovT6krughe2nlH0KPcnA.b['26'][1]++;}}}__cov_YIovT6krughe2nlH0KPcnA.s['72']++;return c*(7.5625*(t-=2.625/2.75)*t+0.984375)+b;},bounceBoth:function(t,b,c,d){__cov_YIovT6krughe2nlH0KPcnA.f['17']++;__cov_YIovT6krughe2nlH0KPcnA.s['73']++;if(t<d/2){__cov_YIovT6krughe2nlH0KPcnA.b['27'][0]++;__cov_YIovT6krughe2nlH0KPcnA.s['74']++;return Y.Easing.bounceIn(t*2,0,c,d)*0.5+b;}else{__cov_YIovT6krughe2nlH0KPcnA.b['27'][1]++;}__cov_YIovT6krughe2nlH0KPcnA.s['75']++;return Y.Easing.bounceOut(t*2-d,0,c,d)*0.5+c*0.5+b;}};__cov_YIovT6krughe2nlH0KPcnA.s['76']++;Y.Easing=Easing;},'@VERSION@',{'requires':['anim-base']});
Rich-Harris/cdnjs
ajax/libs/yui/3.11.0/anim-easing/anim-easing-coverage.js
JavaScript
mit
34,376
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/attribute-base/attribute-base.js']) { __coverage__['build/attribute-base/attribute-base.js'] = {"path":"build/attribute-base/attribute-base.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},"b":{},"f":{"1":0,"2":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":45}}},"2":{"name":"Attribute","line":56,"loc":{"start":{"line":56,"column":4},"end":{"line":56,"column":25}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":110,"column":94}},"2":{"start":{"line":56,"column":4},"end":{"line":60,"column":5}},"3":{"start":{"line":57,"column":8},"end":{"line":57,"column":47}},"4":{"start":{"line":58,"column":8},"end":{"line":58,"column":53}},"5":{"start":{"line":59,"column":8},"end":{"line":59,"column":49}},"6":{"start":{"line":62,"column":4},"end":{"line":62,"column":54}},"7":{"start":{"line":63,"column":4},"end":{"line":63,"column":56}},"8":{"start":{"line":66,"column":4},"end":{"line":66,"column":59}},"9":{"start":{"line":80,"column":4},"end":{"line":80,"column":60}},"10":{"start":{"line":94,"column":4},"end":{"line":94,"column":92}},"11":{"start":{"line":105,"column":4},"end":{"line":105,"column":58}},"12":{"start":{"line":107,"column":4},"end":{"line":107,"column":28}}},"branchMap":{},"code":["(function () { YUI.add('attribute-base', function (Y, NAME) {",""," /**"," * The attribute module provides an augmentable Attribute implementation, which"," * adds configurable attributes and attribute change events to the class being"," * augmented. It also provides a State class, which is used internally by Attribute,"," * but can also be used independently to provide a name/property/value data structure to"," * store state."," *"," * @module attribute"," */",""," /**"," * The attribute-base submodule provides core attribute handling support, with everything"," * aside from complex attribute handling in the provider's constructor."," *"," * @module attribute"," * @submodule attribute-base"," */",""," /**"," * <p>"," * Attribute provides configurable attribute support along with attribute change events. It is designed to be"," * augmented on to a host class, and provides the host with the ability to configure attributes to store and retrieve state,"," * along with attribute change events."," * </p>"," * <p>For example, attributes added to the host can be configured:</p>"," * <ul>"," * <li>As read only.</li>"," * <li>As write once.</li>"," * <li>With a setter function, which can be used to manipulate"," * values passed to Attribute's <a href=\"#method_set\">set</a> method, before they are stored.</li>"," * <li>With a getter function, which can be used to manipulate stored values,"," * before they are returned by Attribute's <a href=\"#method_get\">get</a> method.</li>"," * <li>With a validator function, to validate values before they are stored.</li>"," * </ul>"," *"," * <p>See the <a href=\"#method_addAttr\">addAttr</a> method, for the complete set of configuration"," * options available for attributes.</p>"," *"," * <p><strong>NOTE:</strong> Most implementations will be better off extending the <a href=\"Base.html\">Base</a> class,"," * instead of augmenting Attribute directly. Base augments Attribute and will handle the initial configuration"," * of attributes for derived classes, accounting for values passed into the constructor.</p>"," *"," * @class Attribute"," * @param attrs {Object} The attributes to add during construction (passed through to <a href=\"#method_addAttrs\">addAttrs</a>)."," * These can also be defined on the constructor being augmented with Attribute by defining the ATTRS property on the constructor."," * @param values {Object} The initial attribute values to apply (passed through to <a href=\"#method_addAttrs\">addAttrs</a>)."," * These are not merged/cloned. The caller is responsible for isolating user provided values if required."," * @param lazy {boolean} Whether or not to add attributes lazily (passed through to <a href=\"#method_addAttrs\">addAttrs</a>)."," * @uses AttributeCore"," * @uses AttributeObservable"," * @uses EventTarget"," * @uses AttributeExtras"," */"," function Attribute() {"," Y.AttributeCore.apply(this, arguments);"," Y.AttributeObservable.apply(this, arguments);"," Y.AttributeExtras.apply(this, arguments);"," }",""," Y.mix(Attribute, Y.AttributeCore, false, null, 1);"," Y.mix(Attribute, Y.AttributeExtras, false, null, 1);",""," // Needs to be `true`, to overwrite methods from AttributeCore"," Y.mix(Attribute, Y.AttributeObservable, true, null, 1);",""," /**"," * <p>The value to return from an attribute setter in order to prevent the set from going through.</p>"," *"," * <p>You can return this value from your setter if you wish to combine validator and setter"," * functionality into a single setter function, which either returns the massaged value to be stored or"," * AttributeCore.INVALID_VALUE to prevent invalid values from being stored.</p>"," *"," * @property INVALID_VALUE"," * @type Object"," * @static"," * @final"," */"," Attribute.INVALID_VALUE = Y.AttributeCore.INVALID_VALUE;",""," /**"," * The list of properties which can be configured for"," * each attribute (e.g. setter, getter, writeOnce etc.)."," *"," * This property is used internally as a whitelist for faster"," * Y.mix operations."," *"," * @property _ATTR_CFG"," * @type Array"," * @static"," * @protected"," */"," Attribute._ATTR_CFG = Y.AttributeCore._ATTR_CFG.concat(Y.AttributeObservable._ATTR_CFG);",""," /**"," * Utility method to protect an attribute configuration hash, by merging the"," * entire object and the individual attr config objects."," *"," * @method protectAttrs"," * @static"," * @param {Object} attrs A hash of attribute to configuration object pairs."," * @return {Object} A protected version of the `attrs` argument."," */"," Attribute.protectAttrs = Y.AttributeCore.protectAttrs;",""," Y.Attribute = Attribute;","","","}, '@VERSION@', {\"requires\": [\"attribute-core\", \"attribute-observable\", \"attribute-extras\"]});","","}());"]}; } var __cov_TuK8t1Q8XNmzTnaQZscKQQ = __coverage__['build/attribute-base/attribute-base.js']; __cov_TuK8t1Q8XNmzTnaQZscKQQ.s['1']++;YUI.add('attribute-base',function(Y,NAME){__cov_TuK8t1Q8XNmzTnaQZscKQQ.f['1']++;__cov_TuK8t1Q8XNmzTnaQZscKQQ.s['2']++;function Attribute(){__cov_TuK8t1Q8XNmzTnaQZscKQQ.f['2']++;__cov_TuK8t1Q8XNmzTnaQZscKQQ.s['3']++;Y.AttributeCore.apply(this,arguments);__cov_TuK8t1Q8XNmzTnaQZscKQQ.s['4']++;Y.AttributeObservable.apply(this,arguments);__cov_TuK8t1Q8XNmzTnaQZscKQQ.s['5']++;Y.AttributeExtras.apply(this,arguments);}__cov_TuK8t1Q8XNmzTnaQZscKQQ.s['6']++;Y.mix(Attribute,Y.AttributeCore,false,null,1);__cov_TuK8t1Q8XNmzTnaQZscKQQ.s['7']++;Y.mix(Attribute,Y.AttributeExtras,false,null,1);__cov_TuK8t1Q8XNmzTnaQZscKQQ.s['8']++;Y.mix(Attribute,Y.AttributeObservable,true,null,1);__cov_TuK8t1Q8XNmzTnaQZscKQQ.s['9']++;Attribute.INVALID_VALUE=Y.AttributeCore.INVALID_VALUE;__cov_TuK8t1Q8XNmzTnaQZscKQQ.s['10']++;Attribute._ATTR_CFG=Y.AttributeCore._ATTR_CFG.concat(Y.AttributeObservable._ATTR_CFG);__cov_TuK8t1Q8XNmzTnaQZscKQQ.s['11']++;Attribute.protectAttrs=Y.AttributeCore.protectAttrs;__cov_TuK8t1Q8XNmzTnaQZscKQQ.s['12']++;Y.Attribute=Attribute;},'@VERSION@',{'requires':['attribute-core','attribute-observable','attribute-extras']});
mfregoe/cdnjs
ajax/libs/yui/3.10.1/attribute-base/attribute-base-coverage.js
JavaScript
mit
7,847
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/io-queue/io-queue.js']) { __coverage__['build/io-queue/io-queue.js'] = {"path":"build/io-queue/io-queue.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},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[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},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":39}}},"2":{"name":"(anonymous_2)","line":45,"loc":{"start":{"line":45,"column":13},"end":{"line":45,"column":24}}},"3":{"name":"(anonymous_3)","line":62,"loc":{"start":{"line":62,"column":11},"end":{"line":62,"column":28}}},"4":{"name":"(anonymous_4)","line":67,"loc":{"start":{"line":67,"column":32},"end":{"line":67,"column":48}}},"5":{"name":"(anonymous_5)","line":79,"loc":{"start":{"line":79,"column":12},"end":{"line":79,"column":25}}},"6":{"name":"(anonymous_6)","line":93,"loc":{"start":{"line":93,"column":14},"end":{"line":93,"column":26}}},"7":{"name":"(anonymous_7)","line":105,"loc":{"start":{"line":105,"column":13},"end":{"line":105,"column":25}}},"8":{"name":"(anonymous_8)","line":117,"loc":{"start":{"line":117,"column":12},"end":{"line":117,"column":23}}},"9":{"name":"(anonymous_9)","line":121,"loc":{"start":{"line":121,"column":12},"end":{"line":121,"column":23}}},"10":{"name":"(anonymous_10)","line":139,"loc":{"start":{"line":139,"column":11},"end":{"line":139,"column":22}}},"11":{"name":"(anonymous_11)","line":151,"loc":{"start":{"line":151,"column":11},"end":{"line":151,"column":22}}},"12":{"name":"_queue","line":157,"loc":{"start":{"line":157,"column":0},"end":{"line":157,"column":22}}},"13":{"name":"(anonymous_13)","line":161,"loc":{"start":{"line":161,"column":15},"end":{"line":161,"column":27}}},"14":{"name":"(anonymous_14)","line":162,"loc":{"start":{"line":162,"column":14},"end":{"line":162,"column":26}}},"15":{"name":"(anonymous_15)","line":163,"loc":{"start":{"line":163,"column":17},"end":{"line":163,"column":30}}},"16":{"name":"(anonymous_16)","line":164,"loc":{"start":{"line":164,"column":16},"end":{"line":164,"column":29}}},"17":{"name":"(anonymous_17)","line":165,"loc":{"start":{"line":165,"column":14},"end":{"line":165,"column":26}}},"18":{"name":"(anonymous_18)","line":166,"loc":{"start":{"line":166,"column":15},"end":{"line":166,"column":27}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":170,"column":60}},"2":{"start":{"line":10,"column":0},"end":{"line":10,"column":41}},"3":{"start":{"line":12,"column":0},"end":{"line":155,"column":9}},"4":{"start":{"line":46,"column":8},"end":{"line":47,"column":29}},"5":{"start":{"line":49,"column":8},"end":{"line":49,"column":29}},"6":{"start":{"line":50,"column":8},"end":{"line":50,"column":23}},"7":{"start":{"line":51,"column":8},"end":{"line":51,"column":36}},"8":{"start":{"line":63,"column":8},"end":{"line":64,"column":52}},"9":{"start":{"line":66,"column":8},"end":{"line":69,"column":9}},"10":{"start":{"line":67,"column":12},"end":{"line":67,"column":72}},"11":{"start":{"line":67,"column":50},"end":{"line":67,"column":64}},"12":{"start":{"line":68,"column":12},"end":{"line":68,"column":29}},"13":{"start":{"line":71,"column":8},"end":{"line":71,"column":21}},"14":{"start":{"line":72,"column":8},"end":{"line":74,"column":9}},"15":{"start":{"line":73,"column":12},"end":{"line":73,"column":25}},"16":{"start":{"line":76,"column":8},"end":{"line":76,"column":17}},"17":{"start":{"line":80,"column":8},"end":{"line":80,"column":22}},"18":{"start":{"line":81,"column":8},"end":{"line":81,"column":23}},"19":{"start":{"line":82,"column":8},"end":{"line":84,"column":9}},"20":{"start":{"line":83,"column":12},"end":{"line":83,"column":25}},"21":{"start":{"line":94,"column":8},"end":{"line":94,"column":27}},"22":{"start":{"line":106,"column":8},"end":{"line":106,"column":26}},"23":{"start":{"line":118,"column":8},"end":{"line":118,"column":32}},"24":{"start":{"line":122,"column":8},"end":{"line":122,"column":22}},"25":{"start":{"line":123,"column":8},"end":{"line":123,"column":23}},"26":{"start":{"line":125,"column":8},"end":{"line":127,"column":9}},"27":{"start":{"line":126,"column":12},"end":{"line":126,"column":25}},"28":{"start":{"line":140,"column":8},"end":{"line":140,"column":25}},"29":{"start":{"line":152,"column":8},"end":{"line":152,"column":30}},"30":{"start":{"line":157,"column":0},"end":{"line":159,"column":1}},"31":{"start":{"line":158,"column":4},"end":{"line":158,"column":38}},"32":{"start":{"line":161,"column":0},"end":{"line":161,"column":44}},"33":{"start":{"line":161,"column":29},"end":{"line":161,"column":41}},"34":{"start":{"line":162,"column":0},"end":{"line":162,"column":42}},"35":{"start":{"line":162,"column":28},"end":{"line":162,"column":39}},"36":{"start":{"line":163,"column":0},"end":{"line":163,"column":50}},"37":{"start":{"line":163,"column":32},"end":{"line":163,"column":47}},"38":{"start":{"line":164,"column":0},"end":{"line":164,"column":48}},"39":{"start":{"line":164,"column":31},"end":{"line":164,"column":45}},"40":{"start":{"line":165,"column":0},"end":{"line":165,"column":42}},"41":{"start":{"line":165,"column":28},"end":{"line":165,"column":39}},"42":{"start":{"line":166,"column":0},"end":{"line":166,"column":44}},"43":{"start":{"line":166,"column":29},"end":{"line":166,"column":41}},"44":{"start":{"line":167,"column":0},"end":{"line":167,"column":20}}},"branchMap":{"1":{"line":10,"type":"binary-expr","locations":[{"start":{"line":10,"column":9},"end":{"line":10,"column":26}},{"start":{"line":10,"column":30},"end":{"line":10,"column":40}}]},"2":{"line":66,"type":"if","locations":[{"start":{"line":66,"column":8},"end":{"line":66,"column":8}},{"start":{"line":66,"column":8},"end":{"line":66,"column":8}}]},"3":{"line":72,"type":"if","locations":[{"start":{"line":72,"column":8},"end":{"line":72,"column":8}},{"start":{"line":72,"column":8},"end":{"line":72,"column":8}}]},"4":{"line":82,"type":"if","locations":[{"start":{"line":82,"column":8},"end":{"line":82,"column":8}},{"start":{"line":82,"column":8},"end":{"line":82,"column":8}}]},"5":{"line":82,"type":"binary-expr","locations":[{"start":{"line":82,"column":12},"end":{"line":82,"column":32}},{"start":{"line":82,"column":36},"end":{"line":82,"column":52}}]},"6":{"line":125,"type":"if","locations":[{"start":{"line":125,"column":8},"end":{"line":125,"column":8}},{"start":{"line":125,"column":8},"end":{"line":125,"column":8}}]}},"code":["(function () { YUI.add('io-queue', function (Y, NAME) {","","/**","Extends IO to implement Queue for synchronous","transaction processing.","@module io","@submodule io-queue","@for IO","**/","var io = Y.io._map['io:0'] || new Y.IO();","","Y.mix(Y.IO.prototype, {"," /**"," * Array of transactions queued for processing"," *"," * @property _q"," * @private"," * @static"," * @type {Object}"," */"," _q: new Y.Queue(),"," _qActiveId: null,"," _qInit: false,",""," /**"," * Property to determine whether the queue is set to"," * 1 (active) or 0 (inactive). When inactive, transactions"," * will be stored in the queue until the queue is set to active."," *"," * @property _qState"," * @private"," * @static"," * @type {Number}"," */"," _qState: 1,",""," /**"," * Method Process the first transaction from the"," * queue in FIFO order."," *"," * @method _qShift"," * @private"," * @static"," */"," _qShift: function() {"," var io = this,"," o = io._q.next();",""," io._qActiveId = o.id;"," io._qState = 0;"," io.send(o.uri, o.cfg, o.id);"," },",""," /**"," * Method for queueing a transaction before the request is sent to the"," * resource, to ensure sequential processing."," *"," * @method queue"," * @static"," * @return {Object}"," */"," queue: function(uri, c) {"," var io = this,"," o = { uri: uri, cfg:c, id: this._id++ };",""," if(!io._qInit) {"," Y.on('io:complete', function(id, o) { io._qNext(id); }, io);"," io._qInit = true;"," }",""," io._q.add(o);"," if (io._qState === 1) {"," io._qShift();"," }",""," return o;"," },",""," _qNext: function(id) {"," var io = this;"," io._qState = 1;"," if (io._qActiveId === id && io._q.size() > 0) {"," io._qShift();"," }"," },",""," /**"," * Method for promoting a transaction to the top of the queue."," *"," * @method promote"," * @static"," */"," qPromote: function(o) {"," this._q.promote(o);"," },",""," /**"," * Method for removing a specific, pending transaction from"," * the queue."," *"," * @method remove"," * @private"," * @static"," */"," qRemove: function(o) {"," this._q.remove(o);"," },",""," /**"," * Method for cancel all pending transaction from"," * the queue."," *"," * @method empty"," * @static"," * @since 3.7.3"," */"," qEmpty: function() {"," this._q = new Y.Queue();"," },",""," qStart: function() {"," var io = this;"," io._qState = 1;",""," if (io._q.size() > 0) {"," io._qShift();"," }"," },",""," /**"," * Method for setting queue processing to inactive."," * Transaction requests to YUI.io.queue() will be stored in the queue, but"," * not processed until the queue is reset to \"active\"."," *"," * @method _stop"," * @private"," * @static"," */"," qStop: function() {"," this._qState = 0;"," },",""," /**"," * Method to query the current size of the queue."," *"," * @method _size"," * @private"," * @static"," * @return {Number}"," */"," qSize: function() {"," return this._q.size();"," }","","}, true);","","function _queue(u, c) {"," return io.queue.apply(io, [u, c]);","}","","_queue.start = function () { io.qStart(); };","_queue.stop = function () { io.qStop(); };","_queue.promote = function (o) { io.qPromote(o); };","_queue.remove = function (o) { io.qRemove(o); };","_queue.size = function () { io.qSize(); };","_queue.empty = function () { io.qEmpty(); };","Y.io.queue = _queue;","","","}, '@VERSION@', {\"requires\": [\"io-base\", \"queue-promote\"]});","","}());"]}; } var __cov_gCvC4RVEtFMbkP8iDe0dhw = __coverage__['build/io-queue/io-queue.js']; __cov_gCvC4RVEtFMbkP8iDe0dhw.s['1']++;YUI.add('io-queue',function(Y,NAME){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['1']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['2']++;var io=(__cov_gCvC4RVEtFMbkP8iDe0dhw.b['1'][0]++,Y.io._map['io:0'])||(__cov_gCvC4RVEtFMbkP8iDe0dhw.b['1'][1]++,new Y.IO());__cov_gCvC4RVEtFMbkP8iDe0dhw.s['3']++;Y.mix(Y.IO.prototype,{_q:new Y.Queue(),_qActiveId:null,_qInit:false,_qState:1,_qShift:function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['2']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['4']++;var io=this,o=io._q.next();__cov_gCvC4RVEtFMbkP8iDe0dhw.s['5']++;io._qActiveId=o.id;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['6']++;io._qState=0;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['7']++;io.send(o.uri,o.cfg,o.id);},queue:function(uri,c){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['3']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['8']++;var io=this,o={uri:uri,cfg:c,id:this._id++};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['9']++;if(!io._qInit){__cov_gCvC4RVEtFMbkP8iDe0dhw.b['2'][0]++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['10']++;Y.on('io:complete',function(id,o){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['4']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['11']++;io._qNext(id);},io);__cov_gCvC4RVEtFMbkP8iDe0dhw.s['12']++;io._qInit=true;}else{__cov_gCvC4RVEtFMbkP8iDe0dhw.b['2'][1]++;}__cov_gCvC4RVEtFMbkP8iDe0dhw.s['13']++;io._q.add(o);__cov_gCvC4RVEtFMbkP8iDe0dhw.s['14']++;if(io._qState===1){__cov_gCvC4RVEtFMbkP8iDe0dhw.b['3'][0]++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['15']++;io._qShift();}else{__cov_gCvC4RVEtFMbkP8iDe0dhw.b['3'][1]++;}__cov_gCvC4RVEtFMbkP8iDe0dhw.s['16']++;return o;},_qNext:function(id){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['5']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['17']++;var io=this;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['18']++;io._qState=1;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['19']++;if((__cov_gCvC4RVEtFMbkP8iDe0dhw.b['5'][0]++,io._qActiveId===id)&&(__cov_gCvC4RVEtFMbkP8iDe0dhw.b['5'][1]++,io._q.size()>0)){__cov_gCvC4RVEtFMbkP8iDe0dhw.b['4'][0]++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['20']++;io._qShift();}else{__cov_gCvC4RVEtFMbkP8iDe0dhw.b['4'][1]++;}},qPromote:function(o){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['6']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['21']++;this._q.promote(o);},qRemove:function(o){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['7']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['22']++;this._q.remove(o);},qEmpty:function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['8']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['23']++;this._q=new Y.Queue();},qStart:function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['9']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['24']++;var io=this;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['25']++;io._qState=1;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['26']++;if(io._q.size()>0){__cov_gCvC4RVEtFMbkP8iDe0dhw.b['6'][0]++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['27']++;io._qShift();}else{__cov_gCvC4RVEtFMbkP8iDe0dhw.b['6'][1]++;}},qStop:function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['10']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['28']++;this._qState=0;},qSize:function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['11']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['29']++;return this._q.size();}},true);__cov_gCvC4RVEtFMbkP8iDe0dhw.s['30']++;function _queue(u,c){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['12']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['31']++;return io.queue.apply(io,[u,c]);}__cov_gCvC4RVEtFMbkP8iDe0dhw.s['32']++;_queue.start=function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['13']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['33']++;io.qStart();};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['34']++;_queue.stop=function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['14']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['35']++;io.qStop();};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['36']++;_queue.promote=function(o){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['15']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['37']++;io.qPromote(o);};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['38']++;_queue.remove=function(o){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['16']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['39']++;io.qRemove(o);};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['40']++;_queue.size=function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['17']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['41']++;io.qSize();};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['42']++;_queue.empty=function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['18']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['43']++;io.qEmpty();};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['44']++;Y.io.queue=_queue;},'@VERSION@',{'requires':['io-base','queue-promote']});
ddeveloperr/cdnjs
ajax/libs/yui/3.14.1/io-queue/io-queue-coverage.js
JavaScript
mit
14,915
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/array-invoke/array-invoke.js']) { __coverage__['build/array-invoke/array-invoke.js'] = {"path":"build/array-invoke/array-invoke.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0},"b":{"1":[0,0],"2":[0,0]},"f":{"1":0,"2":0,"3":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":43}}},"2":{"name":"(anonymous_2)","line":25,"loc":{"start":{"line":25,"column":17},"end":{"line":25,"column":39}}},"3":{"name":"(anonymous_3)","line":30,"loc":{"start":{"line":30,"column":33},"end":{"line":30,"column":51}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":40,"column":44}},"2":{"start":{"line":25,"column":0},"end":{"line":37,"column":2}},"3":{"start":{"line":26,"column":4},"end":{"line":28,"column":17}},"4":{"start":{"line":30,"column":4},"end":{"line":34,"column":7}},"5":{"start":{"line":31,"column":8},"end":{"line":33,"column":9}},"6":{"start":{"line":32,"column":12},"end":{"line":32,"column":50}},"7":{"start":{"line":36,"column":4},"end":{"line":36,"column":15}}},"branchMap":{"1":{"line":31,"type":"if","locations":[{"start":{"line":31,"column":8},"end":{"line":31,"column":8}},{"start":{"line":31,"column":8},"end":{"line":31,"column":8}}]},"2":{"line":31,"type":"binary-expr","locations":[{"start":{"line":31,"column":12},"end":{"line":31,"column":16}},{"start":{"line":31,"column":20},"end":{"line":31,"column":42}}]}},"code":["(function () { YUI.add('array-invoke', function (Y, NAME) {","","/**","@module collection","@submodule array-invoke","*/","","/**","Executes a named method on each item in an array of objects. Items in the array","that do not have a function by that name will be skipped.","","@example",""," Y.Array.invoke(arrayOfDrags, 'plug', Y.Plugin.DDProxy);","","@method invoke","@param {Array} items Array of objects supporting the named method.","@param {String} name the name of the method to execute on each item.","@param {Any} [args*] Any number of additional args are passed as parameters to"," the execution of the named method.","@return {Array} All return values, indexed according to the item index.","@static","@for Array","**/","Y.Array.invoke = function(items, name) {"," var args = Y.Array(arguments, 2, true),"," isFunction = Y.Lang.isFunction,"," ret = [];",""," Y.Array.each(Y.Array(items), function(item, i) {"," if (item && isFunction(item[name])) {"," ret[i] = item[name].apply(item, args);"," }"," });",""," return ret;","};","","","}, '@VERSION@', {\"requires\": [\"yui-base\"]});","","}());"]}; } var __cov_jzpBudDVuwfbMKlQApgQBA = __coverage__['build/array-invoke/array-invoke.js']; __cov_jzpBudDVuwfbMKlQApgQBA.s['1']++;YUI.add('array-invoke',function(Y,NAME){__cov_jzpBudDVuwfbMKlQApgQBA.f['1']++;__cov_jzpBudDVuwfbMKlQApgQBA.s['2']++;Y.Array.invoke=function(items,name){__cov_jzpBudDVuwfbMKlQApgQBA.f['2']++;__cov_jzpBudDVuwfbMKlQApgQBA.s['3']++;var args=Y.Array(arguments,2,true),isFunction=Y.Lang.isFunction,ret=[];__cov_jzpBudDVuwfbMKlQApgQBA.s['4']++;Y.Array.each(Y.Array(items),function(item,i){__cov_jzpBudDVuwfbMKlQApgQBA.f['3']++;__cov_jzpBudDVuwfbMKlQApgQBA.s['5']++;if((__cov_jzpBudDVuwfbMKlQApgQBA.b['2'][0]++,item)&&(__cov_jzpBudDVuwfbMKlQApgQBA.b['2'][1]++,isFunction(item[name]))){__cov_jzpBudDVuwfbMKlQApgQBA.b['1'][0]++;__cov_jzpBudDVuwfbMKlQApgQBA.s['6']++;ret[i]=item[name].apply(item,args);}else{__cov_jzpBudDVuwfbMKlQApgQBA.b['1'][1]++;}});__cov_jzpBudDVuwfbMKlQApgQBA.s['7']++;return ret;};},'@VERSION@',{'requires':['yui-base']});
sujonvidia/cdnjs
ajax/libs/yui/3.18.1/array-invoke/array-invoke-coverage.js
JavaScript
mit
3,633
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/view/view.js']) { __coverage__['build/view/view.js'] = {"path":"build/view/view.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},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,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]},"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},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":35}}},"2":{"name":"View","line":35,"loc":{"start":{"line":35,"column":0},"end":{"line":35,"column":16}}},"3":{"name":"(anonymous_3)","line":128,"loc":{"start":{"line":128,"column":17},"end":{"line":128,"column":35}}},"4":{"name":"(anonymous_4)","line":161,"loc":{"start":{"line":161,"column":13},"end":{"line":161,"column":32}}},"5":{"name":"(anonymous_5)","line":168,"loc":{"start":{"line":168,"column":38},"end":{"line":168,"column":50}}},"6":{"name":"(anonymous_6)","line":176,"loc":{"start":{"line":176,"column":16},"end":{"line":176,"column":28}}},"7":{"name":"(anonymous_7)","line":197,"loc":{"start":{"line":197,"column":18},"end":{"line":197,"column":36}}},"8":{"name":"(anonymous_8)","line":249,"loc":{"start":{"line":249,"column":12},"end":{"line":249,"column":33}}},"9":{"name":"(anonymous_9)","line":262,"loc":{"start":{"line":262,"column":18},"end":{"line":262,"column":30}}},"10":{"name":"(anonymous_10)","line":263,"loc":{"start":{"line":263,"column":47},"end":{"line":263,"column":65}}},"11":{"name":"(anonymous_11)","line":280,"loc":{"start":{"line":280,"column":12},"end":{"line":280,"column":24}}},"12":{"name":"(anonymous_12)","line":307,"loc":{"start":{"line":307,"column":12},"end":{"line":307,"column":24}}},"13":{"name":"(anonymous_13)","line":319,"loc":{"start":{"line":319,"column":23},"end":{"line":319,"column":35}}},"14":{"name":"(anonymous_14)","line":333,"loc":{"start":{"line":333,"column":19},"end":{"line":333,"column":36}}},"15":{"name":"(anonymous_15)","line":370,"loc":{"start":{"line":370,"column":27},"end":{"line":370,"column":39}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":433,"column":69}},"2":{"start":{"line":35,"column":0},"end":{"line":37,"column":1}},"3":{"start":{"line":36,"column":4},"end":{"line":36,"column":55}},"4":{"start":{"line":39,"column":0},"end":{"line":429,"column":3}},"5":{"start":{"line":129,"column":8},"end":{"line":129,"column":32}},"6":{"start":{"line":132,"column":8},"end":{"line":133,"column":64}},"7":{"start":{"line":135,"column":8},"end":{"line":135,"column":61}},"8":{"start":{"line":138,"column":8},"end":{"line":139,"column":24}},"9":{"start":{"line":145,"column":8},"end":{"line":145,"column":66}},"10":{"start":{"line":163,"column":8},"end":{"line":171,"column":9}},"11":{"start":{"line":168,"column":12},"end":{"line":170,"column":15}},"12":{"start":{"line":169,"column":16},"end":{"line":169,"column":41}},"13":{"start":{"line":173,"column":8},"end":{"line":173,"column":50}},"14":{"start":{"line":177,"column":8},"end":{"line":177,"column":28}},"15":{"start":{"line":178,"column":8},"end":{"line":178,"column":31}},"16":{"start":{"line":198,"column":8},"end":{"line":200,"column":46}},"17":{"start":{"line":202,"column":8},"end":{"line":202,"column":28}},"18":{"start":{"line":204,"column":8},"end":{"line":204,"column":41}},"19":{"start":{"line":206,"column":8},"end":{"line":229,"column":9}},"20":{"start":{"line":207,"column":12},"end":{"line":207,"column":54}},"21":{"start":{"line":207,"column":43},"end":{"line":207,"column":52}},"22":{"start":{"line":209,"column":12},"end":{"line":209,"column":40}},"23":{"start":{"line":211,"column":12},"end":{"line":228,"column":13}},"24":{"start":{"line":212,"column":16},"end":{"line":212,"column":56}},"25":{"start":{"line":212,"column":45},"end":{"line":212,"column":54}},"26":{"start":{"line":214,"column":16},"end":{"line":214,"column":41}},"27":{"start":{"line":218,"column":16},"end":{"line":220,"column":17}},"28":{"start":{"line":219,"column":20},"end":{"line":219,"column":44}},"29":{"start":{"line":222,"column":16},"end":{"line":224,"column":17}},"30":{"start":{"line":223,"column":20},"end":{"line":223,"column":29}},"31":{"start":{"line":226,"column":16},"end":{"line":227,"column":71}},"32":{"start":{"line":231,"column":8},"end":{"line":231,"column":20}},"33":{"start":{"line":250,"column":8},"end":{"line":251,"column":54}},"34":{"start":{"line":263,"column":8},"end":{"line":267,"column":11}},"35":{"start":{"line":264,"column":12},"end":{"line":266,"column":13}},"36":{"start":{"line":265,"column":16},"end":{"line":265,"column":32}},"37":{"start":{"line":269,"column":8},"end":{"line":269,"column":38}},"38":{"start":{"line":270,"column":8},"end":{"line":270,"column":20}},"39":{"start":{"line":281,"column":8},"end":{"line":281,"column":46}},"40":{"start":{"line":282,"column":8},"end":{"line":282,"column":40}},"41":{"start":{"line":283,"column":8},"end":{"line":283,"column":20}},"42":{"start":{"line":308,"column":8},"end":{"line":308,"column":20}},"43":{"start":{"line":320,"column":8},"end":{"line":320,"column":46}},"44":{"start":{"line":321,"column":8},"end":{"line":321,"column":44}},"45":{"start":{"line":338,"column":8},"end":{"line":351,"column":9}},"46":{"start":{"line":339,"column":12},"end":{"line":350,"column":13}},"47":{"start":{"line":342,"column":16},"end":{"line":342,"column":40}},"48":{"start":{"line":343,"column":16},"end":{"line":343,"column":36}},"49":{"start":{"line":348,"column":16},"end":{"line":348,"column":56}},"50":{"start":{"line":349,"column":16},"end":{"line":349,"column":46}},"51":{"start":{"line":353,"column":8},"end":{"line":353,"column":21}},"52":{"start":{"line":371,"column":8},"end":{"line":371,"column":39}}},"branchMap":{"1":{"line":129,"type":"binary-expr","locations":[{"start":{"line":129,"column":8},"end":{"line":129,"column":14}},{"start":{"line":129,"column":19},"end":{"line":129,"column":30}}]},"2":{"line":132,"type":"binary-expr","locations":[{"start":{"line":132,"column":8},"end":{"line":132,"column":32}},{"start":{"line":133,"column":13},"end":{"line":133,"column":62}}]},"3":{"line":135,"type":"binary-expr","locations":[{"start":{"line":135,"column":8},"end":{"line":135,"column":23}},{"start":{"line":135,"column":28},"end":{"line":135,"column":59}}]},"4":{"line":138,"type":"cond-expr","locations":[{"start":{"line":138,"column":38},"end":{"line":138,"column":73}},{"start":{"line":139,"column":12},"end":{"line":139,"column":23}}]},"5":{"line":163,"type":"if","locations":[{"start":{"line":163,"column":8},"end":{"line":163,"column":8}},{"start":{"line":163,"column":8},"end":{"line":163,"column":8}}]},"6":{"line":163,"type":"binary-expr","locations":[{"start":{"line":163,"column":12},"end":{"line":163,"column":19}},{"start":{"line":163,"column":24},"end":{"line":163,"column":38}},{"start":{"line":163,"column":42},"end":{"line":163,"column":59}}]},"7":{"line":204,"type":"binary-expr","locations":[{"start":{"line":204,"column":8},"end":{"line":204,"column":14}},{"start":{"line":204,"column":19},"end":{"line":204,"column":39}}]},"8":{"line":207,"type":"if","locations":[{"start":{"line":207,"column":12},"end":{"line":207,"column":12}},{"start":{"line":207,"column":12},"end":{"line":207,"column":12}}]},"9":{"line":212,"type":"if","locations":[{"start":{"line":212,"column":16},"end":{"line":212,"column":16}},{"start":{"line":212,"column":16},"end":{"line":212,"column":16}}]},"10":{"line":218,"type":"if","locations":[{"start":{"line":218,"column":16},"end":{"line":218,"column":16}},{"start":{"line":218,"column":16},"end":{"line":218,"column":16}}]},"11":{"line":222,"type":"if","locations":[{"start":{"line":222,"column":16},"end":{"line":222,"column":16}},{"start":{"line":222,"column":16},"end":{"line":222,"column":16}}]},"12":{"line":250,"type":"cond-expr","locations":[{"start":{"line":250,"column":27},"end":{"line":250,"column":43}},{"start":{"line":251,"column":16},"end":{"line":251,"column":53}}]},"13":{"line":264,"type":"if","locations":[{"start":{"line":264,"column":12},"end":{"line":264,"column":12}},{"start":{"line":264,"column":12},"end":{"line":264,"column":12}}]},"14":{"line":282,"type":"binary-expr","locations":[{"start":{"line":282,"column":8},"end":{"line":282,"column":17}},{"start":{"line":282,"column":21},"end":{"line":282,"column":39}}]},"15":{"line":321,"type":"binary-expr","locations":[{"start":{"line":321,"column":8},"end":{"line":321,"column":17}},{"start":{"line":321,"column":21},"end":{"line":321,"column":43}}]},"16":{"line":338,"type":"if","locations":[{"start":{"line":338,"column":8},"end":{"line":338,"column":8}},{"start":{"line":338,"column":8},"end":{"line":338,"column":8}}]},"17":{"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}}]}},"code":["(function () { YUI.add('view', function (Y, NAME) {","","/**","Represents a logical piece of an application's user interface, and provides a","lightweight, overridable API for rendering content and handling delegated DOM","events on a container element.","","@module app","@submodule view","@since 3.4.0","**/","","/**","Represents a logical piece of an application's user interface, and provides a","lightweight, overridable API for rendering content and handling delegated DOM","events on a container element.","","The View class imposes little structure and provides only minimal functionality","of its own: it's basically just an overridable API interface that helps you","implement custom views.","","As of YUI 3.5.0, View allows ad-hoc attributes to be specified at instantiation","time, so you don't need to subclass `Y.View` to add custom attributes. Just pass","them to the constructor:",""," var view = new Y.View({foo: 'bar'});"," view.get('foo'); // => \"bar\"","","@class View","@constructor","@extends Base","@since 3.4.0","**/","","function View() {"," View.superclass.constructor.apply(this, arguments);","}","","Y.View = Y.extend(View, Y.Base, {"," // -- Public Properties ----------------------------------------------------",""," /**"," Template for this view's container.",""," @property containerTemplate"," @type String"," @default \"<div/>\""," @since 3.5.0"," **/"," containerTemplate: '<div/>',",""," /**"," Hash of CSS selectors mapped to events to delegate to elements matching"," those selectors.",""," CSS selectors are relative to the `container` element. Events are attached"," to the container, and delegation is used so that subscribers are only"," notified of events that occur on elements inside the container that match"," the specified selectors. This allows the container's contents to be re-"," rendered as needed without losing event subscriptions.",""," Event handlers can be specified either as functions or as strings that map"," to function names on this view instance or its prototype.",""," The `this` object in event handlers will refer to this view instance. If"," you'd prefer `this` to be something else, use `Y.bind()` to bind a custom"," `this` object.",""," @example",""," var view = new Y.View({"," events: {"," // Call `this.toggle()` whenever the element with the id"," // \"toggle-button\" is clicked."," '#toggle-button': {click: 'toggle'},",""," // Call `this.hoverOn()` when the mouse moves over any element"," // with the \"hoverable\" class, and `this.hoverOff()` when the"," // mouse moves out of any element with the \"hoverable\" class."," '.hoverable': {"," mouseover: 'hoverOn',"," mouseout : 'hoverOff'"," }"," }"," });",""," @property events"," @type Object"," @default {}"," **/"," events: {},",""," /**"," Template for this view's contents.",""," This is a convenience property that has no default behavior of its own."," It's only provided as a convention to allow you to store whatever you"," consider to be a template, whether that's an HTML string, a `Y.Node`"," instance, a Mustache template, or anything else your little heart"," desires.",""," How this template gets used is entirely up to you and your custom"," `render()` method.",""," @property template"," @type mixed"," @default ''"," **/"," template: '',",""," // -- Protected Properties -------------------------------------------------",""," /**"," This tells `Y.Base` that it should create ad-hoc attributes for config"," properties passed to View's constructor. This makes it possible to"," instantiate a view and set a bunch of attributes without having to subclass"," `Y.View` and declare all those attributes first.",""," @property _allowAdHocAttrs"," @type Boolean"," @default true"," @protected"," @since 3.5.0"," **/"," _allowAdHocAttrs: true,",""," // -- Lifecycle Methods ----------------------------------------------------"," initializer: function (config) {"," config || (config = {});",""," // Set instance properties specified in the config."," config.containerTemplate &&"," (this.containerTemplate = config.containerTemplate);",""," config.template && (this.template = config.template);",""," // Merge events from the config into events in `this.events`."," this.events = config.events ? Y.merge(this.events, config.events) :"," this.events;",""," // When the container node changes (or when it's set for the first"," // time), we'll attach events to it, but not until then. This allows the"," // container to be created lazily the first time it's accessed rather"," // than always on init."," this.after('containerChange', this._afterContainerChange);"," },",""," /**"," Destroys this View, detaching any DOM events and optionally also destroying"," its container node.",""," By default, the container node will not be destroyed. Pass an _options_"," object with a truthy `remove` property to destroy the container as well.",""," @method destroy"," @param {Object} [options] Options."," @param {Boolean} [options.remove=false] If `true`, this View's container"," will be removed from the DOM and destroyed as well."," @chainable"," */"," destroy: function (options) {"," // We also accept `delete` as a synonym for `remove`."," if (options && (options.remove || options['delete'])) {"," // Attaching an event handler here because the `destroy` event is"," // preventable. If we destroyed the container before calling the"," // superclass's `destroy()` method and the event was prevented, the"," // class would end up in a broken state."," this.onceAfter('destroy', function () {"," this._destroyContainer();"," });"," }",""," return View.superclass.destroy.call(this);"," },",""," destructor: function () {"," this.detachEvents();"," delete this._container;"," },",""," // -- Public Methods -------------------------------------------------------",""," /**"," Attaches delegated event handlers to this view's container element. This"," method is called internally to subscribe to events configured in the"," `events` attribute when the view is initialized.",""," You may override this method to customize the event attaching logic.",""," @method attachEvents"," @param {Object} [events] Hash of events to attach. See the docs for the"," `events` attribute for details on the format. If not specified, this"," view's `events` property will be used."," @chainable"," @see detachEvents"," **/"," attachEvents: function (events) {"," var container = this.get('container'),"," owns = Y.Object.owns,"," handler, handlers, name, selector;",""," this.detachEvents();",""," events || (events = this.events);",""," for (selector in events) {"," if (!owns(events, selector)) { continue; }",""," handlers = events[selector];",""," for (name in handlers) {"," if (!owns(handlers, name)) { continue; }",""," handler = handlers[name];",""," // TODO: Make this more robust by using lazy-binding:"," // `handler = Y.bind(handler, this);`"," if (typeof handler === 'string') {"," handler = this[handler];"," }",""," if (!handler) {"," continue;"," }",""," this._attachedViewEvents.push("," container.delegate(name, handler, selector, this));"," }"," }",""," return this;"," },",""," /**"," Creates and returns a container node for this view.",""," By default, the container is created from the HTML template specified in the"," `containerTemplate` property, and is _not_ added to the DOM automatically.",""," You may override this method to customize how the container node is created"," (such as by rendering it from a custom template format). Your method must"," return a `Y.Node` instance.",""," @method create"," @param {HTMLElement|Node|String} [container] Selector string, `Y.Node`"," instance, or DOM element to use at the container node."," @return {Node} Node instance of the created container node."," **/"," create: function (container) {"," return container ? Y.one(container) :"," Y.Node.create(this.containerTemplate);"," },",""," /**"," Detaches DOM events that have previously been attached to the container by"," `attachEvents()`.",""," @method detachEvents"," @chainable"," @see attachEvents"," **/"," detachEvents: function () {"," Y.Array.each(this._attachedViewEvents, function (handle) {"," if (handle) {"," handle.detach();"," }"," });",""," this._attachedViewEvents = [];"," return this;"," },",""," /**"," Removes this view's container element from the DOM (if it's in the DOM),"," but doesn't destroy it or any event listeners attached to it.",""," @method remove"," @chainable"," **/"," remove: function () {"," var container = this.get('container');"," container && container.remove();"," return this;"," },",""," /**"," Renders this view.",""," This method is a noop by default. Override it to provide a custom"," implementation that renders this view's content and appends it to the"," container element. Ideally your `render` method should also return `this` as"," the end to allow chaining, but that's up to you.",""," Since there's no default renderer, you're free to render your view however"," you see fit, whether that means manipulating the DOM directly, dumping"," strings into `innerHTML`, or using a template language of some kind.",""," For basic templating needs, `Y.Node.create()` and `Y.Lang.sub()` may"," suffice, but there are no restrictions on what tools or techniques you can"," use to render your view. All you need to do is append something to the"," container element at some point, and optionally append the container"," to the DOM if it's not there already.",""," @method render"," @chainable"," **/"," render: function () {"," return this;"," },",""," // -- Protected Methods ----------------------------------------------------",""," /**"," Removes the `container` from the DOM and purges all its event listeners.",""," @method _destroyContainer"," @protected"," **/"," _destroyContainer: function () {"," var container = this.get('container');"," container && container.remove(true);"," },",""," /**"," Getter for the `container` attribute.",""," @method _getContainer"," @param {Node|null} value Current attribute value."," @return {Node} Container node."," @protected"," @since 3.5.0"," **/"," _getContainer: function (value) {"," // This wackiness is necessary to enable fully lazy creation of the"," // container node both when no container is specified and when one is"," // specified via a valueFn.",""," if (!this._container) {"," if (value) {"," // Attach events to the container when it's specified via a"," // valueFn, which won't fire the containerChange event."," this._container = value;"," this.attachEvents();"," } else {"," // Create a default container and set that as the new attribute"," // value. The `this._container` property prevents infinite"," // recursion."," value = this._container = this.create();"," this._set('container', value);"," }"," }",""," return value;"," },",""," // -- Protected Event Handlers ---------------------------------------------",""," /**"," Handles `containerChange` events. Detaches event handlers from the old"," container (if any) and attaches them to the new container.",""," Right now the `container` attr is initOnly so this event should only ever"," fire the first time the container is created, but in the future (once Y.App"," can handle it) we may allow runtime container changes.",""," @method _afterContainerChange"," @protected"," @since 3.5.0"," **/"," _afterContainerChange: function () {"," this.attachEvents(this.events);"," }","}, {"," NAME: 'view',",""," ATTRS: {"," /**"," Container node into which this view's content will be rendered.",""," The container node serves as the host for all DOM events attached by the"," view. Delegation is used to handle events on children of the container,"," allowing the container's contents to be re-rendered at any time without"," losing event subscriptions.",""," The default container is a `<div>` Node, but you can override this in"," a subclass, or by passing in a custom `container` config value at"," instantiation time. If you override the default container in a subclass"," using `ATTRS`, you must use the `valueFn` property. The view's constructor"," will ignore any assignments using `value`.",""," When `container` is overridden by a subclass or passed as a config"," option at instantiation time, you can provide it as a selector string, a"," DOM element, a `Y.Node` instance, or (if you are subclassing and modifying"," the attribute), a `valueFn` function that returns a `Y.Node` instance."," The value will be converted into a `Y.Node` instance if it isn't one"," already.",""," The container is not added to the page automatically. This allows you to"," have full control over how and when your view is actually rendered to"," the page.",""," @attribute container"," @type HTMLElement|Node|String"," @default Y.Node.create(this.containerTemplate)"," @writeOnce"," **/"," container: {"," getter : '_getContainer',"," setter : Y.one,"," writeOnce: true"," }"," },",""," /**"," Properties that shouldn't be turned into ad-hoc attributes when passed to"," View's constructor.",""," @property _NON_ATTRS_CFG"," @type Array"," @static"," @protected"," @since 3.5.0"," **/"," _NON_ATTRS_CFG: ["," 'containerTemplate',"," 'events',"," 'template'"," ]","});","","","","}, '@VERSION@', {\"requires\": [\"base-build\", \"node-event-delegate\"]});","","}());"]}; } var __cov_WKkurTqscWZwqGjHXZ6avQ = __coverage__['build/view/view.js']; __cov_WKkurTqscWZwqGjHXZ6avQ.s['1']++;YUI.add('view',function(Y,NAME){__cov_WKkurTqscWZwqGjHXZ6avQ.f['1']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['2']++;function View(){__cov_WKkurTqscWZwqGjHXZ6avQ.f['2']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['3']++;View.superclass.constructor.apply(this,arguments);}__cov_WKkurTqscWZwqGjHXZ6avQ.s['4']++;Y.View=Y.extend(View,Y.Base,{containerTemplate:'<div/>',events:{},template:'',_allowAdHocAttrs:true,initializer:function(config){__cov_WKkurTqscWZwqGjHXZ6avQ.f['3']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['5']++;(__cov_WKkurTqscWZwqGjHXZ6avQ.b['1'][0]++,config)||(__cov_WKkurTqscWZwqGjHXZ6avQ.b['1'][1]++,config={});__cov_WKkurTqscWZwqGjHXZ6avQ.s['6']++;(__cov_WKkurTqscWZwqGjHXZ6avQ.b['2'][0]++,config.containerTemplate)&&(__cov_WKkurTqscWZwqGjHXZ6avQ.b['2'][1]++,this.containerTemplate=config.containerTemplate);__cov_WKkurTqscWZwqGjHXZ6avQ.s['7']++;(__cov_WKkurTqscWZwqGjHXZ6avQ.b['3'][0]++,config.template)&&(__cov_WKkurTqscWZwqGjHXZ6avQ.b['3'][1]++,this.template=config.template);__cov_WKkurTqscWZwqGjHXZ6avQ.s['8']++;this.events=config.events?(__cov_WKkurTqscWZwqGjHXZ6avQ.b['4'][0]++,Y.merge(this.events,config.events)):(__cov_WKkurTqscWZwqGjHXZ6avQ.b['4'][1]++,this.events);__cov_WKkurTqscWZwqGjHXZ6avQ.s['9']++;this.after('containerChange',this._afterContainerChange);},destroy:function(options){__cov_WKkurTqscWZwqGjHXZ6avQ.f['4']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['10']++;if((__cov_WKkurTqscWZwqGjHXZ6avQ.b['6'][0]++,options)&&((__cov_WKkurTqscWZwqGjHXZ6avQ.b['6'][1]++,options.remove)||(__cov_WKkurTqscWZwqGjHXZ6avQ.b['6'][2]++,options['delete']))){__cov_WKkurTqscWZwqGjHXZ6avQ.b['5'][0]++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['11']++;this.onceAfter('destroy',function(){__cov_WKkurTqscWZwqGjHXZ6avQ.f['5']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['12']++;this._destroyContainer();});}else{__cov_WKkurTqscWZwqGjHXZ6avQ.b['5'][1]++;}__cov_WKkurTqscWZwqGjHXZ6avQ.s['13']++;return View.superclass.destroy.call(this);},destructor:function(){__cov_WKkurTqscWZwqGjHXZ6avQ.f['6']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['14']++;this.detachEvents();__cov_WKkurTqscWZwqGjHXZ6avQ.s['15']++;delete this._container;},attachEvents:function(events){__cov_WKkurTqscWZwqGjHXZ6avQ.f['7']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['16']++;var container=this.get('container'),owns=Y.Object.owns,handler,handlers,name,selector;__cov_WKkurTqscWZwqGjHXZ6avQ.s['17']++;this.detachEvents();__cov_WKkurTqscWZwqGjHXZ6avQ.s['18']++;(__cov_WKkurTqscWZwqGjHXZ6avQ.b['7'][0]++,events)||(__cov_WKkurTqscWZwqGjHXZ6avQ.b['7'][1]++,events=this.events);__cov_WKkurTqscWZwqGjHXZ6avQ.s['19']++;for(selector in events){__cov_WKkurTqscWZwqGjHXZ6avQ.s['20']++;if(!owns(events,selector)){__cov_WKkurTqscWZwqGjHXZ6avQ.b['8'][0]++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['21']++;continue;}else{__cov_WKkurTqscWZwqGjHXZ6avQ.b['8'][1]++;}__cov_WKkurTqscWZwqGjHXZ6avQ.s['22']++;handlers=events[selector];__cov_WKkurTqscWZwqGjHXZ6avQ.s['23']++;for(name in handlers){__cov_WKkurTqscWZwqGjHXZ6avQ.s['24']++;if(!owns(handlers,name)){__cov_WKkurTqscWZwqGjHXZ6avQ.b['9'][0]++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['25']++;continue;}else{__cov_WKkurTqscWZwqGjHXZ6avQ.b['9'][1]++;}__cov_WKkurTqscWZwqGjHXZ6avQ.s['26']++;handler=handlers[name];__cov_WKkurTqscWZwqGjHXZ6avQ.s['27']++;if(typeof handler==='string'){__cov_WKkurTqscWZwqGjHXZ6avQ.b['10'][0]++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['28']++;handler=this[handler];}else{__cov_WKkurTqscWZwqGjHXZ6avQ.b['10'][1]++;}__cov_WKkurTqscWZwqGjHXZ6avQ.s['29']++;if(!handler){__cov_WKkurTqscWZwqGjHXZ6avQ.b['11'][0]++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['30']++;continue;}else{__cov_WKkurTqscWZwqGjHXZ6avQ.b['11'][1]++;}__cov_WKkurTqscWZwqGjHXZ6avQ.s['31']++;this._attachedViewEvents.push(container.delegate(name,handler,selector,this));}}__cov_WKkurTqscWZwqGjHXZ6avQ.s['32']++;return this;},create:function(container){__cov_WKkurTqscWZwqGjHXZ6avQ.f['8']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['33']++;return container?(__cov_WKkurTqscWZwqGjHXZ6avQ.b['12'][0]++,Y.one(container)):(__cov_WKkurTqscWZwqGjHXZ6avQ.b['12'][1]++,Y.Node.create(this.containerTemplate));},detachEvents:function(){__cov_WKkurTqscWZwqGjHXZ6avQ.f['9']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['34']++;Y.Array.each(this._attachedViewEvents,function(handle){__cov_WKkurTqscWZwqGjHXZ6avQ.f['10']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['35']++;if(handle){__cov_WKkurTqscWZwqGjHXZ6avQ.b['13'][0]++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['36']++;handle.detach();}else{__cov_WKkurTqscWZwqGjHXZ6avQ.b['13'][1]++;}});__cov_WKkurTqscWZwqGjHXZ6avQ.s['37']++;this._attachedViewEvents=[];__cov_WKkurTqscWZwqGjHXZ6avQ.s['38']++;return this;},remove:function(){__cov_WKkurTqscWZwqGjHXZ6avQ.f['11']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['39']++;var container=this.get('container');__cov_WKkurTqscWZwqGjHXZ6avQ.s['40']++;(__cov_WKkurTqscWZwqGjHXZ6avQ.b['14'][0]++,container)&&(__cov_WKkurTqscWZwqGjHXZ6avQ.b['14'][1]++,container.remove());__cov_WKkurTqscWZwqGjHXZ6avQ.s['41']++;return this;},render:function(){__cov_WKkurTqscWZwqGjHXZ6avQ.f['12']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['42']++;return this;},_destroyContainer:function(){__cov_WKkurTqscWZwqGjHXZ6avQ.f['13']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['43']++;var container=this.get('container');__cov_WKkurTqscWZwqGjHXZ6avQ.s['44']++;(__cov_WKkurTqscWZwqGjHXZ6avQ.b['15'][0]++,container)&&(__cov_WKkurTqscWZwqGjHXZ6avQ.b['15'][1]++,container.remove(true));},_getContainer:function(value){__cov_WKkurTqscWZwqGjHXZ6avQ.f['14']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['45']++;if(!this._container){__cov_WKkurTqscWZwqGjHXZ6avQ.b['16'][0]++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['46']++;if(value){__cov_WKkurTqscWZwqGjHXZ6avQ.b['17'][0]++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['47']++;this._container=value;__cov_WKkurTqscWZwqGjHXZ6avQ.s['48']++;this.attachEvents();}else{__cov_WKkurTqscWZwqGjHXZ6avQ.b['17'][1]++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['49']++;value=this._container=this.create();__cov_WKkurTqscWZwqGjHXZ6avQ.s['50']++;this._set('container',value);}}else{__cov_WKkurTqscWZwqGjHXZ6avQ.b['16'][1]++;}__cov_WKkurTqscWZwqGjHXZ6avQ.s['51']++;return value;},_afterContainerChange:function(){__cov_WKkurTqscWZwqGjHXZ6avQ.f['15']++;__cov_WKkurTqscWZwqGjHXZ6avQ.s['52']++;this.attachEvents(this.events);}},{NAME:'view',ATTRS:{container:{getter:'_getContainer',setter:Y.one,writeOnce:true}},_NON_ATTRS_CFG:['containerTemplate','events','template']});},'@VERSION@',{'requires':['base-build','node-event-delegate']});
victorjonsson/cdnjs
ajax/libs/yui/3.11.0/view/view-coverage.js
JavaScript
mit
30,866
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/series-combospline-stacked/series-combospline-stacked.js']) { __coverage__['build/series-combospline-stacked/series-combospline-stacked.js'] = {"path":"build/series-combospline-stacked/series-combospline-stacked.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0]},"f":{"1":0,"2":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":57}}},"2":{"name":"(anonymous_2)","line":30,"loc":{"start":{"line":30,"column":13},"end":{"line":31,"column":4}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":72,"column":77}},"2":{"start":{"line":22,"column":0},"end":{"line":69,"column":3}},"3":{"start":{"line":32,"column":8},"end":{"line":35,"column":9}},"4":{"start":{"line":34,"column":12},"end":{"line":34,"column":41}},"5":{"start":{"line":36,"column":8},"end":{"line":39,"column":9}},"6":{"start":{"line":38,"column":12},"end":{"line":38,"column":30}},"7":{"start":{"line":40,"column":8},"end":{"line":43,"column":9}},"8":{"start":{"line":42,"column":12},"end":{"line":42,"column":29}}},"branchMap":{"1":{"line":32,"type":"if","locations":[{"start":{"line":32,"column":8},"end":{"line":32,"column":8}},{"start":{"line":32,"column":8},"end":{"line":32,"column":8}}]},"2":{"line":36,"type":"if","locations":[{"start":{"line":36,"column":8},"end":{"line":36,"column":8}},{"start":{"line":36,"column":8},"end":{"line":36,"column":8}}]},"3":{"line":40,"type":"if","locations":[{"start":{"line":40,"column":8},"end":{"line":40,"column":8}},{"start":{"line":40,"column":8},"end":{"line":40,"column":8}}]}},"code":["(function () { YUI.add('series-combospline-stacked', function (Y, NAME) {","","/**"," * Provides functionality for creating a stacked combospline series."," *"," * @module charts"," * @submodule series-combospline-stacked"," */","/**"," * The StackedComboSplineSeries class renders a combination of splines, plots and areaspline fills in a single series. Series"," * are stacked along the value axis to indicate each series contribution to a cumulative total. Each"," * series type has a corresponding boolean attribute indicating if it is rendered. By default, all three types are"," * rendered."," *"," * @class StackedComboSplineSeries"," * @extends StackedComboSeries"," * @uses CurveUtil"," * @constructor"," * @param {Object} config (optional) Configuration parameters."," * @submodule series-combospline-stacked"," */","Y.StackedComboSplineSeries = Y.Base.create(\"stackedComboSplineSeries\", Y.StackedComboSeries, [Y.CurveUtil], {"," /**","\t * @protected"," *"," * Draws the series."," *"," * @method drawSeries","\t */","\tdrawSeries: function()"," {"," if(this.get(\"showAreaFill\"))"," {"," this.drawStackedAreaSpline();"," }"," if(this.get(\"showLines\"))"," {"," this.drawSpline();"," }"," if(this.get(\"showMarkers\"))"," {"," this.drawPlots();"," }"," }","}, {"," ATTRS: {"," /**"," * Read-only attribute indicating the type of series."," *"," * @attribute type"," * @type String"," * @default stackedComboSpline"," */"," type : {"," value : \"stackedComboSpline\""," },",""," /**"," * Indicates whether a fill is displayed."," *"," * @attribute showAreaFill"," * @type Boolean"," * @default true"," */"," showAreaFill: {"," value: true"," }"," }","});","","","}, '@VERSION@', {\"requires\": [\"series-combo-stacked\", \"series-curve-util\"]});","","}());"]}; } var __cov_K_9pqCnGyFTnTVOp6cAc6g = __coverage__['build/series-combospline-stacked/series-combospline-stacked.js']; __cov_K_9pqCnGyFTnTVOp6cAc6g.s['1']++;YUI.add('series-combospline-stacked',function(Y,NAME){__cov_K_9pqCnGyFTnTVOp6cAc6g.f['1']++;__cov_K_9pqCnGyFTnTVOp6cAc6g.s['2']++;Y.StackedComboSplineSeries=Y.Base.create('stackedComboSplineSeries',Y.StackedComboSeries,[Y.CurveUtil],{drawSeries:function(){__cov_K_9pqCnGyFTnTVOp6cAc6g.f['2']++;__cov_K_9pqCnGyFTnTVOp6cAc6g.s['3']++;if(this.get('showAreaFill')){__cov_K_9pqCnGyFTnTVOp6cAc6g.b['1'][0]++;__cov_K_9pqCnGyFTnTVOp6cAc6g.s['4']++;this.drawStackedAreaSpline();}else{__cov_K_9pqCnGyFTnTVOp6cAc6g.b['1'][1]++;}__cov_K_9pqCnGyFTnTVOp6cAc6g.s['5']++;if(this.get('showLines')){__cov_K_9pqCnGyFTnTVOp6cAc6g.b['2'][0]++;__cov_K_9pqCnGyFTnTVOp6cAc6g.s['6']++;this.drawSpline();}else{__cov_K_9pqCnGyFTnTVOp6cAc6g.b['2'][1]++;}__cov_K_9pqCnGyFTnTVOp6cAc6g.s['7']++;if(this.get('showMarkers')){__cov_K_9pqCnGyFTnTVOp6cAc6g.b['3'][0]++;__cov_K_9pqCnGyFTnTVOp6cAc6g.s['8']++;this.drawPlots();}else{__cov_K_9pqCnGyFTnTVOp6cAc6g.b['3'][1]++;}}},{ATTRS:{type:{value:'stackedComboSpline'},showAreaFill:{value:true}}});},'@VERSION@',{'requires':['series-combo-stacked','series-curve-util']});
upgle/cdnjs
ajax/libs/yui/3.10.2/series-combospline-stacked/series-combospline-stacked-coverage.js
JavaScript
mit
5,014
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/anim-node-plugin/anim-node-plugin.js']) { __coverage__['build/anim-node-plugin/anim-node-plugin.js'] = {"path":"build/anim-node-plugin/anim-node-plugin.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0},"b":{"1":[0,0]},"f":{"1":0,"2":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":47}}},"2":{"name":"(anonymous_2)","line":11,"loc":{"start":{"line":11,"column":13},"end":{"line":11,"column":30}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":26,"column":64}},"2":{"start":{"line":11,"column":0},"end":{"line":15,"column":2}},"3":{"start":{"line":12,"column":4},"end":{"line":12,"column":45}},"4":{"start":{"line":13,"column":4},"end":{"line":13,"column":30}},"5":{"start":{"line":14,"column":4},"end":{"line":14,"column":57}},"6":{"start":{"line":17,"column":0},"end":{"line":17,"column":23}},"7":{"start":{"line":18,"column":0},"end":{"line":18,"column":17}},"8":{"start":{"line":20,"column":0},"end":{"line":20,"column":25}},"9":{"start":{"line":22,"column":0},"end":{"line":22,"column":22}},"10":{"start":{"line":23,"column":0},"end":{"line":23,"column":25}}},"branchMap":{"1":{"line":12,"type":"cond-expr","locations":[{"start":{"line":12,"column":24},"end":{"line":12,"column":39}},{"start":{"line":12,"column":42},"end":{"line":12,"column":44}}]}},"code":["(function () { YUI.add('anim-node-plugin', function (Y, NAME) {","","/**"," * Binds an Anim instance to a Node instance"," * @module anim"," * @class Plugin.NodeFX"," * @extends Anim"," * @submodule anim-node-plugin"," */","","var NodeFX = function(config) {"," config = (config) ? Y.merge(config) : {};"," config.node = config.host;"," NodeFX.superclass.constructor.apply(this, arguments);","};","","NodeFX.NAME = \"nodefx\";","NodeFX.NS = \"fx\";","","Y.extend(NodeFX, Y.Anim);","","Y.namespace('Plugin');","Y.Plugin.NodeFX = NodeFX;","","","}, '@VERSION@', {\"requires\": [\"node-pluginhost\", \"anim-base\"]});","","}());"]}; } var __cov_rw4Ct134YvRotvWfOr0i4g = __coverage__['build/anim-node-plugin/anim-node-plugin.js']; __cov_rw4Ct134YvRotvWfOr0i4g.s['1']++;YUI.add('anim-node-plugin',function(Y,NAME){__cov_rw4Ct134YvRotvWfOr0i4g.f['1']++;__cov_rw4Ct134YvRotvWfOr0i4g.s['2']++;var NodeFX=function(config){__cov_rw4Ct134YvRotvWfOr0i4g.f['2']++;__cov_rw4Ct134YvRotvWfOr0i4g.s['3']++;config=config?(__cov_rw4Ct134YvRotvWfOr0i4g.b['1'][0]++,Y.merge(config)):(__cov_rw4Ct134YvRotvWfOr0i4g.b['1'][1]++,{});__cov_rw4Ct134YvRotvWfOr0i4g.s['4']++;config.node=config.host;__cov_rw4Ct134YvRotvWfOr0i4g.s['5']++;NodeFX.superclass.constructor.apply(this,arguments);};__cov_rw4Ct134YvRotvWfOr0i4g.s['6']++;NodeFX.NAME='nodefx';__cov_rw4Ct134YvRotvWfOr0i4g.s['7']++;NodeFX.NS='fx';__cov_rw4Ct134YvRotvWfOr0i4g.s['8']++;Y.extend(NodeFX,Y.Anim);__cov_rw4Ct134YvRotvWfOr0i4g.s['9']++;Y.namespace('Plugin');__cov_rw4Ct134YvRotvWfOr0i4g.s['10']++;Y.Plugin.NodeFX=NodeFX;},'@VERSION@',{'requires':['node-pluginhost','anim-base']});
sreym/cdnjs
ajax/libs/yui/3.13.0/anim-node-plugin/anim-node-plugin-coverage.js
JavaScript
mit
3,089
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/dump/dump.js']) { __coverage__['build/dump/dump.js'] = {"path":"build/dump/dump.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},"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]},"f":{"1":0,"2":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":35}}},"2":{"name":"(anonymous_2)","line":31,"loc":{"start":{"line":31,"column":11},"end":{"line":31,"column":26}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":105,"column":44}},"2":{"start":{"line":14,"column":4},"end":{"line":98,"column":6}},"3":{"start":{"line":32,"column":8},"end":{"line":32,"column":45}},"4":{"start":{"line":38,"column":8},"end":{"line":50,"column":9}},"5":{"start":{"line":39,"column":12},"end":{"line":39,"column":26}},"6":{"start":{"line":40,"column":15},"end":{"line":50,"column":9}},"7":{"start":{"line":41,"column":12},"end":{"line":41,"column":21}},"8":{"start":{"line":42,"column":15},"end":{"line":50,"column":9}},"9":{"start":{"line":43,"column":12},"end":{"line":43,"column":42}},"10":{"start":{"line":44,"column":15},"end":{"line":50,"column":9}},"11":{"start":{"line":45,"column":12},"end":{"line":45,"column":28}},"12":{"start":{"line":46,"column":15},"end":{"line":50,"column":9}},"13":{"start":{"line":47,"column":12},"end":{"line":47,"column":30}},"14":{"start":{"line":48,"column":15},"end":{"line":50,"column":9}},"15":{"start":{"line":49,"column":12},"end":{"line":49,"column":23}},"16":{"start":{"line":53,"column":8},"end":{"line":53,"column":36}},"17":{"start":{"line":56,"column":8},"end":{"line":95,"column":9}},"18":{"start":{"line":57,"column":12},"end":{"line":57,"column":24}},"19":{"start":{"line":58,"column":12},"end":{"line":65,"column":13}},"20":{"start":{"line":59,"column":16},"end":{"line":63,"column":17}},"21":{"start":{"line":60,"column":20},"end":{"line":60,"column":64}},"22":{"start":{"line":62,"column":20},"end":{"line":62,"column":33}},"23":{"start":{"line":64,"column":16},"end":{"line":64,"column":30}},"24":{"start":{"line":66,"column":12},"end":{"line":68,"column":13}},"25":{"start":{"line":67,"column":16},"end":{"line":67,"column":24}},"26":{"start":{"line":69,"column":12},"end":{"line":69,"column":24}},"27":{"start":{"line":71,"column":15},"end":{"line":95,"column":9}},"28":{"start":{"line":72,"column":12},"end":{"line":72,"column":33}},"29":{"start":{"line":75,"column":12},"end":{"line":75,"column":24}},"30":{"start":{"line":76,"column":12},"end":{"line":90,"column":13}},"31":{"start":{"line":77,"column":16},"end":{"line":89,"column":17}},"32":{"start":{"line":78,"column":20},"end":{"line":88,"column":21}},"33":{"start":{"line":79,"column":24},"end":{"line":79,"column":42}},"34":{"start":{"line":80,"column":24},"end":{"line":84,"column":25}},"35":{"start":{"line":81,"column":28},"end":{"line":81,"column":72}},"36":{"start":{"line":83,"column":28},"end":{"line":83,"column":41}},"37":{"start":{"line":85,"column":24},"end":{"line":85,"column":38}},"38":{"start":{"line":87,"column":24},"end":{"line":87,"column":54}},"39":{"start":{"line":91,"column":12},"end":{"line":93,"column":13}},"40":{"start":{"line":92,"column":16},"end":{"line":92,"column":24}},"41":{"start":{"line":94,"column":12},"end":{"line":94,"column":24}},"42":{"start":{"line":97,"column":8},"end":{"line":97,"column":26}},"43":{"start":{"line":100,"column":4},"end":{"line":100,"column":18}},"44":{"start":{"line":101,"column":4},"end":{"line":101,"column":18}}},"branchMap":{"1":{"line":38,"type":"if","locations":[{"start":{"line":38,"column":8},"end":{"line":38,"column":8}},{"start":{"line":38,"column":8},"end":{"line":38,"column":8}}]},"2":{"line":40,"type":"if","locations":[{"start":{"line":40,"column":15},"end":{"line":40,"column":15}},{"start":{"line":40,"column":15},"end":{"line":40,"column":15}}]},"3":{"line":42,"type":"if","locations":[{"start":{"line":42,"column":15},"end":{"line":42,"column":15}},{"start":{"line":42,"column":15},"end":{"line":42,"column":15}}]},"4":{"line":42,"type":"binary-expr","locations":[{"start":{"line":42,"column":19},"end":{"line":42,"column":29}},{"start":{"line":42,"column":33},"end":{"line":42,"column":42}}]},"5":{"line":44,"type":"if","locations":[{"start":{"line":44,"column":15},"end":{"line":44,"column":15}},{"start":{"line":44,"column":15},"end":{"line":44,"column":15}}]},"6":{"line":44,"type":"binary-expr","locations":[{"start":{"line":44,"column":19},"end":{"line":44,"column":29}},{"start":{"line":44,"column":33},"end":{"line":44,"column":44}}]},"7":{"line":46,"type":"if","locations":[{"start":{"line":46,"column":15},"end":{"line":46,"column":15}},{"start":{"line":46,"column":15},"end":{"line":46,"column":15}}]},"8":{"line":46,"type":"binary-expr","locations":[{"start":{"line":46,"column":19},"end":{"line":46,"column":29}},{"start":{"line":46,"column":33},"end":{"line":46,"column":39}}]},"9":{"line":48,"type":"if","locations":[{"start":{"line":48,"column":15},"end":{"line":48,"column":15}},{"start":{"line":48,"column":15},"end":{"line":48,"column":15}}]},"10":{"line":53,"type":"cond-expr","locations":[{"start":{"line":53,"column":30},"end":{"line":53,"column":31}},{"start":{"line":53,"column":34},"end":{"line":53,"column":35}}]},"11":{"line":56,"type":"if","locations":[{"start":{"line":56,"column":8},"end":{"line":56,"column":8}},{"start":{"line":56,"column":8},"end":{"line":56,"column":8}}]},"12":{"line":59,"type":"if","locations":[{"start":{"line":59,"column":16},"end":{"line":59,"column":16}},{"start":{"line":59,"column":16},"end":{"line":59,"column":16}}]},"13":{"line":60,"type":"cond-expr","locations":[{"start":{"line":60,"column":37},"end":{"line":60,"column":56}},{"start":{"line":60,"column":59},"end":{"line":60,"column":62}}]},"14":{"line":66,"type":"if","locations":[{"start":{"line":66,"column":12},"end":{"line":66,"column":12}},{"start":{"line":66,"column":12},"end":{"line":66,"column":12}}]},"15":{"line":71,"type":"if","locations":[{"start":{"line":71,"column":15},"end":{"line":71,"column":15}},{"start":{"line":71,"column":15},"end":{"line":71,"column":15}}]},"16":{"line":77,"type":"if","locations":[{"start":{"line":77,"column":16},"end":{"line":77,"column":16}},{"start":{"line":77,"column":16},"end":{"line":77,"column":16}}]},"17":{"line":80,"type":"if","locations":[{"start":{"line":80,"column":24},"end":{"line":80,"column":24}},{"start":{"line":80,"column":24},"end":{"line":80,"column":24}}]},"18":{"line":81,"type":"cond-expr","locations":[{"start":{"line":81,"column":45},"end":{"line":81,"column":64}},{"start":{"line":81,"column":67},"end":{"line":81,"column":70}}]},"19":{"line":91,"type":"if","locations":[{"start":{"line":91,"column":12},"end":{"line":91,"column":12}},{"start":{"line":91,"column":12},"end":{"line":91,"column":12}}]}},"code":["(function () { YUI.add('dump', function (Y, NAME) {","","/**"," * Returns a simple string representation of the object or array."," * Other types of objects will be returned unprocessed. Arrays"," * are expected to be indexed. Use object notation for"," * associative arrays."," *"," * If included, the dump method is added to the YUI instance."," *"," * @module dump"," */",""," var L = Y.Lang,"," OBJ = '{...}',"," FUN = 'f(){...}',"," COMMA = ', ',"," ARROW = ' => ',",""," /**"," * Returns a simple string representation of the object or array."," * Other types of objects will be returned unprocessed. Arrays"," * are expected to be indexed."," *"," * @method dump"," * @param {Object} o The object to dump."," * @param {Number} d How deep to recurse child objects, default 3."," * @return {String} the dump result."," * @for YUI"," */"," dump = function(o, d) {"," var i, len, s = [], type = L.type(o);",""," // Cast non-objects to string"," // Skip dates because the std toString is what we want"," // Skip HTMLElement-like objects because trying to dump"," // an element will cause an unhandled exception in FF 2.x"," if (!L.isObject(o)) {"," return o + '';"," } else if (type == 'date') {"," return o;"," } else if (o.nodeType && o.tagName) {"," return o.tagName + '#' + o.id;"," } else if (o.document && o.navigator) {"," return 'window';"," } else if (o.location && o.body) {"," return 'document';"," } else if (type == 'function') {"," return FUN;"," }",""," // dig into child objects the depth specifed. Default 3"," d = (L.isNumber(d)) ? d : 3;",""," // arrays [1, 2, 3]"," if (type == 'array') {"," s.push('[');"," for (i = 0, len = o.length; i < len; i = i + 1) {"," if (L.isObject(o[i])) {"," s.push((d > 0) ? L.dump(o[i], d - 1) : OBJ);"," } else {"," s.push(o[i]);"," }"," s.push(COMMA);"," }"," if (s.length > 1) {"," s.pop();"," }"," s.push(']');"," // regexp /foo/"," } else if (type == 'regexp') {"," s.push(o.toString());"," // objects {k1 => v1, k2 => v2}"," } else {"," s.push('{');"," for (i in o) {"," if (o.hasOwnProperty(i)) {"," try {"," s.push(i + ARROW);"," if (L.isObject(o[i])) {"," s.push((d > 0) ? L.dump(o[i], d - 1) : OBJ);"," } else {"," s.push(o[i]);"," }"," s.push(COMMA);"," } catch (e) {"," s.push('Error: ' + e.message);"," }"," }"," }"," if (s.length > 1) {"," s.pop();"," }"," s.push('}');"," }",""," return s.join('');"," };",""," Y.dump = dump;"," L.dump = dump;","","","","}, '@VERSION@', {\"requires\": [\"yui-base\"]});","","}());"]}; } var __cov_8wE1jf_YaY$ldW8Mvn7txA = __coverage__['build/dump/dump.js']; __cov_8wE1jf_YaY$ldW8Mvn7txA.s['1']++;YUI.add('dump',function(Y,NAME){__cov_8wE1jf_YaY$ldW8Mvn7txA.f['1']++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['2']++;var L=Y.Lang,OBJ='{...}',FUN='f(){...}',COMMA=', ',ARROW=' => ',dump=function(o,d){__cov_8wE1jf_YaY$ldW8Mvn7txA.f['2']++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['3']++;var i,len,s=[],type=L.type(o);__cov_8wE1jf_YaY$ldW8Mvn7txA.s['4']++;if(!L.isObject(o)){__cov_8wE1jf_YaY$ldW8Mvn7txA.b['1'][0]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['5']++;return o+'';}else{__cov_8wE1jf_YaY$ldW8Mvn7txA.b['1'][1]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['6']++;if(type=='date'){__cov_8wE1jf_YaY$ldW8Mvn7txA.b['2'][0]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['7']++;return o;}else{__cov_8wE1jf_YaY$ldW8Mvn7txA.b['2'][1]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['8']++;if((__cov_8wE1jf_YaY$ldW8Mvn7txA.b['4'][0]++,o.nodeType)&&(__cov_8wE1jf_YaY$ldW8Mvn7txA.b['4'][1]++,o.tagName)){__cov_8wE1jf_YaY$ldW8Mvn7txA.b['3'][0]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['9']++;return o.tagName+'#'+o.id;}else{__cov_8wE1jf_YaY$ldW8Mvn7txA.b['3'][1]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['10']++;if((__cov_8wE1jf_YaY$ldW8Mvn7txA.b['6'][0]++,o.document)&&(__cov_8wE1jf_YaY$ldW8Mvn7txA.b['6'][1]++,o.navigator)){__cov_8wE1jf_YaY$ldW8Mvn7txA.b['5'][0]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['11']++;return'window';}else{__cov_8wE1jf_YaY$ldW8Mvn7txA.b['5'][1]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['12']++;if((__cov_8wE1jf_YaY$ldW8Mvn7txA.b['8'][0]++,o.location)&&(__cov_8wE1jf_YaY$ldW8Mvn7txA.b['8'][1]++,o.body)){__cov_8wE1jf_YaY$ldW8Mvn7txA.b['7'][0]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['13']++;return'document';}else{__cov_8wE1jf_YaY$ldW8Mvn7txA.b['7'][1]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['14']++;if(type=='function'){__cov_8wE1jf_YaY$ldW8Mvn7txA.b['9'][0]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['15']++;return FUN;}else{__cov_8wE1jf_YaY$ldW8Mvn7txA.b['9'][1]++;}}}}}}__cov_8wE1jf_YaY$ldW8Mvn7txA.s['16']++;d=L.isNumber(d)?(__cov_8wE1jf_YaY$ldW8Mvn7txA.b['10'][0]++,d):(__cov_8wE1jf_YaY$ldW8Mvn7txA.b['10'][1]++,3);__cov_8wE1jf_YaY$ldW8Mvn7txA.s['17']++;if(type=='array'){__cov_8wE1jf_YaY$ldW8Mvn7txA.b['11'][0]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['18']++;s.push('[');__cov_8wE1jf_YaY$ldW8Mvn7txA.s['19']++;for(i=0,len=o.length;i<len;i=i+1){__cov_8wE1jf_YaY$ldW8Mvn7txA.s['20']++;if(L.isObject(o[i])){__cov_8wE1jf_YaY$ldW8Mvn7txA.b['12'][0]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['21']++;s.push(d>0?(__cov_8wE1jf_YaY$ldW8Mvn7txA.b['13'][0]++,L.dump(o[i],d-1)):(__cov_8wE1jf_YaY$ldW8Mvn7txA.b['13'][1]++,OBJ));}else{__cov_8wE1jf_YaY$ldW8Mvn7txA.b['12'][1]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['22']++;s.push(o[i]);}__cov_8wE1jf_YaY$ldW8Mvn7txA.s['23']++;s.push(COMMA);}__cov_8wE1jf_YaY$ldW8Mvn7txA.s['24']++;if(s.length>1){__cov_8wE1jf_YaY$ldW8Mvn7txA.b['14'][0]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['25']++;s.pop();}else{__cov_8wE1jf_YaY$ldW8Mvn7txA.b['14'][1]++;}__cov_8wE1jf_YaY$ldW8Mvn7txA.s['26']++;s.push(']');}else{__cov_8wE1jf_YaY$ldW8Mvn7txA.b['11'][1]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['27']++;if(type=='regexp'){__cov_8wE1jf_YaY$ldW8Mvn7txA.b['15'][0]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['28']++;s.push(o.toString());}else{__cov_8wE1jf_YaY$ldW8Mvn7txA.b['15'][1]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['29']++;s.push('{');__cov_8wE1jf_YaY$ldW8Mvn7txA.s['30']++;for(i in o){__cov_8wE1jf_YaY$ldW8Mvn7txA.s['31']++;if(o.hasOwnProperty(i)){__cov_8wE1jf_YaY$ldW8Mvn7txA.b['16'][0]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['32']++;try{__cov_8wE1jf_YaY$ldW8Mvn7txA.s['33']++;s.push(i+ARROW);__cov_8wE1jf_YaY$ldW8Mvn7txA.s['34']++;if(L.isObject(o[i])){__cov_8wE1jf_YaY$ldW8Mvn7txA.b['17'][0]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['35']++;s.push(d>0?(__cov_8wE1jf_YaY$ldW8Mvn7txA.b['18'][0]++,L.dump(o[i],d-1)):(__cov_8wE1jf_YaY$ldW8Mvn7txA.b['18'][1]++,OBJ));}else{__cov_8wE1jf_YaY$ldW8Mvn7txA.b['17'][1]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['36']++;s.push(o[i]);}__cov_8wE1jf_YaY$ldW8Mvn7txA.s['37']++;s.push(COMMA);}catch(e){__cov_8wE1jf_YaY$ldW8Mvn7txA.s['38']++;s.push('Error: '+e.message);}}else{__cov_8wE1jf_YaY$ldW8Mvn7txA.b['16'][1]++;}}__cov_8wE1jf_YaY$ldW8Mvn7txA.s['39']++;if(s.length>1){__cov_8wE1jf_YaY$ldW8Mvn7txA.b['19'][0]++;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['40']++;s.pop();}else{__cov_8wE1jf_YaY$ldW8Mvn7txA.b['19'][1]++;}__cov_8wE1jf_YaY$ldW8Mvn7txA.s['41']++;s.push('}');}}__cov_8wE1jf_YaY$ldW8Mvn7txA.s['42']++;return s.join('');};__cov_8wE1jf_YaY$ldW8Mvn7txA.s['43']++;Y.dump=dump;__cov_8wE1jf_YaY$ldW8Mvn7txA.s['44']++;L.dump=dump;},'@VERSION@',{'requires':['yui-base']});
LaurensRietveld/cdnjs
ajax/libs/yui/3.12.0/dump/dump-coverage.js
JavaScript
mit
15,078
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/parallel/parallel.js']) { __coverage__['build/parallel/parallel.js'] = {"path":"build/parallel/parallel.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},"b":{"1":[0,0],"2":[0,0],"3":[0,0,0],"4":[0,0],"5":[0,0],"6":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":39}}},"2":{"name":"(anonymous_2)","line":34,"loc":{"start":{"line":34,"column":13},"end":{"line":34,"column":25}}},"3":{"name":"(anonymous_3)","line":67,"loc":{"start":{"line":67,"column":9},"end":{"line":67,"column":23}}},"4":{"name":"(anonymous_4)","line":73,"loc":{"start":{"line":73,"column":15},"end":{"line":73,"column":27}}},"5":{"name":"(anonymous_5)","line":85,"loc":{"start":{"line":85,"column":10},"end":{"line":85,"column":22}}},"6":{"name":"(anonymous_6)","line":99,"loc":{"start":{"line":99,"column":10},"end":{"line":99,"column":36}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":107,"column":44}},"2":{"start":{"line":34,"column":0},"end":{"line":40,"column":2}},"3":{"start":{"line":35,"column":4},"end":{"line":35,"column":26}},"4":{"start":{"line":36,"column":4},"end":{"line":36,"column":22}},"5":{"start":{"line":37,"column":4},"end":{"line":37,"column":44}},"6":{"start":{"line":38,"column":4},"end":{"line":38,"column":19}},"7":{"start":{"line":39,"column":4},"end":{"line":39,"column":22}},"8":{"start":{"line":42,"column":0},"end":{"line":104,"column":2}},"9":{"start":{"line":68,"column":8},"end":{"line":69,"column":31}},"10":{"start":{"line":71,"column":8},"end":{"line":71,"column":24}},"11":{"start":{"line":73,"column":8},"end":{"line":79,"column":10}},"12":{"start":{"line":74,"column":12},"end":{"line":74,"column":28}},"13":{"start":{"line":75,"column":12},"end":{"line":76,"column":77}},"14":{"start":{"line":78,"column":12},"end":{"line":78,"column":24}},"15":{"start":{"line":86,"column":8},"end":{"line":86,"column":24}},"16":{"start":{"line":87,"column":8},"end":{"line":89,"column":9}},"17":{"start":{"line":88,"column":12},"end":{"line":88,"column":70}},"18":{"start":{"line":100,"column":8},"end":{"line":100,"column":33}},"19":{"start":{"line":101,"column":8},"end":{"line":101,"column":25}},"20":{"start":{"line":102,"column":8},"end":{"line":102,"column":20}}},"branchMap":{"1":{"line":35,"type":"binary-expr","locations":[{"start":{"line":35,"column":18},"end":{"line":35,"column":19}},{"start":{"line":35,"column":23},"end":{"line":35,"column":25}}]},"2":{"line":37,"type":"binary-expr","locations":[{"start":{"line":37,"column":19},"end":{"line":37,"column":38}},{"start":{"line":37,"column":42},"end":{"line":37,"column":43}}]},"3":{"line":75,"type":"binary-expr","locations":[{"start":{"line":75,"column":35},"end":{"line":75,"column":37}},{"start":{"line":75,"column":41},"end":{"line":75,"column":74}},{"start":{"line":76,"column":17},"end":{"line":76,"column":75}}]},"4":{"line":76,"type":"cond-expr","locations":[{"start":{"line":76,"column":42},"end":{"line":76,"column":54}},{"start":{"line":76,"column":57},"end":{"line":76,"column":75}}]},"5":{"line":87,"type":"if","locations":[{"start":{"line":87,"column":8},"end":{"line":87,"column":8}},{"start":{"line":87,"column":8},"end":{"line":87,"column":8}}]},"6":{"line":87,"type":"binary-expr","locations":[{"start":{"line":87,"column":12},"end":{"line":87,"column":39}},{"start":{"line":87,"column":43},"end":{"line":87,"column":56}}]}},"code":["(function () { YUI.add('parallel', function (Y, NAME) {","","","/**","* A concurrent parallel processor to help in running several async functions.","* @module parallel","* @main parallel","*/","","/**","A concurrent parallel processor to help in running several async functions.",""," var stack = new Y.Parallel();",""," for (var i = 0; i < 15; i++) {"," Y.io('./api/json/' + i, {"," on: {"," success: stack.add(function() {"," })"," }"," });"," }",""," stack.done(function() {"," });","","@class Parallel","@param {Object} o A config object","@param {Object} [o.context=Y] The execution context of the callback to done","","","*/","","Y.Parallel = function(o) {"," this.config = o || {};"," this.results = [];"," this.context = this.config.context || Y;"," this.total = 0;"," this.finished = 0;","};","","Y.Parallel.prototype = {"," /**"," * An Array of results from all the callbacks in the stack"," * @property results"," * @type Array"," */",""," results: null,"," /**"," * The total items in the stack"," * @property total"," * @type Number"," */"," total: null,"," /**"," * The number of stacked callbacks executed"," * @property finished"," * @type Number"," */"," finished: null,"," /**"," * Add a callback to the stack"," * @method add"," * @param {Function} fn The function callback we are waiting for"," */"," add: function (fn) {"," var self = this,"," index = self.total;",""," self.total += 1;",""," return function () {"," self.finished++;"," self.results[index] = (fn && fn.apply(self.context, arguments)) ||"," (arguments.length === 1 ? arguments[0] : Y.Array(arguments));",""," self.test();"," };"," },"," /**"," * Test to see if all registered items in the stack have completed, if so call the callback to `done`"," * @method test"," */"," test: function () {"," var self = this;"," if (self.finished >= self.total && self.callback) {"," self.callback.call(self.context, self.results, self.data);"," }"," },"," /**"," * The method to call when all the items in the stack are complete."," * @method done"," * @param {Function} callback The callback to execute on complete"," * @param {Mixed} callback.results The results of all the callbacks in the stack"," * @param {Mixed} [callback.data] The data given to the `done` method"," * @param {Mixed} data Mixed data to pass to the success callback"," */"," done: function (callback, data) {"," this.callback = callback;"," this.data = data;"," this.test();"," }","};","","","}, '@VERSION@', {\"requires\": [\"yui-base\"]});","","}());"]}; } var __cov_L5sDHvOirn0TVIbpXpofuA = __coverage__['build/parallel/parallel.js']; __cov_L5sDHvOirn0TVIbpXpofuA.s['1']++;YUI.add('parallel',function(Y,NAME){__cov_L5sDHvOirn0TVIbpXpofuA.f['1']++;__cov_L5sDHvOirn0TVIbpXpofuA.s['2']++;Y.Parallel=function(o){__cov_L5sDHvOirn0TVIbpXpofuA.f['2']++;__cov_L5sDHvOirn0TVIbpXpofuA.s['3']++;this.config=(__cov_L5sDHvOirn0TVIbpXpofuA.b['1'][0]++,o)||(__cov_L5sDHvOirn0TVIbpXpofuA.b['1'][1]++,{});__cov_L5sDHvOirn0TVIbpXpofuA.s['4']++;this.results=[];__cov_L5sDHvOirn0TVIbpXpofuA.s['5']++;this.context=(__cov_L5sDHvOirn0TVIbpXpofuA.b['2'][0]++,this.config.context)||(__cov_L5sDHvOirn0TVIbpXpofuA.b['2'][1]++,Y);__cov_L5sDHvOirn0TVIbpXpofuA.s['6']++;this.total=0;__cov_L5sDHvOirn0TVIbpXpofuA.s['7']++;this.finished=0;};__cov_L5sDHvOirn0TVIbpXpofuA.s['8']++;Y.Parallel.prototype={results:null,total:null,finished:null,add:function(fn){__cov_L5sDHvOirn0TVIbpXpofuA.f['3']++;__cov_L5sDHvOirn0TVIbpXpofuA.s['9']++;var self=this,index=self.total;__cov_L5sDHvOirn0TVIbpXpofuA.s['10']++;self.total+=1;__cov_L5sDHvOirn0TVIbpXpofuA.s['11']++;return function(){__cov_L5sDHvOirn0TVIbpXpofuA.f['4']++;__cov_L5sDHvOirn0TVIbpXpofuA.s['12']++;self.finished++;__cov_L5sDHvOirn0TVIbpXpofuA.s['13']++;self.results[index]=(__cov_L5sDHvOirn0TVIbpXpofuA.b['3'][0]++,fn)&&(__cov_L5sDHvOirn0TVIbpXpofuA.b['3'][1]++,fn.apply(self.context,arguments))||(__cov_L5sDHvOirn0TVIbpXpofuA.b['3'][2]++,arguments.length===1?(__cov_L5sDHvOirn0TVIbpXpofuA.b['4'][0]++,arguments[0]):(__cov_L5sDHvOirn0TVIbpXpofuA.b['4'][1]++,Y.Array(arguments)));__cov_L5sDHvOirn0TVIbpXpofuA.s['14']++;self.test();};},test:function(){__cov_L5sDHvOirn0TVIbpXpofuA.f['5']++;__cov_L5sDHvOirn0TVIbpXpofuA.s['15']++;var self=this;__cov_L5sDHvOirn0TVIbpXpofuA.s['16']++;if((__cov_L5sDHvOirn0TVIbpXpofuA.b['6'][0]++,self.finished>=self.total)&&(__cov_L5sDHvOirn0TVIbpXpofuA.b['6'][1]++,self.callback)){__cov_L5sDHvOirn0TVIbpXpofuA.b['5'][0]++;__cov_L5sDHvOirn0TVIbpXpofuA.s['17']++;self.callback.call(self.context,self.results,self.data);}else{__cov_L5sDHvOirn0TVIbpXpofuA.b['5'][1]++;}},done:function(callback,data){__cov_L5sDHvOirn0TVIbpXpofuA.f['6']++;__cov_L5sDHvOirn0TVIbpXpofuA.s['18']++;this.callback=callback;__cov_L5sDHvOirn0TVIbpXpofuA.s['19']++;this.data=data;__cov_L5sDHvOirn0TVIbpXpofuA.s['20']++;this.test();}};},'@VERSION@',{'requires':['yui-base']});
nagyist/OpenF2-cdnjs
ajax/libs/yui/3.14.1/parallel/parallel-coverage.js
JavaScript
mit
8,835
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/io-queue/io-queue.js']) { __coverage__['build/io-queue/io-queue.js'] = {"path":"build/io-queue/io-queue.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},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[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},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":39}}},"2":{"name":"(anonymous_2)","line":45,"loc":{"start":{"line":45,"column":13},"end":{"line":45,"column":24}}},"3":{"name":"(anonymous_3)","line":62,"loc":{"start":{"line":62,"column":11},"end":{"line":62,"column":28}}},"4":{"name":"(anonymous_4)","line":67,"loc":{"start":{"line":67,"column":32},"end":{"line":67,"column":48}}},"5":{"name":"(anonymous_5)","line":79,"loc":{"start":{"line":79,"column":12},"end":{"line":79,"column":25}}},"6":{"name":"(anonymous_6)","line":93,"loc":{"start":{"line":93,"column":14},"end":{"line":93,"column":26}}},"7":{"name":"(anonymous_7)","line":105,"loc":{"start":{"line":105,"column":13},"end":{"line":105,"column":25}}},"8":{"name":"(anonymous_8)","line":117,"loc":{"start":{"line":117,"column":12},"end":{"line":117,"column":23}}},"9":{"name":"(anonymous_9)","line":121,"loc":{"start":{"line":121,"column":12},"end":{"line":121,"column":23}}},"10":{"name":"(anonymous_10)","line":139,"loc":{"start":{"line":139,"column":11},"end":{"line":139,"column":22}}},"11":{"name":"(anonymous_11)","line":151,"loc":{"start":{"line":151,"column":11},"end":{"line":151,"column":22}}},"12":{"name":"_queue","line":157,"loc":{"start":{"line":157,"column":0},"end":{"line":157,"column":22}}},"13":{"name":"(anonymous_13)","line":161,"loc":{"start":{"line":161,"column":15},"end":{"line":161,"column":27}}},"14":{"name":"(anonymous_14)","line":162,"loc":{"start":{"line":162,"column":14},"end":{"line":162,"column":26}}},"15":{"name":"(anonymous_15)","line":163,"loc":{"start":{"line":163,"column":17},"end":{"line":163,"column":30}}},"16":{"name":"(anonymous_16)","line":164,"loc":{"start":{"line":164,"column":16},"end":{"line":164,"column":29}}},"17":{"name":"(anonymous_17)","line":165,"loc":{"start":{"line":165,"column":14},"end":{"line":165,"column":26}}},"18":{"name":"(anonymous_18)","line":166,"loc":{"start":{"line":166,"column":15},"end":{"line":166,"column":27}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":170,"column":60}},"2":{"start":{"line":10,"column":0},"end":{"line":10,"column":41}},"3":{"start":{"line":12,"column":0},"end":{"line":155,"column":9}},"4":{"start":{"line":46,"column":8},"end":{"line":47,"column":29}},"5":{"start":{"line":49,"column":8},"end":{"line":49,"column":29}},"6":{"start":{"line":50,"column":8},"end":{"line":50,"column":23}},"7":{"start":{"line":51,"column":8},"end":{"line":51,"column":36}},"8":{"start":{"line":63,"column":8},"end":{"line":64,"column":52}},"9":{"start":{"line":66,"column":8},"end":{"line":69,"column":9}},"10":{"start":{"line":67,"column":12},"end":{"line":67,"column":72}},"11":{"start":{"line":67,"column":50},"end":{"line":67,"column":64}},"12":{"start":{"line":68,"column":12},"end":{"line":68,"column":29}},"13":{"start":{"line":71,"column":8},"end":{"line":71,"column":21}},"14":{"start":{"line":72,"column":8},"end":{"line":74,"column":9}},"15":{"start":{"line":73,"column":12},"end":{"line":73,"column":25}},"16":{"start":{"line":76,"column":8},"end":{"line":76,"column":17}},"17":{"start":{"line":80,"column":8},"end":{"line":80,"column":22}},"18":{"start":{"line":81,"column":8},"end":{"line":81,"column":23}},"19":{"start":{"line":82,"column":8},"end":{"line":84,"column":9}},"20":{"start":{"line":83,"column":12},"end":{"line":83,"column":25}},"21":{"start":{"line":94,"column":8},"end":{"line":94,"column":27}},"22":{"start":{"line":106,"column":8},"end":{"line":106,"column":26}},"23":{"start":{"line":118,"column":8},"end":{"line":118,"column":32}},"24":{"start":{"line":122,"column":8},"end":{"line":122,"column":22}},"25":{"start":{"line":123,"column":8},"end":{"line":123,"column":23}},"26":{"start":{"line":125,"column":8},"end":{"line":127,"column":9}},"27":{"start":{"line":126,"column":12},"end":{"line":126,"column":25}},"28":{"start":{"line":140,"column":8},"end":{"line":140,"column":25}},"29":{"start":{"line":152,"column":8},"end":{"line":152,"column":30}},"30":{"start":{"line":157,"column":0},"end":{"line":159,"column":1}},"31":{"start":{"line":158,"column":4},"end":{"line":158,"column":38}},"32":{"start":{"line":161,"column":0},"end":{"line":161,"column":44}},"33":{"start":{"line":161,"column":29},"end":{"line":161,"column":41}},"34":{"start":{"line":162,"column":0},"end":{"line":162,"column":42}},"35":{"start":{"line":162,"column":28},"end":{"line":162,"column":39}},"36":{"start":{"line":163,"column":0},"end":{"line":163,"column":50}},"37":{"start":{"line":163,"column":32},"end":{"line":163,"column":47}},"38":{"start":{"line":164,"column":0},"end":{"line":164,"column":48}},"39":{"start":{"line":164,"column":31},"end":{"line":164,"column":45}},"40":{"start":{"line":165,"column":0},"end":{"line":165,"column":42}},"41":{"start":{"line":165,"column":28},"end":{"line":165,"column":39}},"42":{"start":{"line":166,"column":0},"end":{"line":166,"column":44}},"43":{"start":{"line":166,"column":29},"end":{"line":166,"column":41}},"44":{"start":{"line":167,"column":0},"end":{"line":167,"column":20}}},"branchMap":{"1":{"line":10,"type":"binary-expr","locations":[{"start":{"line":10,"column":9},"end":{"line":10,"column":26}},{"start":{"line":10,"column":30},"end":{"line":10,"column":40}}]},"2":{"line":66,"type":"if","locations":[{"start":{"line":66,"column":8},"end":{"line":66,"column":8}},{"start":{"line":66,"column":8},"end":{"line":66,"column":8}}]},"3":{"line":72,"type":"if","locations":[{"start":{"line":72,"column":8},"end":{"line":72,"column":8}},{"start":{"line":72,"column":8},"end":{"line":72,"column":8}}]},"4":{"line":82,"type":"if","locations":[{"start":{"line":82,"column":8},"end":{"line":82,"column":8}},{"start":{"line":82,"column":8},"end":{"line":82,"column":8}}]},"5":{"line":82,"type":"binary-expr","locations":[{"start":{"line":82,"column":12},"end":{"line":82,"column":32}},{"start":{"line":82,"column":36},"end":{"line":82,"column":52}}]},"6":{"line":125,"type":"if","locations":[{"start":{"line":125,"column":8},"end":{"line":125,"column":8}},{"start":{"line":125,"column":8},"end":{"line":125,"column":8}}]}},"code":["(function () { YUI.add('io-queue', function (Y, NAME) {","","/**","Extends IO to implement Queue for synchronous","transaction processing.","@module io","@submodule io-queue","@for IO","**/","var io = Y.io._map['io:0'] || new Y.IO();","","Y.mix(Y.IO.prototype, {"," /**"," * Array of transactions queued for processing"," *"," * @property _q"," * @private"," * @static"," * @type {Object}"," */"," _q: new Y.Queue(),"," _qActiveId: null,"," _qInit: false,",""," /**"," * Property to determine whether the queue is set to"," * 1 (active) or 0 (inactive). When inactive, transactions"," * will be stored in the queue until the queue is set to active."," *"," * @property _qState"," * @private"," * @static"," * @type {Number}"," */"," _qState: 1,",""," /**"," * Method Process the first transaction from the"," * queue in FIFO order."," *"," * @method _qShift"," * @private"," * @static"," */"," _qShift: function() {"," var io = this,"," o = io._q.next();",""," io._qActiveId = o.id;"," io._qState = 0;"," io.send(o.uri, o.cfg, o.id);"," },",""," /**"," * Method for queueing a transaction before the request is sent to the"," * resource, to ensure sequential processing."," *"," * @method queue"," * @static"," * @return {Object}"," */"," queue: function(uri, c) {"," var io = this,"," o = { uri: uri, cfg:c, id: this._id++ };",""," if(!io._qInit) {"," Y.on('io:complete', function(id, o) { io._qNext(id); }, io);"," io._qInit = true;"," }",""," io._q.add(o);"," if (io._qState === 1) {"," io._qShift();"," }",""," return o;"," },",""," _qNext: function(id) {"," var io = this;"," io._qState = 1;"," if (io._qActiveId === id && io._q.size() > 0) {"," io._qShift();"," }"," },",""," /**"," * Method for promoting a transaction to the top of the queue."," *"," * @method promote"," * @static"," */"," qPromote: function(o) {"," this._q.promote(o);"," },",""," /**"," * Method for removing a specific, pending transaction from"," * the queue."," *"," * @method remove"," * @private"," * @static"," */"," qRemove: function(o) {"," this._q.remove(o);"," },",""," /**"," * Method for cancel all pending transaction from"," * the queue."," *"," * @method empty"," * @static"," * @since 3.7.3"," */"," qEmpty: function() {"," this._q = new Y.Queue();"," },",""," qStart: function() {"," var io = this;"," io._qState = 1;",""," if (io._q.size() > 0) {"," io._qShift();"," }"," },",""," /**"," * Method for setting queue processing to inactive."," * Transaction requests to YUI.io.queue() will be stored in the queue, but"," * not processed until the queue is reset to \"active\"."," *"," * @method _stop"," * @private"," * @static"," */"," qStop: function() {"," this._qState = 0;"," },",""," /**"," * Method to query the current size of the queue."," *"," * @method _size"," * @private"," * @static"," * @return {Number}"," */"," qSize: function() {"," return this._q.size();"," }","","}, true);","","function _queue(u, c) {"," return io.queue.apply(io, [u, c]);","}","","_queue.start = function () { io.qStart(); };","_queue.stop = function () { io.qStop(); };","_queue.promote = function (o) { io.qPromote(o); };","_queue.remove = function (o) { io.qRemove(o); };","_queue.size = function () { io.qSize(); };","_queue.empty = function () { io.qEmpty(); };","Y.io.queue = _queue;","","","}, '@VERSION@', {\"requires\": [\"io-base\", \"queue-promote\"]});","","}());"]}; } var __cov_gCvC4RVEtFMbkP8iDe0dhw = __coverage__['build/io-queue/io-queue.js']; __cov_gCvC4RVEtFMbkP8iDe0dhw.s['1']++;YUI.add('io-queue',function(Y,NAME){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['1']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['2']++;var io=(__cov_gCvC4RVEtFMbkP8iDe0dhw.b['1'][0]++,Y.io._map['io:0'])||(__cov_gCvC4RVEtFMbkP8iDe0dhw.b['1'][1]++,new Y.IO());__cov_gCvC4RVEtFMbkP8iDe0dhw.s['3']++;Y.mix(Y.IO.prototype,{_q:new Y.Queue(),_qActiveId:null,_qInit:false,_qState:1,_qShift:function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['2']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['4']++;var io=this,o=io._q.next();__cov_gCvC4RVEtFMbkP8iDe0dhw.s['5']++;io._qActiveId=o.id;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['6']++;io._qState=0;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['7']++;io.send(o.uri,o.cfg,o.id);},queue:function(uri,c){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['3']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['8']++;var io=this,o={uri:uri,cfg:c,id:this._id++};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['9']++;if(!io._qInit){__cov_gCvC4RVEtFMbkP8iDe0dhw.b['2'][0]++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['10']++;Y.on('io:complete',function(id,o){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['4']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['11']++;io._qNext(id);},io);__cov_gCvC4RVEtFMbkP8iDe0dhw.s['12']++;io._qInit=true;}else{__cov_gCvC4RVEtFMbkP8iDe0dhw.b['2'][1]++;}__cov_gCvC4RVEtFMbkP8iDe0dhw.s['13']++;io._q.add(o);__cov_gCvC4RVEtFMbkP8iDe0dhw.s['14']++;if(io._qState===1){__cov_gCvC4RVEtFMbkP8iDe0dhw.b['3'][0]++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['15']++;io._qShift();}else{__cov_gCvC4RVEtFMbkP8iDe0dhw.b['3'][1]++;}__cov_gCvC4RVEtFMbkP8iDe0dhw.s['16']++;return o;},_qNext:function(id){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['5']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['17']++;var io=this;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['18']++;io._qState=1;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['19']++;if((__cov_gCvC4RVEtFMbkP8iDe0dhw.b['5'][0]++,io._qActiveId===id)&&(__cov_gCvC4RVEtFMbkP8iDe0dhw.b['5'][1]++,io._q.size()>0)){__cov_gCvC4RVEtFMbkP8iDe0dhw.b['4'][0]++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['20']++;io._qShift();}else{__cov_gCvC4RVEtFMbkP8iDe0dhw.b['4'][1]++;}},qPromote:function(o){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['6']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['21']++;this._q.promote(o);},qRemove:function(o){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['7']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['22']++;this._q.remove(o);},qEmpty:function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['8']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['23']++;this._q=new Y.Queue();},qStart:function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['9']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['24']++;var io=this;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['25']++;io._qState=1;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['26']++;if(io._q.size()>0){__cov_gCvC4RVEtFMbkP8iDe0dhw.b['6'][0]++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['27']++;io._qShift();}else{__cov_gCvC4RVEtFMbkP8iDe0dhw.b['6'][1]++;}},qStop:function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['10']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['28']++;this._qState=0;},qSize:function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['11']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['29']++;return this._q.size();}},true);__cov_gCvC4RVEtFMbkP8iDe0dhw.s['30']++;function _queue(u,c){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['12']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['31']++;return io.queue.apply(io,[u,c]);}__cov_gCvC4RVEtFMbkP8iDe0dhw.s['32']++;_queue.start=function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['13']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['33']++;io.qStart();};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['34']++;_queue.stop=function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['14']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['35']++;io.qStop();};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['36']++;_queue.promote=function(o){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['15']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['37']++;io.qPromote(o);};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['38']++;_queue.remove=function(o){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['16']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['39']++;io.qRemove(o);};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['40']++;_queue.size=function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['17']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['41']++;io.qSize();};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['42']++;_queue.empty=function(){__cov_gCvC4RVEtFMbkP8iDe0dhw.f['18']++;__cov_gCvC4RVEtFMbkP8iDe0dhw.s['43']++;io.qEmpty();};__cov_gCvC4RVEtFMbkP8iDe0dhw.s['44']++;Y.io.queue=_queue;},'@VERSION@',{'requires':['io-base','queue-promote']});
dada0423/cdnjs
ajax/libs/yui/3.10.0pr1/io-queue/io-queue-coverage.js
JavaScript
mit
14,915
/* * # Semantic UI * https://github.com/Semantic-Org/Semantic-UI * http://www.semantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ .ui.comments{margin:1.5em 0;max-width:650px}.ui.comments:first-child{margin-top:0}.ui.comments:last-child{margin-bottom:0}.ui.comments .comment{position:relative;background:0 0;margin:.5em 0 0;padding:.5em 0 0;border:none;border-top:none;line-height:1.2}.ui.comments .comment:first-child{margin-top:0;padding-top:0}.ui.comments .comment .comments{margin:0 0 .5em .5em;padding:1em 0 1em 1em}.ui.comments .comment .comments:before{position:absolute;top:0;left:0}.ui.comments .comment .comments .comment{border:none;border-top:none;background:0 0}.ui.comments .comment .avatar{display:block;width:2.5em;height:auto;float:left;margin:.2em 0 0}.ui.comments .comment .avatar img,.ui.comments .comment img.avatar{display:block;margin:0 auto;width:100%;height:100%;border-radius:.25rem}.ui.comments .comment>.content{display:block}.ui.comments .comment>.avatar~.content{margin-left:3.5em}.ui.comments .comment .author{font-size:1em;color:rgba(0,0,0,.8);font-weight:700}.ui.comments .comment a.author{cursor:pointer}.ui.comments .comment a.author:hover{color:#00b2f3}.ui.comments .comment .metadata{display:inline-block;margin-left:.5em;color:rgba(0,0,0,.4);font-size:.875em}.ui.comments .comment .metadata>*{display:inline-block;margin:0 .5em 0 0}.ui.comments .comment .metadata>:last-child{margin-right:0}.ui.comments .comment .text{margin:.25em 0 .5em;font-size:1em;word-wrap:break-word;color:rgba(0,0,0,.8);line-height:1.3}.ui.comments .comment .actions{font-size:.875em}.ui.comments .comment .actions a{cursor:pointer;display:inline-block;margin:0 .75em 0 0;color:rgba(0,0,0,.4)}.ui.comments .comment .actions a:last-child{margin-right:0}.ui.comments .comment .actions a.active,.ui.comments .comment .actions a:hover{color:rgba(0,0,0,.8)}.ui.comments>.reply.form{margin-top:1em}.ui.comments .comment .reply.form{width:100%;margin-top:1em}.ui.comments .reply.form textarea{font-size:1em;height:12em}.ui.collapsed.comments,.ui.comments .collapsed.comment,.ui.comments .collapsed.comments{display:none}.ui.threaded.comments .comment .comments{margin:-1.5em 0 -1em 1.25em;padding:3em 0 2em 2.25em;box-shadow:-1px 0 0 rgba(39,41,43,.15)}.ui.minimal.comments .comment .actions{opacity:0;position:absolute;top:0;right:0;left:auto;-webkit-transition:opacity .2s ease;transition:opacity .2s ease;-webkit-transition-delay:.1s;transition-delay:.1s}.ui.minimal.comments .comment>.content:hover>.actions{opacity:1}.ui.small.comments{font-size:.9em}.ui.comments{font-size:1em}.ui.large.comments{font-size:1.1em}.ui.huge.comments{font-size:1.2em}
tonytlwu/cdnjs
ajax/libs/semantic-ui/1.5.2/components/comment.min.css
CSS
mit
2,739
// 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.defineOption("scrollPastEnd", false, function(cm, val, old) { if (old && old != CodeMirror.Init) { cm.off("change", onChange); cm.off("refresh", updateBottomMargin); cm.display.lineSpace.parentNode.style.paddingBottom = ""; cm.state.scrollPastEndPadding = null; } if (val) { cm.on("change", onChange); cm.on("refresh", updateBottomMargin); updateBottomMargin(cm); } }); function onChange(cm, change) { if (CodeMirror.changeEnd(change).line == cm.lastLine()) updateBottomMargin(cm); } function updateBottomMargin(cm) { var padding = ""; if (cm.lineCount() > 1) { var totalH = cm.display.scroller.clientHeight - 30, lastLineH = cm.getLineHandle(cm.lastLine()).height; padding = (totalH - lastLineH) + "px"; } if (cm.state.scrollPastEndPadding != padding) { cm.state.scrollPastEndPadding = padding; cm.display.lineSpace.parentNode.style.paddingBottom = padding; cm.setSize(); } } });
maruilian11/cdnjs
ajax/libs/codemirror/5.11.0/addon/scroll/scrollpastend.js
JavaScript
mit
1,492
/** * Core.js 0.4.7 * https://github.com/zloirock/core-js * License: http://rock.mit-license.org * © 2015 Denis Pushkarev */ !function(global, framework, undefined){ 'use strict'; /****************************************************************************** * Module : common * ******************************************************************************/ // Shortcuts for [[Class]] & property names var OBJECT = 'Object' , FUNCTION = 'Function' , ARRAY = 'Array' , STRING = 'String' , NUMBER = 'Number' , REGEXP = 'RegExp' , DATE = 'Date' , MAP = 'Map' , SET = 'Set' , WEAKMAP = 'WeakMap' , WEAKSET = 'WeakSet' , SYMBOL = 'Symbol' , PROMISE = 'Promise' , MATH = 'Math' , ARGUMENTS = 'Arguments' , PROTOTYPE = 'prototype' , CONSTRUCTOR = 'constructor' , TO_STRING = 'toString' , TO_STRING_TAG = TO_STRING + 'Tag' , TO_LOCALE = 'toLocaleString' , HAS_OWN = 'hasOwnProperty' , FOR_EACH = 'forEach' , ITERATOR = 'iterator' , FF_ITERATOR = '@@' + ITERATOR , PROCESS = 'process' , CREATE_ELEMENT = 'createElement' // Aliases global objects and prototypes , Function = global[FUNCTION] , Object = global[OBJECT] , Array = global[ARRAY] , String = global[STRING] , Number = global[NUMBER] , RegExp = global[REGEXP] , Date = global[DATE] , Map = global[MAP] , Set = global[SET] , WeakMap = global[WEAKMAP] , WeakSet = global[WEAKSET] , Symbol = global[SYMBOL] , Math = global[MATH] , TypeError = global.TypeError , setTimeout = global.setTimeout , setImmediate = global.setImmediate , clearImmediate = global.clearImmediate , process = global[PROCESS] , nextTick = process && process.nextTick , document = global.document , html = document && document.documentElement , navigator = global.navigator , define = global.define , ArrayProto = Array[PROTOTYPE] , ObjectProto = Object[PROTOTYPE] , FunctionProto = Function[PROTOTYPE] , Infinity = 1 / 0 , DOT = '.'; // http://jsperf.com/core-js-isobject function isObject(it){ return it != null && (typeof it == 'object' || typeof it == 'function'); } function isFunction(it){ return typeof it == 'function'; } // Native function? var isNative = ctx(/./.test, /\[native code\]\s*\}\s*$/, 1); // Object internal [[Class]] or toStringTag // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring var buildIn = { Undefined: 1, Null: 1, Array: 1, String: 1, Arguments: 1, Function: 1, Error: 1, Boolean: 1, Number: 1, Date: 1, RegExp:1 } , toString = ObjectProto[TO_STRING]; function setToStringTag(it, tag, stat){ if(it && !has(it = stat ? it : it[PROTOTYPE], SYMBOL_TAG))hidden(it, SYMBOL_TAG, tag); } function cof(it){ return it == undefined ? it === undefined ? 'Undefined' : 'Null' : toString.call(it).slice(8, -1); } function classof(it){ var klass = cof(it), tag; return klass == OBJECT && (tag = it[SYMBOL_TAG]) ? has(buildIn, tag) ? '~' + tag : tag : klass; } // Function var call = FunctionProto.call , apply = FunctionProto.apply , REFERENCE_GET; // Partial apply function part(/* ...args */){ var fn = assertFunction(this) , length = arguments.length , args = Array(length) , i = 0 , _ = path._ , holder = false; while(length > i)if((args[i] = arguments[i++]) === _)holder = true; return function(/* ...args */){ var that = this , _length = arguments.length , i = 0, j = 0, _args; if(!holder && !_length)return invoke(fn, args, that); _args = args.slice(); if(holder)for(;length > i; i++)if(_args[i] === _)_args[i] = arguments[j++]; while(_length > j)_args.push(arguments[j++]); return invoke(fn, _args, that); } } // Optional / simple context binding function ctx(fn, that, length){ assertFunction(fn); if(~length && that === undefined)return fn; switch(length){ case 1: return function(a){ return fn.call(that, a); } case 2: return function(a, b){ return fn.call(that, a, b); } case 3: return function(a, b, c){ return fn.call(that, a, b, c); } } return function(/* ...args */){ return fn.apply(that, arguments); } } // Fast apply // http://jsperf.lnkit.com/fast-apply/5 function invoke(fn, args, that){ var un = that === undefined; switch(args.length | 0){ case 0: return un ? fn() : fn.call(that); case 1: return un ? fn(args[0]) : fn.call(that, args[0]); case 2: return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]); case 3: return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]); case 4: return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]); case 5: return un ? fn(args[0], args[1], args[2], args[3], args[4]) : fn.call(that, args[0], args[1], args[2], args[3], args[4]); } return fn.apply(that, args); } function construct(target, argumentsList /*, newTarget*/){ var proto = assertFunction(arguments.length < 3 ? target : arguments[2])[PROTOTYPE] , instance = create(isObject(proto) ? proto : ObjectProto) , result = apply.call(target, instance, argumentsList); return isObject(result) ? result : instance; } // Object: var create = Object.create , getPrototypeOf = Object.getPrototypeOf , setPrototypeOf = Object.setPrototypeOf , defineProperty = Object.defineProperty , defineProperties = Object.defineProperties , getOwnDescriptor = Object.getOwnPropertyDescriptor , getKeys = Object.keys , getNames = Object.getOwnPropertyNames , getSymbols = Object.getOwnPropertySymbols , isFrozen = Object.isFrozen , has = ctx(call, ObjectProto[HAS_OWN], 2) // Dummy, fix for not array-like ES3 string in es5 module , ES5Object = Object , Dict; function toObject(it){ return ES5Object(assertDefined(it)); } function returnIt(it){ return it; } function returnThis(){ return this; } function get(object, key){ if(has(object, key))return object[key]; } function ownKeys(it){ assertObject(it); return getSymbols ? getNames(it).concat(getSymbols(it)) : getNames(it); } // 19.1.2.1 Object.assign(target, source, ...) var assign = Object.assign || function(target, source){ var T = Object(assertDefined(target)) , l = arguments.length , i = 1; while(l > i){ var S = ES5Object(arguments[i++]) , keys = getKeys(S) , length = keys.length , j = 0 , key; while(length > j)T[key = keys[j++]] = S[key]; } return T; } function keyOf(object, el){ var O = toObject(object) , keys = getKeys(O) , length = keys.length , index = 0 , key; while(length > index)if(O[key = keys[index++]] === el)return key; } // Array // array('str1,str2,str3') => ['str1', 'str2', 'str3'] function array(it){ return String(it).split(','); } var push = ArrayProto.push , unshift = ArrayProto.unshift , slice = ArrayProto.slice , splice = ArrayProto.splice , indexOf = ArrayProto.indexOf , forEach = ArrayProto[FOR_EACH]; /* * 0 -> forEach * 1 -> map * 2 -> filter * 3 -> some * 4 -> every * 5 -> find * 6 -> findIndex */ function createArrayMethod(type){ var isMap = type == 1 , isFilter = type == 2 , isSome = type == 3 , isEvery = type == 4 , isFindIndex = type == 6 , noholes = type == 5 || isFindIndex; return function(callbackfn/*, that = undefined */){ var O = Object(assertDefined(this)) , that = arguments[1] , self = ES5Object(O) , f = ctx(callbackfn, that, 3) , length = toLength(self.length) , index = 0 , result = isMap ? Array(length) : isFilter ? [] : undefined , val, res; for(;length > index; index++)if(noholes || index in self){ val = self[index]; res = f(val, index, O); if(type){ if(isMap)result[index] = res; // map else if(res)switch(type){ case 3: return true; // some case 5: return val; // find case 6: return index; // findIndex case 2: result.push(val); // filter } else if(isEvery)return false; // every } } return isFindIndex ? -1 : isSome || isEvery ? isEvery : result; } } function createArrayContains(isContains){ return function(el /*, fromIndex = 0 */){ var O = toObject(this) , length = toLength(O.length) , index = toIndex(arguments[1], length); if(isContains && el != el){ for(;length > index; index++)if(sameNaN(O[index]))return isContains || index; } else for(;length > index; index++)if(isContains || index in O){ if(O[index] === el)return isContains || index; } return !isContains && -1; } } function generic(A, B){ // strange IE quirks mode bug -> use typeof vs isFunction return typeof A == 'function' ? A : B; } // Math var MAX_SAFE_INTEGER = 0x1fffffffffffff // pow(2, 53) - 1 == 9007199254740991 , ceil = Math.ceil , floor = Math.floor , max = Math.max , min = Math.min , random = Math.random , trunc = Math.trunc || function(it){ return (it > 0 ? floor : ceil)(it); } // 20.1.2.4 Number.isNaN(number) function sameNaN(number){ return number != number; } // 7.1.4 ToInteger function toInteger(it){ return isNaN(it) ? 0 : trunc(it); } // 7.1.15 ToLength function toLength(it){ return it > 0 ? min(toInteger(it), MAX_SAFE_INTEGER) : 0; } function toIndex(index, length){ var index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); } function createReplacer(regExp, replace, isStatic){ var replacer = isObject(replace) ? function(part){ return replace[part]; } : replace; return function(it){ return String(isStatic ? it : this).replace(regExp, replacer); } } function createPointAt(toString){ return function(pos){ var s = String(assertDefined(this)) , i = toInteger(pos) , l = s.length , a, b; if(i < 0 || i >= l)return toString ? '' : undefined; a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? toString ? s.charAt(i) : a : toString ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; } } // Assertion & errors var REDUCE_ERROR = 'Reduce of empty object with no initial value'; function assert(condition, msg1, msg2){ if(!condition)throw TypeError(msg2 ? msg1 + msg2 : msg1); } function assertDefined(it){ if(it == undefined)throw TypeError('Function called on null or undefined'); return it; } function assertFunction(it){ assert(isFunction(it), it, ' is not a function!'); return it; } function assertObject(it){ assert(isObject(it), it, ' is not an object!'); return it; } function assertInstance(it, Constructor, name){ assert(it instanceof Constructor, name, ": use the 'new' operator!"); } // Property descriptors & Symbol function descriptor(bitmap, value){ return { enumerable : !(bitmap & 1), configurable: !(bitmap & 2), writable : !(bitmap & 4), value : value } } function simpleSet(object, key, value){ object[key] = value; return object; } function createDefiner(bitmap){ return DESC ? function(object, key, value){ return defineProperty(object, key, descriptor(bitmap, value)); } : simpleSet; } function uid(key){ return SYMBOL + '(' + key + ')_' + (++sid + random())[TO_STRING](36); } function getWellKnownSymbol(name, setter){ return (Symbol && Symbol[name]) || (setter ? Symbol : safeSymbol)(SYMBOL + DOT + name); } // The engine works fine with descriptors? Thank's IE8 for his funny defineProperty. var DESC = !!function(){try{return defineProperty({}, DOT, ObjectProto)}catch(e){}}() , sid = 0 , hidden = createDefiner(1) , set = Symbol ? simpleSet : hidden , safeSymbol = Symbol || uid; function assignHidden(target, src){ for(var key in src)hidden(target, key, src[key]); return target; } var SYMBOL_UNSCOPABLES = getWellKnownSymbol('unscopables') , ArrayUnscopables = ArrayProto[SYMBOL_UNSCOPABLES] || {} , SYMBOL_SPECIES = getWellKnownSymbol('species'); function setSpecies(C){ if(framework || !isNative(C))defineProperty(C, SYMBOL_SPECIES, { configurable: true, get: returnThis }); } // Iterators var SYMBOL_ITERATOR = getWellKnownSymbol(ITERATOR) , SYMBOL_TAG = getWellKnownSymbol(TO_STRING_TAG) , SUPPORT_FF_ITER = FF_ITERATOR in ArrayProto , ITER = safeSymbol('iter') , KEY = 1 , VALUE = 2 , Iterators = {} , IteratorPrototype = {} , NATIVE_ITERATORS = SYMBOL_ITERATOR in ArrayProto // Safari define byggy iterators w/o `next` , BUGGY_ITERATORS = 'keys' in ArrayProto && !('next' in [].keys()); // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() setIterator(IteratorPrototype, returnThis); function setIterator(O, value){ hidden(O, SYMBOL_ITERATOR, value); // Add iterator for FF iterator protocol SUPPORT_FF_ITER && hidden(O, FF_ITERATOR, value); } function createIterator(Constructor, NAME, next, proto){ Constructor[PROTOTYPE] = create(proto || IteratorPrototype, {next: descriptor(1, next)}); setToStringTag(Constructor, NAME + ' Iterator'); } function defineIterator(Constructor, NAME, value, DEFAULT){ var proto = Constructor[PROTOTYPE] , iter = get(proto, SYMBOL_ITERATOR) || get(proto, FF_ITERATOR) || (DEFAULT && get(proto, DEFAULT)) || value; if(framework){ // Define iterator setIterator(proto, iter); if(iter !== value){ var iterProto = getPrototypeOf(iter.call(new Constructor)); // Set @@toStringTag to native iterators setToStringTag(iterProto, NAME + ' Iterator', true); // FF fix has(proto, FF_ITERATOR) && setIterator(iterProto, returnThis); } } // Plug for library Iterators[NAME] = iter; // FF & v8 fix Iterators[NAME + ' Iterator'] = returnThis; return iter; } function defineStdIterators(Base, NAME, Constructor, next, DEFAULT, IS_SET){ function createIter(kind){ return function(){ return new Constructor(this, kind); } } createIterator(Constructor, NAME, next); var entries = createIter(KEY+VALUE) , values = createIter(VALUE); if(DEFAULT == VALUE)values = defineIterator(Base, NAME, values, 'values'); else entries = defineIterator(Base, NAME, entries, 'entries'); if(DEFAULT){ $define(PROTO + FORCED * BUGGY_ITERATORS, NAME, { entries: entries, keys: IS_SET ? values : createIter(KEY), values: values }); } } function iterResult(done, value){ return {value: value, done: !!done}; } function isIterable(it){ var O = Object(it) , Symbol = global[SYMBOL] , hasExt = (Symbol && Symbol[ITERATOR] || FF_ITERATOR) in O; return hasExt || SYMBOL_ITERATOR in O || has(Iterators, classof(O)); } function getIterator(it){ var Symbol = global[SYMBOL] , ext = it[Symbol && Symbol[ITERATOR] || FF_ITERATOR] , getIter = ext || it[SYMBOL_ITERATOR] || Iterators[classof(it)]; return assertObject(getIter.call(it)); } function stepCall(fn, value, entries){ return entries ? invoke(fn, value) : fn(value); } function forOf(iterable, entries, fn, that){ var iterator = getIterator(iterable) , f = ctx(fn, that, entries ? 2 : 1) , step; while(!(step = iterator.next()).done)if(stepCall(f, step.value, entries) === false)return; } // core var NODE = cof(process) == PROCESS , core = {} , path = framework ? global : core , old = global.core , exportGlobal // type bitmap , FORCED = 1 , GLOBAL = 2 , STATIC = 4 , PROTO = 8 , BIND = 16 , WRAP = 32; function $define(type, name, source){ var key, own, out, exp , isGlobal = type & GLOBAL , target = isGlobal ? global : (type & STATIC) ? global[name] : (global[name] || ObjectProto)[PROTOTYPE] , exports = isGlobal ? core : core[name] || (core[name] = {}); if(isGlobal)source = name; for(key in source){ // there is a similar native own = !(type & FORCED) && target && key in target && (!isFunction(target[key]) || isNative(target[key])); // export native or passed out = (own ? target : source)[key]; // bind timers to global for call from export context if(type & BIND && own)exp = ctx(out, global); // wrap global constructors for prevent change them in library else if(type & WRAP && !framework && target[key] == out){ exp = function(param){ return this instanceof out ? new out(param) : out(param); } exp[PROTOTYPE] = out[PROTOTYPE]; } else exp = type & PROTO && isFunction(out) ? ctx(call, out) : out; // export if(exports[key] != out)hidden(exports, key, exp); // extend global if(framework && target && !own){ if(isGlobal)target[key] = out; else delete target[key] && hidden(target, key, out); } } } // CommonJS export if(typeof module != 'undefined' && module.exports)module.exports = core; // RequireJS export else if(isFunction(define) && define.amd)define(function(){return core}); // Export to global object else exportGlobal = true; if(exportGlobal || framework){ core.noConflict = function(){ global.core = old; return core; } global.core = core; } /****************************************************************************** * Module : es5 * ******************************************************************************/ // ECMAScript 5 shim !function(IS_ENUMERABLE, Empty, _classof, $PROTO){ if(!DESC){ getOwnDescriptor = function(O, P){ if(has(O, P))return descriptor(!ObjectProto[IS_ENUMERABLE].call(O, P), O[P]); }; defineProperty = function(O, P, Attributes){ if('value' in Attributes)assertObject(O)[P] = Attributes.value; return O; }; defineProperties = function(O, Properties){ assertObject(O); var keys = getKeys(Properties) , length = keys.length , i = 0 , P, Attributes; while(length > i){ P = keys[i++]; Attributes = Properties[P]; if('value' in Attributes)O[P] = Attributes.value; } return O; }; } $define(STATIC + FORCED * !DESC, OBJECT, { // 19.1.2.6 / 15.2.3.3 Object.getOwnPropertyDescriptor(O, P) getOwnPropertyDescriptor: getOwnDescriptor, // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) defineProperty: defineProperty, // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) defineProperties: defineProperties }); // IE 8- don't enum bug keys var keys1 = [CONSTRUCTOR, HAS_OWN, 'isPrototypeOf', IS_ENUMERABLE, TO_LOCALE, TO_STRING, 'valueOf'] // Additional keys for getOwnPropertyNames , keys2 = keys1.concat('length', PROTOTYPE) , keysLen1 = keys1.length; // Create object with `null` prototype: use iframe Object with cleared prototype function createDict(){ // Thrash, waste and sodomy: IE GC bug var iframe = document[CREATE_ELEMENT]('iframe') , i = keysLen1 , iframeDocument; iframe.style.display = 'none'; html.appendChild(iframe); iframe.src = 'javascript:'; // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write('<script>document.F=Object</script>'); iframeDocument.close(); createDict = iframeDocument.F; while(i--)delete createDict[PROTOTYPE][keys1[i]]; return createDict(); } function createGetKeys(names, length, isNames){ return function(object){ var O = toObject(object) , i = 0 , result = [] , key; for(key in O)if(key != $PROTO)has(O, key) && result.push(key); // Don't enum bug & hidden keys while(length > i)if(has(O, key = names[i++])){ ~indexOf.call(result, key) || result.push(key); } return result; } } function isPrimitive(it){ return !isObject(it) } $define(STATIC, OBJECT, { // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) getPrototypeOf: getPrototypeOf = getPrototypeOf || function(O){ O = Object(assertDefined(O)); if(has(O, $PROTO))return O[$PROTO]; if(isFunction(O[CONSTRUCTOR]) && O instanceof O[CONSTRUCTOR]){ return O[CONSTRUCTOR][PROTOTYPE]; } return O instanceof Object ? ObjectProto : null; }, // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) getOwnPropertyNames: getNames = getNames || createGetKeys(keys2, keys2.length, true), // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) create: create = create || function(O, /*?*/Properties){ var result if(O !== null){ Empty[PROTOTYPE] = assertObject(O); result = new Empty(); Empty[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf shim if(result[CONSTRUCTOR][PROTOTYPE] !== O)result[$PROTO] = O; } else result = createDict(); return Properties === undefined ? result : defineProperties(result, Properties); }, // 19.1.2.14 / 15.2.3.14 Object.keys(O) keys: getKeys = getKeys || createGetKeys(keys1, keysLen1, false), // 19.1.2.17 / 15.2.3.8 Object.seal(O) seal: returnIt, // <- cap // 19.1.2.5 / 15.2.3.9 Object.freeze(O) freeze: returnIt, // <- cap // 19.1.2.15 / 15.2.3.10 Object.preventExtensions(O) preventExtensions: returnIt, // <- cap // 19.1.2.13 / 15.2.3.11 Object.isSealed(O) isSealed: isPrimitive, // <- cap // 19.1.2.12 / 15.2.3.12 Object.isFrozen(O) isFrozen: isFrozen = isFrozen || isPrimitive, // <- cap // 19.1.2.11 / 15.2.3.13 Object.isExtensible(O) isExtensible: isObject // <- cap }); // 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) $define(PROTO, FUNCTION, { bind: function(that /*, args... */){ var fn = assertFunction(this) , partArgs = slice.call(arguments, 1); function bound(/* args... */){ var args = partArgs.concat(slice.call(arguments)); return this instanceof bound ? construct(fn, args) : invoke(fn, args, that); } return bound; } }); // Fix for not array-like ES3 string function arrayMethodFix(fn){ return function(){ return fn.apply(ES5Object(this), arguments); } } if(!(0 in Object(DOT) && DOT[0] == DOT)){ ES5Object = function(it){ return cof(it) == STRING ? it.split('') : Object(it); } slice = arrayMethodFix(slice); } $define(PROTO + FORCED * (ES5Object != Object), ARRAY, { slice: slice, join: arrayMethodFix(ArrayProto.join) }); // 22.1.2.2 / 15.4.3.2 Array.isArray(arg) $define(STATIC, ARRAY, { isArray: function(arg){ return cof(arg) == ARRAY } }); function createArrayReduce(isRight){ return function(callbackfn, memo){ assertFunction(callbackfn); var O = toObject(this) , length = toLength(O.length) , index = isRight ? length - 1 : 0 , i = isRight ? -1 : 1; if(2 > arguments.length)for(;;){ if(index in O){ memo = O[index]; index += i; break; } index += i; assert(isRight ? index >= 0 : length > index, REDUCE_ERROR); } for(;isRight ? index >= 0 : length > index; index += i)if(index in O){ memo = callbackfn(memo, O[index], index, this); } return memo; } } $define(PROTO, ARRAY, { // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) forEach: forEach = forEach || createArrayMethod(0), // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) map: createArrayMethod(1), // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) filter: createArrayMethod(2), // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) some: createArrayMethod(3), // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg]) every: createArrayMethod(4), // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) reduce: createArrayReduce(false), // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) reduceRight: createArrayReduce(true), // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) indexOf: indexOf = indexOf || createArrayContains(false), // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) lastIndexOf: function(el, fromIndex /* = @[*-1] */){ var O = toObject(this) , length = toLength(O.length) , index = length - 1; if(arguments.length > 1)index = min(index, toInteger(fromIndex)); if(index < 0)index = toLength(length + index); for(;index >= 0; index--)if(index in O)if(O[index] === el)return index; return -1; } }); // 21.1.3.25 / 15.5.4.20 String.prototype.trim() $define(PROTO, STRING, {trim: createReplacer(/^\s*([\s\S]*\S)?\s*$/, '$1')}); // 20.3.3.1 / 15.9.4.4 Date.now() $define(STATIC, DATE, {now: function(){ return +new Date; }}); if(_classof(function(){return arguments}()) == OBJECT)classof = function(it){ var cof = _classof(it); return cof == OBJECT && isFunction(it.callee) ? ARGUMENTS : cof; } }('propertyIsEnumerable', function(){}, classof, safeSymbol(PROTOTYPE)); /****************************************************************************** * Module : global * ******************************************************************************/ $define(GLOBAL + FORCED, {global: global}); /****************************************************************************** * Module : es6_symbol * ******************************************************************************/ // ECMAScript 6 symbols shim !function(TAG, SymbolRegistry, AllSymbols, setter){ // 19.4.1.1 Symbol([description]) if(!isNative(Symbol)){ Symbol = function(description){ assert(!(this instanceof Symbol), SYMBOL + ' is not a ' + CONSTRUCTOR); var tag = uid(description); AllSymbols[tag] = true; DESC && setter && defineProperty(ObjectProto, tag, { configurable: true, set: function(value){ hidden(this, tag, value); } }); return set(create(Symbol[PROTOTYPE]), TAG, tag); } hidden(Symbol[PROTOTYPE], TO_STRING, function(){ return this[TAG]; }); } $define(GLOBAL + WRAP, {Symbol: Symbol}); var symbolStatics = { // 19.4.2.1 Symbol.for(key) 'for': function(key){ return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = Symbol(key); }, // 19.4.2.4 Symbol.iterator iterator: SYMBOL_ITERATOR, // 19.4.2.5 Symbol.keyFor(sym) keyFor: part.call(keyOf, SymbolRegistry), // 19.4.2.10 Symbol.species species: SYMBOL_SPECIES, // 19.4.2.13 Symbol.toStringTag toStringTag: SYMBOL_TAG = getWellKnownSymbol(TO_STRING_TAG, true), // 19.4.2.14 Symbol.unscopables unscopables: SYMBOL_UNSCOPABLES, pure: safeSymbol, set: set, useSetter: function(){setter = true}, useSimple: function(){setter = false} }; // 19.4.2.2 Symbol.hasInstance // 19.4.2.3 Symbol.isConcatSpreadable // 19.4.2.6 Symbol.match // 19.4.2.8 Symbol.replace // 19.4.2.9 Symbol.search // 19.4.2.11 Symbol.split // 19.4.2.12 Symbol.toPrimitive forEach.call(array('hasInstance,isConcatSpreadable,match,replace,search,split,toPrimitive'), function(it){ symbolStatics[it] = getWellKnownSymbol(it); } ); $define(STATIC, SYMBOL, symbolStatics); setToStringTag(Symbol, SYMBOL); $define(STATIC + FORCED * !isNative(Symbol), OBJECT, { // 19.1.2.7 Object.getOwnPropertyNames(O) getOwnPropertyNames: function(it){ var names = getNames(toObject(it)), result = [], key, i = 0; while(names.length > i)has(AllSymbols, key = names[i++]) || result.push(key); return result; }, // 19.1.2.8 Object.getOwnPropertySymbols(O) getOwnPropertySymbols: function(it){ var names = getNames(toObject(it)), result = [], key, i = 0; while(names.length > i)has(AllSymbols, key = names[i++]) && result.push(key); return result; } }); }(safeSymbol('tag'), {}, {}, true); /****************************************************************************** * Module : es6 * ******************************************************************************/ // ECMAScript 6 shim !function(RegExpProto, isFinite, tmp, NAME){ var RangeError = global.RangeError // 20.1.2.3 Number.isInteger(number) , isInteger = Number.isInteger || function(it){ return !isObject(it) && isFinite(it) && floor(it) === it; } // 20.2.2.28 Math.sign(x) , sign = Math.sign || function sign(x){ return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; } , E = Math.E , pow = Math.pow , abs = Math.abs , exp = Math.exp , log = Math.log , sqrt = Math.sqrt , fcc = String.fromCharCode , at = createPointAt(true); var objectStatic = { // 19.1.3.1 Object.assign(target, source) assign: assign, // 19.1.3.10 Object.is(value1, value2) is: function(x, y){ return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; } }; // 19.1.3.19 Object.setPrototypeOf(O, proto) // Works with __proto__ only. Old v8 can't works with null proto objects. '__proto__' in ObjectProto && function(buggy, set){ try { set = ctx(call, getOwnDescriptor(ObjectProto, '__proto__').set, 2); set({}, ArrayProto); } catch(e){ buggy = true } objectStatic.setPrototypeOf = setPrototypeOf = setPrototypeOf || function(O, proto){ assertObject(O); assert(proto === null || isObject(proto), proto, ": can't set as prototype!"); if(buggy)O.__proto__ = proto; else set(O, proto); return O; } }(); $define(STATIC, OBJECT, objectStatic); // 20.2.2.5 Math.asinh(x) function asinh(x){ return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log(x + sqrt(x * x + 1)); } // 20.2.2.14 Math.expm1(x) function expm1(x){ return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1; } $define(STATIC, NUMBER, { // 20.1.2.1 Number.EPSILON EPSILON: pow(2, -52), // 20.1.2.2 Number.isFinite(number) isFinite: function(it){ return typeof it == 'number' && isFinite(it); }, // 20.1.2.3 Number.isInteger(number) isInteger: isInteger, // 20.1.2.4 Number.isNaN(number) isNaN: sameNaN, // 20.1.2.5 Number.isSafeInteger(number) isSafeInteger: function(number){ return isInteger(number) && abs(number) <= MAX_SAFE_INTEGER; }, // 20.1.2.6 Number.MAX_SAFE_INTEGER MAX_SAFE_INTEGER: MAX_SAFE_INTEGER, // 20.1.2.10 Number.MIN_SAFE_INTEGER MIN_SAFE_INTEGER: -MAX_SAFE_INTEGER, // 20.1.2.12 Number.parseFloat(string) parseFloat: parseFloat, // 20.1.2.13 Number.parseInt(string, radix) parseInt: parseInt }); $define(STATIC, MATH, { // 20.2.2.3 Math.acosh(x) acosh: function(x){ return (x = +x) < 1 ? NaN : isFinite(x) ? log(x / E + sqrt(x + 1) * sqrt(x - 1) / E) + 1 : x; }, // 20.2.2.5 Math.asinh(x) asinh: asinh, // 20.2.2.7 Math.atanh(x) atanh: function(x){ return (x = +x) == 0 ? x : log((1 + x) / (1 - x)) / 2; }, // 20.2.2.9 Math.cbrt(x) cbrt: function(x){ return sign(x = +x) * pow(abs(x), 1 / 3); }, // 20.2.2.11 Math.clz32(x) clz32: function(x){ return (x >>>= 0) ? 32 - x[TO_STRING](2).length : 32; }, // 20.2.2.12 Math.cosh(x) cosh: function(x){ return (exp(x = +x) + exp(-x)) / 2; }, // 20.2.2.14 Math.expm1(x) expm1: expm1, // 20.2.2.16 Math.fround(x) // TODO: fallback for IE9- fround: function(x){ return new Float32Array([x])[0]; }, // 20.2.2.17 Math.hypot([value1[, value2[, … ]]]) hypot: function(value1, value2){ var sum = 0 , len1 = arguments.length , len2 = len1 , args = Array(len1) , larg = -Infinity , arg; while(len1--){ arg = args[len1] = +arguments[len1]; if(arg == Infinity || arg == -Infinity)return Infinity; if(arg > larg)larg = arg; } larg = arg || 1; while(len2--)sum += pow(args[len2] / larg, 2); return larg * sqrt(sum); }, // 20.2.2.18 Math.imul(x, y) imul: function(x, y){ var UInt16 = 0xffff , xn = +x , yn = +y , xl = UInt16 & xn , yl = UInt16 & yn; return 0 | xl * yl + ((UInt16 & xn >>> 16) * yl + xl * (UInt16 & yn >>> 16) << 16 >>> 0); }, // 20.2.2.20 Math.log1p(x) log1p: function(x){ return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + x); }, // 20.2.2.21 Math.log10(x) log10: function(x){ return log(x) / Math.LN10; }, // 20.2.2.22 Math.log2(x) log2: function(x){ return log(x) / Math.LN2; }, // 20.2.2.28 Math.sign(x) sign: sign, // 20.2.2.30 Math.sinh(x) sinh: function(x){ return (abs(x = +x) < 1) ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (E / 2); }, // 20.2.2.33 Math.tanh(x) tanh: function(x){ var a = expm1(x = +x) , b = expm1(-x); return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); }, // 20.2.2.34 Math.trunc(x) trunc: trunc }); // 20.2.1.9 Math[@@toStringTag] setToStringTag(Math, MATH, true); function assertNotRegExp(it){ if(cof(it) == REGEXP)throw TypeError(); } $define(STATIC, STRING, { // 21.1.2.2 String.fromCodePoint(...codePoints) fromCodePoint: function(x){ var res = [] , len = arguments.length , i = 0 , code while(len > i){ code = +arguments[i++]; if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point'); res.push(code < 0x10000 ? fcc(code) : fcc(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) ); } return res.join(''); }, // 21.1.2.4 String.raw(callSite, ...substitutions) raw: function(callSite){ var raw = toObject(callSite.raw) , len = toLength(raw.length) , sln = arguments.length , res = [] , i = 0; while(len > i){ res.push(String(raw[i++])); if(i < sln)res.push(String(arguments[i])); } return res.join(''); } }); $define(PROTO, STRING, { // 21.1.3.3 String.prototype.codePointAt(pos) codePointAt: createPointAt(false), // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) endsWith: function(searchString /*, endPosition = @length */){ assertNotRegExp(searchString); var that = String(assertDefined(this)) , endPosition = arguments[1] , len = toLength(that.length) , end = endPosition === undefined ? len : min(toLength(endPosition), len); searchString += ''; return that.slice(end - searchString.length, end) === searchString; }, // 21.1.3.7 String.prototype.includes(searchString, position = 0) includes: function(searchString /*, position = 0 */){ assertNotRegExp(searchString); return !!~String(assertDefined(this)).indexOf(searchString, arguments[1]); }, // 21.1.3.13 String.prototype.repeat(count) repeat: function(count){ var str = String(assertDefined(this)) , res = '' , n = toInteger(count); if(0 > n || n == Infinity)throw RangeError("Count can't be negative"); for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str; return res; }, // 21.1.3.18 String.prototype.startsWith(searchString [, position ]) startsWith: function(searchString /*, position = 0 */){ assertNotRegExp(searchString); var that = String(assertDefined(this)) , index = toLength(min(arguments[1], that.length)); searchString += ''; return that.slice(index, index + searchString.length) === searchString; } }); // 21.1.3.27 String.prototype[@@iterator]() defineStdIterators(String, STRING, function(iterated){ set(this, ITER, {o: String(iterated), i: 0}); // 21.1.5.2.1 %StringIteratorPrototype%.next() }, function(){ var iter = this[ITER] , O = iter.o , index = iter.i , point; if(index >= O.length)return iterResult(1); point = at.call(O, index); iter.i += point.length; return iterResult(0, point); }); $define(STATIC, ARRAY, { // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) from: function(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ var O = Object(assertDefined(arrayLike)) , result = new (generic(this, Array)) , mapfn = arguments[1] , that = arguments[2] , mapping = mapfn !== undefined , f = mapping ? ctx(mapfn, that, 2) : undefined , index = 0 , length; if(isIterable(O))for(var iter = getIterator(O), step; !(step = iter.next()).done; index++){ result[index] = mapping ? f(step.value, index) : step.value; } else for(length = toLength(O.length); length > index; index++){ result[index] = mapping ? f(O[index], index) : O[index]; } result.length = index; return result; }, // 22.1.2.3 Array.of( ...items) of: function(/* ...args */){ var index = 0 , length = arguments.length , result = new (generic(this, Array))(length); while(length > index)result[index] = arguments[index++]; result.length = length; return result; } }); $define(PROTO, ARRAY, { // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) copyWithin: function(target /* = 0 */, start /* = 0, end = @length */){ var O = Object(assertDefined(this)) , len = toLength(O.length) , to = toIndex(target, len) , from = toIndex(start, len) , end = arguments[2] , fin = end === undefined ? len : toIndex(end, len) , count = min(fin - from, len - to) , inc = 1; if(from < to && to < from + count){ inc = -1; from = from + count - 1; to = to + count - 1; } while(count-- > 0){ if(from in O)O[to] = O[from]; else delete O[to]; to += inc; from += inc; } return O; }, // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) fill: function(value /*, start = 0, end = @length */){ var O = Object(assertDefined(this)) , length = toLength(O.length) , index = toIndex(arguments[1], length) , end = arguments[2] , endPos = end === undefined ? length : toIndex(end, length); while(endPos > index)O[index++] = value; return O; }, // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) find: createArrayMethod(5), // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) findIndex: createArrayMethod(6) }); // 22.1.3.4 Array.prototype.entries() // 22.1.3.13 Array.prototype.keys() // 22.1.3.29 Array.prototype.values() // 22.1.3.30 Array.prototype[@@iterator]() defineStdIterators(Array, ARRAY, function(iterated, kind){ set(this, ITER, {o: toObject(iterated), i: 0, k: kind}); // 22.1.5.2.1 %ArrayIteratorPrototype%.next() }, function(){ var iter = this[ITER] , O = iter.o , kind = iter.k , index = iter.i++; if(!O || index >= O.length)return iter.o = undefined, iterResult(1); if(kind == KEY) return iterResult(0, index); if(kind == VALUE)return iterResult(0, O[index]); return iterResult(0, [index, O[index]]); }, VALUE); // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) Iterators[ARGUMENTS] = Iterators[ARRAY]; // 24.3.3 JSON[@@toStringTag] setToStringTag(global.JSON, 'JSON', true); // Object static methods accept primitives function wrapObjectMethod(key, MODE){ var fn = Object[key] , exp = core[OBJECT][key] , f = 0 , o = {}; if(!exp || isNative(exp)){ o[key] = MODE == 1 ? function(it){ return isObject(it) ? fn(it) : it } : MODE == 2 ? function(it){ return isObject(it) ? fn(it) : true } : MODE == 3 ? function(it){ return isObject(it) ? fn(it) : false } : MODE == 4 ? function(it, key){ return fn(toObject(it), key) } : function(it){ return fn(toObject(it)) } try { fn(DOT) } catch(e){ f = 1} $define(STATIC + FORCED * f, OBJECT, o); } } wrapObjectMethod('freeze', 1); wrapObjectMethod('seal', 1); wrapObjectMethod('preventExtensions', 1); wrapObjectMethod('isFrozen', 2); wrapObjectMethod('isSealed', 2); wrapObjectMethod('isExtensible', 3); wrapObjectMethod('getOwnPropertyDescriptor', 4); wrapObjectMethod('getPrototypeOf'); wrapObjectMethod('keys'); wrapObjectMethod('getOwnPropertyNames'); if(framework){ // 19.1.3.6 Object.prototype.toString() tmp[SYMBOL_TAG] = DOT; if(cof(tmp) != DOT)hidden(ObjectProto, TO_STRING, function(){ return '[object ' + classof(this) + ']'; }); // 19.2.4.2 name NAME in FunctionProto || defineProperty(FunctionProto, NAME, { configurable: true, get: function(){ var match = String(this).match(/^\s*function ([^ (]*)/) , name = match ? match[1] : ''; has(this, NAME) || defineProperty(this, NAME, descriptor(5, name)); return name; }, set: function(value){ has(this, NAME) || defineProperty(this, NAME, descriptor(0, value)); } }); // RegExp allows a regex with flags as the pattern if(DESC && !function(){try{return RegExp(/a/g, 'i') == '/a/i'}catch(e){}}()){ var _RegExp = RegExp; RegExp = function RegExp(pattern, flags){ return new _RegExp(cof(pattern) == REGEXP && flags !== undefined ? pattern.source : pattern, flags); } forEach.call(getNames(_RegExp), function(key){ key in RegExp || defineProperty(RegExp, key, { configurable: true, get: function(){ return _RegExp[key] }, set: function(it){ _RegExp[key] = it } }); }); RegExpProto[CONSTRUCTOR] = RegExp; RegExp[PROTOTYPE] = RegExpProto; hidden(global, REGEXP, RegExp); } // 21.2.5.3 get RegExp.prototype.flags() if(/./g.flags != 'g')defineProperty(RegExpProto, 'flags', { configurable: true, get: createReplacer(/^.*\/(\w*)$/, '$1') }); // 22.1.3.31 Array.prototype[@@unscopables] forEach.call(array('find,findIndex,fill,copyWithin,entries,keys,values'), function(it){ ArrayUnscopables[it] = true; }); SYMBOL_UNSCOPABLES in ArrayProto || hidden(ArrayProto, SYMBOL_UNSCOPABLES, ArrayUnscopables); } setSpecies(RegExp); setSpecies(Array); }(RegExp[PROTOTYPE], isFinite, {}, 'name'); /****************************************************************************** * Module : immediate * ******************************************************************************/ // setImmediate shim // Node.js 0.9+ & IE10+ has setImmediate, else: isFunction(setImmediate) && isFunction(clearImmediate) || function(ONREADYSTATECHANGE){ var postMessage = global.postMessage , addEventListener = global.addEventListener , MessageChannel = global.MessageChannel , counter = 0 , queue = {} , defer, channel, port; setImmediate = function(fn){ var args = [], i = 1; while(arguments.length > i)args.push(arguments[i++]); queue[++counter] = function(){ invoke(isFunction(fn) ? fn : Function(fn), args); } defer(counter); return counter; } clearImmediate = function(id){ delete queue[id]; } function run(id){ if(has(queue, id)){ var fn = queue[id]; delete queue[id]; fn(); } } function listner(event){ run(event.data); } // Node.js 0.8- if(NODE){ defer = function(id){ nextTick(part.call(run, id)); } // Modern browsers, skip implementation for WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is object } else if(addEventListener && isFunction(postMessage) && !global.importScripts){ defer = function(id){ postMessage(id, '*'); } addEventListener('message', listner, false); // WebWorkers } else if(isFunction(MessageChannel)){ channel = new MessageChannel; port = channel.port2; channel.port1.onmessage = listner; defer = ctx(port.postMessage, port, 1); // IE8- } else if(document && ONREADYSTATECHANGE in document[CREATE_ELEMENT]('script')){ defer = function(id){ html.appendChild(document[CREATE_ELEMENT]('script'))[ONREADYSTATECHANGE] = function(){ html.removeChild(this); run(id); } } // Rest old browsers } else { defer = function(id){ setTimeout(part.call(run, id), 0); } } }('onreadystatechange'); $define(GLOBAL + BIND, { setImmediate: setImmediate, clearImmediate: clearImmediate }); /****************************************************************************** * Module : es6_promise * ******************************************************************************/ // ES6 promises shim // Based on https://github.com/getify/native-promise-only/ !function(Promise, test){ isFunction(Promise) && isFunction(Promise.resolve) && Promise.resolve(test = new Promise(function(){})) == test || function(asap, DEF){ function isThenable(o){ var then; if(isObject(o))then = o.then; return isFunction(then) ? then : false; } function notify(def){ var chain = def.chain; chain.length && asap(function(){ var msg = def.msg , ok = def.state == 1 , i = 0; while(chain.length > i)!function(react){ var cb = ok ? react.ok : react.fail , ret, then; try { if(cb){ ret = cb === true ? msg : cb(msg); if(ret === react.P){ react.rej(TypeError(PROMISE + '-chain cycle')); } else if(then = isThenable(ret)){ then.call(ret, react.res, react.rej); } else react.res(ret); } else react.rej(msg); } catch(err){ react.rej(err); } }(chain[i++]); chain.length = 0; }); } function resolve(msg){ var def = this , then, wrapper; if(def.done)return; def.done = true; def = def.def || def; // unwrap try { if(then = isThenable(msg)){ wrapper = {def: def, done: false}; // wrap then.call(msg, ctx(resolve, wrapper, 1), ctx(reject, wrapper, 1)); } else { def.msg = msg; def.state = 1; notify(def); } } catch(err){ reject.call(wrapper || {def: def, done: false}, err); // wrap } } function reject(msg){ var def = this; if(def.done)return; def.done = true; def = def.def || def; // unwrap def.msg = msg; def.state = 2; notify(def); } function getConstructor(C){ var S = assertObject(C)[SYMBOL_SPECIES]; return S != undefined ? S : C; } // 25.4.3.1 Promise(executor) Promise = function(executor){ assertFunction(executor); assertInstance(this, Promise, PROMISE); var def = {chain: [], state: 0, done: false, msg: undefined}; hidden(this, DEF, def); try { executor(ctx(resolve, def, 1), ctx(reject, def, 1)); } catch(err){ reject.call(def, err); } } assignHidden(Promise[PROTOTYPE], { // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) then: function(onFulfilled, onRejected){ var S = assertObject(assertObject(this)[CONSTRUCTOR])[SYMBOL_SPECIES]; var react = { ok: isFunction(onFulfilled) ? onFulfilled : true, fail: isFunction(onRejected) ? onRejected : false } , P = react.P = new (S != undefined ? S : Promise)(function(resolve, reject){ react.res = assertFunction(resolve); react.rej = assertFunction(reject); }), def = this[DEF]; def.chain.push(react); def.state && notify(def); return P; }, // 25.4.5.1 Promise.prototype.catch(onRejected) 'catch': function(onRejected){ return this.then(undefined, onRejected); } }); assignHidden(Promise, { // 25.4.4.1 Promise.all(iterable) all: function(iterable){ var Promise = getConstructor(this) , values = []; return new Promise(function(resolve, reject){ forOf(iterable, false, push, values); var remaining = values.length , results = Array(remaining); if(remaining)forEach.call(values, function(promise, index){ Promise.resolve(promise).then(function(value){ results[index] = value; --remaining || resolve(results); }, reject); }); else resolve(results); }); }, // 25.4.4.4 Promise.race(iterable) race: function(iterable){ var Promise = getConstructor(this); return new Promise(function(resolve, reject){ forOf(iterable, false, function(promise){ Promise.resolve(promise).then(resolve, reject); }); }); }, // 25.4.4.5 Promise.reject(r) reject: function(r){ return new (getConstructor(this))(function(resolve, reject){ reject(r); }); }, // 25.4.4.6 Promise.resolve(x) resolve: function(x){ return isObject(x) && DEF in x && getPrototypeOf(x) === this[PROTOTYPE] ? x : new (getConstructor(this))(function(resolve, reject){ resolve(x); }); } }); }(nextTick || setImmediate, safeSymbol('def')); setToStringTag(Promise, PROMISE); setSpecies(Promise); $define(GLOBAL + FORCED * !isNative(Promise), {Promise: Promise}); }(global[PROMISE]); /****************************************************************************** * Module : es6_collections * ******************************************************************************/ // ECMAScript 6 collections shim !function(){ var UID = safeSymbol('uid') , O1 = safeSymbol('O1') , WEAK = safeSymbol('weak') , LEAK = safeSymbol('leak') , LAST = safeSymbol('last') , FIRST = safeSymbol('first') , SIZE = DESC ? safeSymbol('size') : 'size' , uid = 0; function getCollection(C, NAME, methods, commonMethods, isMap, isWeak){ var ADDER = isMap ? 'set' : 'add' , proto = C && C[PROTOTYPE] , O = {}; function initFromIterable(that, iterable){ if(iterable != undefined)forOf(iterable, isMap, that[ADDER], that); return that; } function fixSVZ(key, chain){ var method = proto[key]; framework && hidden(proto, key, function(a, b){ var result = method.call(this, a === 0 ? 0 : a, b); return chain ? this : result; }); } if(!isNative(C) || !(isWeak || (!BUGGY_ITERATORS && has(proto, 'entries')))){ // create collection constructor C = isWeak ? function(iterable){ assertInstance(this, C, NAME); set(this, UID, uid++); initFromIterable(this, iterable); } : function(iterable){ var that = this; assertInstance(that, C, NAME); set(that, O1, create(null)); set(that, SIZE, 0); set(that, LAST, undefined); set(that, FIRST, undefined); initFromIterable(that, iterable); }; assignHidden(assignHidden(C[PROTOTYPE], methods), commonMethods); isWeak || defineProperty(C[PROTOTYPE], 'size', {get: function(){ return assertDefined(this[SIZE]); }}); } else { var Native = C , inst = new C , chain = inst[ADDER](isWeak ? {} : -0, 1) , buggyZero; // wrap to init collections from iterable if(!NATIVE_ITERATORS || !C.length){ C = function(iterable){ assertInstance(this, C, NAME); return initFromIterable(new Native, iterable); } C[PROTOTYPE] = proto; } isWeak || inst[FOR_EACH](function(val, key){ buggyZero = 1 / key === -Infinity; }); // fix converting -0 key to +0 if(buggyZero){ fixSVZ('delete'); fixSVZ('has'); isMap && fixSVZ('get'); } // + fix .add & .set for chaining if(buggyZero || chain !== inst)fixSVZ(ADDER, true); } setToStringTag(C, NAME); setSpecies(C); O[NAME] = C; $define(GLOBAL + WRAP + FORCED * !isNative(C), O); // 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 isWeak || defineStdIterators(C, NAME, function(iterated, kind){ set(this, ITER, {o: iterated, k: kind}); }, function(){ var iter = this[ITER] , O = iter.o , kind = iter.k , entry = iter.l; while(entry && entry.r)entry = entry.p; if(!O || !(iter.l = entry = entry ? entry.n : O[FIRST]))return iter.o = undefined, iterResult(1); if(kind == KEY) return iterResult(0, entry.k); if(kind == VALUE)return iterResult(0, entry.v); return iterResult(0, [entry.k, entry.v]); }, isMap ? KEY+VALUE : VALUE, !isMap); return C; } function fastKey(it, create){ // return it with 'S' prefix if it's string or with 'P' prefix for over primitives if(!isObject(it))return (typeof it == 'string' ? 'S' : 'P') + it; if(isFrozen(it))return 'F'; // if it hasn't object id - add next if(!has(it, UID)){ if(create)hidden(it, UID, ++uid); else return 'E'; } // return object id with 'O' prefix return 'O' + it[UID]; } function getEntry(that, key){ var index = fastKey(key) , entry = that[FIRST]; if(index != 'F')return that[O1][index]; if(entry)do { if(entry.k == key)return entry; } while(entry = entry.n); } function def(that, key, value){ var last = that[LAST] , entry = getEntry(that, key) , index; if(entry)entry.v = value; else { index = fastKey(key, true); that[LAST] = entry = {k: key, v: value, p: last, i: index, r: false, n: undefined}; if(!that[FIRST])that[FIRST] = entry; if(last)last.n = entry; that[SIZE]++; if(index != 'F')that[O1][index] = entry; } return that; } var collectionMethods = { // 23.1.3.1 Map.prototype.clear() // 23.2.3.2 Set.prototype.clear() clear: function(){ var data = this[O1] , entry = this[FIRST]; if(entry)do { entry.r = true; delete data[entry.i]; } while(entry = entry.n); this[SIZE] = 0; }, // 23.1.3.3 Map.prototype.delete(key) // 23.2.3.4 Set.prototype.delete(value) 'delete': function(key){ var entry = getEntry(this, key); if(entry){ var that = this , next = entry.n , prev = entry.p; delete that[O1][entry.i]; entry.r = true; if(prev)prev.n = next; if(next)next.p = prev; if(that[FIRST] == entry)that[FIRST] = next; if(that[LAST] == entry)that[LAST] = 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(callbackfn /*, that = undefined */){ var f = ctx(callbackfn, arguments[1], 3) , entry; while(entry = entry ? entry.n : this[FIRST]){ f(entry.v, entry.k, this); 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(key){ return !!getEntry(this, key); } } // 23.1 Map Objects Map = getCollection(Map, MAP, { // 23.1.3.6 Map.prototype.get(key) get: function(key){ var entry = getEntry(this, key); return entry && entry.v; }, // 23.1.3.9 Map.prototype.set(key, value) set: function(key, value){ return def(this, key === 0 ? 0 : key, value); } }, collectionMethods, true); // 23.2 Set Objects Set = getCollection(Set, SET, { // 23.2.3.1 Set.prototype.add(value) add: function(value){ return def(this, value = value === 0 ? 0 : value, value); } }, collectionMethods); function defWeak(that, key, value){ if(isFrozen(assertObject(key)))leakStore(that).set(key, value); else { has(key, WEAK) || hidden(key, WEAK, {}); key[WEAK][that[UID]] = value; } return that; } function leakStore(that){ return that[LEAK] || hidden(that, LEAK, new Map)[LEAK]; } var weakMethods = { // 23.3.3.2 WeakMap.prototype.delete(key) // 23.4.3.3 WeakSet.prototype.delete(value) 'delete': function(key){ if(!isObject(key))return false; if(isFrozen(key))return leakStore(this)['delete'](key); return has(key, WEAK) && has(key[WEAK], this[UID]) && delete key[WEAK][this[UID]]; }, // 23.3.3.4 WeakMap.prototype.has(key) // 23.4.3.4 WeakSet.prototype.has(value) has: function(key){ if(!isObject(key))return false; if(isFrozen(key))return leakStore(this).has(key); return has(key, WEAK) && has(key[WEAK], this[UID]); } }; // 23.3 WeakMap Objects WeakMap = getCollection(WeakMap, WEAKMAP, { // 23.3.3.3 WeakMap.prototype.get(key) get: function(key){ if(isObject(key)){ if(isFrozen(key))return leakStore(this).get(key); return has(key, WEAK) ? key[WEAK][this[UID]] : undefined; } }, // 23.3.3.5 WeakMap.prototype.set(key, value) set: function(key, value){ return defWeak(this, key, value); } }, weakMethods, true, true); // 23.4 WeakSet Objects WeakSet = getCollection(WeakSet, WEAKSET, { // 23.4.3.1 WeakSet.prototype.add(value) add: function(value){ return defWeak(this, value, true); } }, weakMethods, false, true); }(); /****************************************************************************** * Module : es6_reflect * ******************************************************************************/ !function(){ function Enumerate(iterated){ var keys = [], key; for(key in iterated)keys.push(key); set(this, ITER, {o: iterated, a: keys, i: 0}); } createIterator(Enumerate, OBJECT, function(){ var iter = this[ITER] , keys = iter.a , key; do { if(iter.i >= keys.length)return iterResult(1); } while(!((key = keys[iter.i++]) in iter.o)); return iterResult(0, key); }); function wrap(fn){ return function(it){ assertObject(it); try { return fn.apply(undefined, arguments), true; } catch(e){ return false; } } } function reflectGet(target, propertyKey/*, receiver*/){ var receiver = arguments.length < 3 ? target : arguments[2] , desc = getOwnDescriptor(assertObject(target), propertyKey), proto; if(desc)return desc.get ? desc.get.call(receiver) : desc.value; return isObject(proto = getPrototypeOf(target)) ? reflectGet(proto, propertyKey, receiver) : undefined; } function reflectSet(target, propertyKey, V/*, receiver*/){ var receiver = arguments.length < 4 ? target : arguments[3] , desc = getOwnDescriptor(assertObject(target), propertyKey), proto; if(desc){ if(desc.writable === false)return false; if(desc.set)return desc.set.call(receiver, V), true; } if(isObject(proto = getPrototypeOf(target)))return reflectSet(proto, propertyKey, V, receiver); desc = getOwnDescriptor(receiver, propertyKey) || descriptor(0); desc.value = V; return defineProperty(receiver, propertyKey, desc), true; } var isExtensible = Object.isExtensible || returnIt; var reflect = { // 26.1.1 Reflect.apply(target, thisArgument, argumentsList) apply: ctx(call, apply, 3), // 26.1.2 Reflect.construct(target, argumentsList [, newTarget]) construct: construct, // 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) defineProperty: wrap(defineProperty), // 26.1.4 Reflect.deleteProperty(target, propertyKey) deleteProperty: function(target, propertyKey){ var desc = getOwnDescriptor(assertObject(target), propertyKey); return desc && !desc.configurable ? false : delete target[propertyKey]; }, // 26.1.5 Reflect.enumerate(target) enumerate: function(target){ return new Enumerate(assertObject(target)); }, // 26.1.6 Reflect.get(target, propertyKey [, receiver]) get: reflectGet, // 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey) getOwnPropertyDescriptor: function(target, propertyKey){ return getOwnDescriptor(assertObject(target), propertyKey); }, // 26.1.8 Reflect.getPrototypeOf(target) getPrototypeOf: function(target){ return getPrototypeOf(assertObject(target)); }, // 26.1.9 Reflect.has(target, propertyKey) has: function(target, propertyKey){ return propertyKey in target; }, // 26.1.10 Reflect.isExtensible(target) isExtensible: function(target){ return !!isExtensible(assertObject(target)); }, // 26.1.11 Reflect.ownKeys(target) ownKeys: ownKeys, // 26.1.12 Reflect.preventExtensions(target) preventExtensions: wrap(Object.preventExtensions || returnIt), // 26.1.13 Reflect.set(target, propertyKey, V [, receiver]) set: reflectSet } // 26.1.14 Reflect.setPrototypeOf(target, proto) if(setPrototypeOf)reflect.setPrototypeOf = function(target, proto){ return setPrototypeOf(assertObject(target), proto), true; }; $define(GLOBAL, {Reflect: {}}); $define(STATIC, 'Reflect', reflect); }(); /****************************************************************************** * Module : es7 * ******************************************************************************/ !function(){ $define(PROTO, ARRAY, { // https://github.com/domenic/Array.prototype.includes includes: createArrayContains(true) }); $define(PROTO, STRING, { // https://github.com/mathiasbynens/String.prototype.at at: createPointAt(true) }); function createObjectToArray(isEntries){ return function(object){ var O = toObject(object) , keys = getKeys(object) , length = keys.length , i = 0 , result = Array(length) , key; if(isEntries)while(length > i)result[i] = [key = keys[i++], O[key]]; else while(length > i)result[i] = O[keys[i++]]; return result; } } $define(STATIC, OBJECT, { // https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-04/apr-9.md#51-objectentries-objectvalues values: createObjectToArray(false), entries: createObjectToArray(true) }); $define(STATIC, REGEXP, { // https://gist.github.com/kangax/9698100 escape: createReplacer(/([\\\-[\]{}()*+?.,^$|])/g, '\\$1', true) }); }(); /****************************************************************************** * Module : es7_refs * ******************************************************************************/ // https://github.com/zenparsing/es-abstract-refs !function(REFERENCE){ REFERENCE_GET = getWellKnownSymbol(REFERENCE+'Get', true); var REFERENCE_SET = getWellKnownSymbol(REFERENCE+SET, true) , REFERENCE_DELETE = getWellKnownSymbol(REFERENCE+'Delete', true); $define(STATIC, SYMBOL, { referenceGet: REFERENCE_GET, referenceSet: REFERENCE_SET, referenceDelete: REFERENCE_DELETE }); hidden(FunctionProto, REFERENCE_GET, returnThis); function setMapMethods(Constructor){ if(Constructor){ var MapProto = Constructor[PROTOTYPE]; hidden(MapProto, REFERENCE_GET, MapProto.get); hidden(MapProto, REFERENCE_SET, MapProto.set); hidden(MapProto, REFERENCE_DELETE, MapProto['delete']); } } setMapMethods(Map); setMapMethods(WeakMap); }('reference'); /****************************************************************************** * Module : dom_itarable * ******************************************************************************/ !function(NodeList){ if(framework && NodeList && !(SYMBOL_ITERATOR in NodeList[PROTOTYPE])){ hidden(NodeList[PROTOTYPE], SYMBOL_ITERATOR, Iterators[ARRAY]); } Iterators.NodeList = Iterators[ARRAY]; }(global.NodeList); /****************************************************************************** * Module : timers * ******************************************************************************/ // ie9- setTimeout & setInterval additional parameters fix !function(MSIE){ function wrap(set){ return MSIE ? function(fn, time /*, ...args */){ return set(invoke(part, slice.call(arguments, 2), isFunction(fn) ? fn : Function(fn)), time); } : set; } $define(GLOBAL + BIND + FORCED * MSIE, { setTimeout: setTimeout = wrap(setTimeout), setInterval: wrap(setInterval) }); // ie9- dirty check }(!!navigator && /MSIE .\./.test(navigator.userAgent)); /****************************************************************************** * Module : array_statics * ******************************************************************************/ // JavaScript 1.6 / Strawman array statics shim !function(arrayStatics){ function setArrayStatics(keys, length){ forEach.call(array(keys), function(key){ if(key in ArrayProto)arrayStatics[key] = ctx(call, ArrayProto[key], length); }); } setArrayStatics('pop,reverse,shift,keys,values,entries', 1); setArrayStatics('indexOf,every,some,forEach,map,filter,find,findIndex,includes', 3); setArrayStatics('join,slice,concat,push,splice,unshift,sort,lastIndexOf,' + 'reduce,reduceRight,copyWithin,fill,turn'); $define(STATIC, ARRAY, arrayStatics); }({}); /****************************************************************************** * Module : console * ******************************************************************************/ !function(console, enabled){ var _console = { enable: function(){ enabled = true }, disable: function(){ enabled = false } }; // Methods from: // https://github.com/DeveloperToolsWG/console-object/blob/master/api.md // https://developer.mozilla.org/en-US/docs/Web/API/console forEach.call(array('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,isIndependentlyComposed,log,markTimeline,profile,' + 'profileEnd,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn'), function(key){ var fn = console[key]; _console[key] = function(){ if(enabled && fn)return apply.call(fn, console, arguments); }; } ); // console methods in some browsers are not configurable try { framework && delete global.console; } catch(e){} $define(GLOBAL + FORCED, {console: _console}); }(global.console || {}, true); }(typeof self != 'undefined' && self.Math === Math ? self : Function('return this')(), true);
Showfom/cdnjs
ajax/libs/core-js/0.4.7/shim.js
JavaScript
mit
69,268
<?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\Process; use Symfony\Component\Process\Exception\InvalidArgumentException; /** * ProcessUtils is a bunch of utility methods. * * This class contains static methods only and is not meant to be instantiated. * * @author Martin Hasoň <martin.hason@gmail.com> */ class ProcessUtils { /** * This class should not be instantiated. */ private function __construct() { } /** * Escapes a string to be used as a shell argument. * * @param string $argument The argument that will be escaped * * @return string The escaped argument */ public static function escapeArgument($argument) { //Fix for PHP bug #43784 escapeshellarg removes % from given string //Fix for PHP bug #49446 escapeshellarg doesn't work on Windows //@see https://bugs.php.net/bug.php?id=43784 //@see https://bugs.php.net/bug.php?id=49446 if ('\\' === DIRECTORY_SEPARATOR) { if ('' === $argument) { return escapeshellarg($argument); } $escapedArgument = ''; $quote = false; foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) { if ('"' === $part) { $escapedArgument .= '\\"'; } elseif (self::isSurroundedBy($part, '%')) { // Avoid environment variable expansion $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%'; } else { // escape trailing backslash if ('\\' === substr($part, -1)) { $part .= '\\'; } $quote = true; $escapedArgument .= $part; } } if ($quote) { $escapedArgument = '"'.$escapedArgument.'"'; } return $escapedArgument; } return escapeshellarg($argument); } /** * Validates and normalizes a Process input. * * @param string $caller The name of method call that validates the input * @param mixed $input The input to validate * * @return string The validated input * * @throws InvalidArgumentException In case the input is not valid */ public static function validateInput($caller, $input) { if (null !== $input) { if (is_resource($input)) { return $input; } if (is_scalar($input)) { return (string) $input; } throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller)); } return $input; } private static function isSurroundedBy($arg, $char) { return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1]; } }
benbyford/bb-starter
modules/AutoSmush/image-optimizer/vendor/symfony/process/ProcessUtils.php
PHP
mit
3,192
/** * Core.js 0.4.2 * https://github.com/zloirock/core-js * License: http://rock.mit-license.org * © 2015 Denis Pushkarev */ !function(returnThis, framework, undefined){ 'use strict'; /****************************************************************************** * Module : common * ******************************************************************************/ var global = returnThis() // Shortcuts for [[Class]] & property names , OBJECT = 'Object' , FUNCTION = 'Function' , ARRAY = 'Array' , STRING = 'String' , NUMBER = 'Number' , REGEXP = 'RegExp' , DATE = 'Date' , MAP = 'Map' , SET = 'Set' , WEAKMAP = 'WeakMap' , WEAKSET = 'WeakSet' , SYMBOL = 'Symbol' , PROMISE = 'Promise' , MATH = 'Math' , ARGUMENTS = 'Arguments' , PROTOTYPE = 'prototype' , CONSTRUCTOR = 'constructor' , TO_STRING = 'toString' , TO_STRING_TAG = TO_STRING + 'Tag' , TO_LOCALE = 'toLocaleString' , HAS_OWN = 'hasOwnProperty' , FOR_EACH = 'forEach' , ITERATOR = 'iterator' , FF_ITERATOR = '@@' + ITERATOR , PROCESS = 'process' , CREATE_ELEMENT = 'createElement' // Aliases global objects and prototypes , Function = global[FUNCTION] , Object = global[OBJECT] , Array = global[ARRAY] , String = global[STRING] , Number = global[NUMBER] , RegExp = global[REGEXP] , Date = global[DATE] , Map = global[MAP] , Set = global[SET] , WeakMap = global[WEAKMAP] , WeakSet = global[WEAKSET] , Symbol = global[SYMBOL] , Math = global[MATH] , TypeError = global.TypeError , setTimeout = global.setTimeout , setImmediate = global.setImmediate , clearImmediate = global.clearImmediate , process = global[PROCESS] , nextTick = process && process.nextTick , document = global.document , html = document && document.documentElement , navigator = global.navigator , define = global.define , ArrayProto = Array[PROTOTYPE] , ObjectProto = Object[PROTOTYPE] , FunctionProto = Function[PROTOTYPE] , Infinity = 1 / 0 , DOT = '.'; // http://jsperf.com/core-js-isobject function isObject(it){ return it != null && (typeof it == 'object' || typeof it == 'function'); } function isFunction(it){ return typeof it == 'function'; } // Native function? var isNative = ctx(/./.test, /\[native code\]\s*\}\s*$/, 1); // Object internal [[Class]] or toStringTag // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring var buildIn = { Undefined: 1, Null: 1, Array: 1, String: 1, Arguments: 1, Function: 1, Error: 1, Boolean: 1, Number: 1, Date: 1, RegExp:1 } , toString = ObjectProto[TO_STRING]; function setToStringTag(it, tag, stat){ if(it && !has(it = stat ? it : it[PROTOTYPE], SYMBOL_TAG))hidden(it, SYMBOL_TAG, tag); } function cof(it){ return it == undefined ? it === undefined ? 'Undefined' : 'Null' : toString.call(it).slice(8, -1); } function classof(it){ var klass = cof(it), tag; return klass == OBJECT && (tag = it[SYMBOL_TAG]) ? has(buildIn, tag) ? '~' + tag : tag : klass; } // Function var call = FunctionProto.call , apply = FunctionProto.apply , REFERENCE_GET; // Partial apply function part(/* ...args */){ var length = arguments.length , args = Array(length) , i = 0 , _ = path._ , holder = false; while(length > i)if((args[i] = arguments[i++]) === _)holder = true; return partial(this, args, length, holder, _, false); } // Internal partial application & context binding function partial(fn, argsPart, lengthPart, holder, _, bind, context){ assertFunction(fn); return function(/* ...args */){ var that = bind ? context : this , length = arguments.length , i = 0, j = 0, args; if(!holder && !length)return invoke(fn, argsPart, that); args = argsPart.slice(); if(holder)for(;lengthPart > i; i++)if(args[i] === _)args[i] = arguments[j++]; while(length > j)args.push(arguments[j++]); return invoke(fn, args, that); } } // Optional / simple context binding function ctx(fn, that, length){ assertFunction(fn); if(~length && that === undefined)return fn; switch(length){ case 1: return function(a){ return fn.call(that, a); } case 2: return function(a, b){ return fn.call(that, a, b); } case 3: return function(a, b, c){ return fn.call(that, a, b, c); } } return function(/* ...args */){ return fn.apply(that, arguments); } } // Fast apply // http://jsperf.lnkit.com/fast-apply/5 function invoke(fn, args, that){ var un = that === undefined; switch(args.length | 0){ case 0: return un ? fn() : fn.call(that); case 1: return un ? fn(args[0]) : fn.call(that, args[0]); case 2: return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]); case 3: return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]); case 4: return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]); case 5: return un ? fn(args[0], args[1], args[2], args[3], args[4]) : fn.call(that, args[0], args[1], args[2], args[3], args[4]); } return fn.apply(that, args); } function construct(target, argumentsList){ var instance = create(target[PROTOTYPE]) , result = apply.call(target, instance, argumentsList); return isObject(result) ? result : instance; } // Object: var create = Object.create , getPrototypeOf = Object.getPrototypeOf , setPrototypeOf = Object.setPrototypeOf , defineProperty = Object.defineProperty , defineProperties = Object.defineProperties , getOwnDescriptor = Object.getOwnPropertyDescriptor , getKeys = Object.keys , getNames = Object.getOwnPropertyNames , getSymbols = Object.getOwnPropertySymbols , has = ctx(call, ObjectProto[HAS_OWN], 2) // Dummy, fix for not array-like ES3 string in es5 module , ES5Object = Object; function returnIt(it){ return it; } function get(object, key){ if(has(object, key))return object[key]; } function ownKeys(it){ return getSymbols ? getNames(it).concat(getSymbols(it)) : getNames(it); } // 19.1.2.1 Object.assign(target, source, ...) var assign = Object.assign || function(target, source){ var T = Object(assertDefined(target)) , l = arguments.length , i = 1; while(l > i){ var S = ES5Object(arguments[i++]) , keys = getKeys(S) , length = keys.length , j = 0 , key; while(length > j)T[key = keys[j++]] = S[key]; } return T; } function keyOf(object, el){ var O = ES5Object(object) , keys = getKeys(O) , length = keys.length , index = 0 , key; while(length > index)if(O[key = keys[index++]] === el)return key; } // Array // array('str1,str2,str3') => ['str1', 'str2', 'str3'] function array(it){ return String(it).split(','); } var push = ArrayProto.push , unshift = ArrayProto.unshift , slice = ArrayProto.slice , splice = ArrayProto.splice , indexOf = ArrayProto.indexOf , forEach = ArrayProto[FOR_EACH]; /* * 0 -> forEach * 1 -> map * 2 -> filter * 3 -> some * 4 -> every * 5 -> find * 6 -> findIndex */ function createArrayMethod(type){ var isMap = type == 1 , isFilter = type == 2 , isSome = type == 3 , isEvery = type == 4 , isFindIndex = type == 6 , noholes = type == 5 || isFindIndex; return function(callbackfn/*, that = undefined */){ var O = Object(assertDefined(this)) , that = arguments[1] , self = ES5Object(O) , f = ctx(callbackfn, that, 3) , length = toLength(self.length) , index = 0 , result = isMap ? Array(length) : isFilter ? [] : undefined , val, res; for(;length > index; index++)if(noholes || index in self){ val = self[index]; res = f(val, index, O); if(type){ if(isMap)result[index] = res; // map else if(res)switch(type){ case 3: return true; // some case 5: return val; // find case 6: return index; // findIndex case 2: result.push(val); // filter } else if(isEvery)return false; // every } } return isFindIndex ? -1 : isSome || isEvery ? isEvery : result; } } function createArrayContains(isContains){ return function(el /*, fromIndex = 0 */){ var O = ES5Object(assertDefined(this)) , length = toLength(O.length) , index = toIndex(arguments[1], length); if(isContains && el != el){ for(;length > index; index++)if(sameNaN(O[index]))return isContains || index; } else for(;length > index; index++)if(isContains || index in O){ if(O[index] === el)return isContains || index; } return !isContains && -1; } } function generic(A, B){ // strange IE quirks mode bug -> use typeof vs isFunction return typeof A == 'function' ? A : B; } // Math var MAX_SAFE_INTEGER = 0x1fffffffffffff // pow(2, 53) - 1 == 9007199254740991 , ceil = Math.ceil , floor = Math.floor , max = Math.max , min = Math.min , random = Math.random , trunc = Math.trunc || function(it){ return (it > 0 ? floor : ceil)(it); } // 20.1.2.4 Number.isNaN(number) function sameNaN(number){ return number != number; } // 7.1.4 ToInteger function toInteger(it){ return isNaN(it) ? 0 : trunc(it); } // 7.1.15 ToLength function toLength(it){ return it > 0 ? min(toInteger(it), MAX_SAFE_INTEGER) : 0; } function toIndex(index, length){ var index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); } function createReplacer(regExp, replace, isStatic){ var replacer = isObject(replace) ? function(part){ return replace[part]; } : replace; return function(it){ return String(isStatic ? it : this).replace(regExp, replacer); } } function createPointAt(toString){ return function(pos){ var s = String(assertDefined(this)) , i = toInteger(pos) , l = s.length , a, b; if(i < 0 || i >= l)return toString ? '' : undefined; a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? toString ? s.charAt(i) : a : toString ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; } } // Assertion & errors var REDUCE_ERROR = 'Reduce of empty object with no initial value'; function assert(condition, msg1, msg2){ if(!condition)throw TypeError(msg2 ? msg1 + msg2 : msg1); } function assertDefined(it){ if(it == undefined)throw TypeError('Function called on null or undefined'); return it; } function assertFunction(it){ assert(isFunction(it), it, ' is not a function!'); return it; } function assertObject(it){ assert(isObject(it), it, ' is not an object!'); return it; } function assertInstance(it, Constructor, name){ assert(it instanceof Constructor, name, ": use the 'new' operator!"); } // Property descriptors & Symbol function descriptor(bitmap, value){ return { enumerable : !(bitmap & 1), configurable: !(bitmap & 2), writable : !(bitmap & 4), value : value } } function simpleSet(object, key, value){ object[key] = value; return object; } function createDefiner(bitmap){ return DESC ? function(object, key, value){ return defineProperty(object, key, descriptor(bitmap, value)); } : simpleSet; } function uid(key){ return SYMBOL + '(' + key + ')_' + (++sid + random())[TO_STRING](36); } function getWellKnownSymbol(name, setter){ return (Symbol && Symbol[name]) || (setter ? Symbol : safeSymbol)(SYMBOL + DOT + name); } // The engine works fine with descriptors? Thank's IE8 for his funny defineProperty. var DESC = !!function(){try{return defineProperty({}, DOT, ObjectProto)}catch(e){}}() , sid = 0 , hidden = createDefiner(1) , set = Symbol ? simpleSet : hidden , safeSymbol = Symbol || uid; function assignHidden(target, src){ for(var key in src)hidden(target, key, src[key]); return target; } var SYMBOL_UNSCOPABLES = getWellKnownSymbol('unscopables') , ArrayUnscopables = ArrayProto[SYMBOL_UNSCOPABLES] || {}; // Iterators var SYMBOL_ITERATOR = getWellKnownSymbol(ITERATOR) , SYMBOL_TAG = getWellKnownSymbol(TO_STRING_TAG) , SUPPORT_FF_ITER = FF_ITERATOR in ArrayProto , ITER = safeSymbol('iter') , KEY = 1 , VALUE = 2 , Iterators = {} , IteratorPrototype = {} , NATIVE_ITERATORS = SYMBOL_ITERATOR in ArrayProto // Safari define byggy iterators w/o `next` , BUGGY_ITERATORS = 'keys' in ArrayProto && !('next' in [].keys()); // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() setIterator(IteratorPrototype, returnThis); function setIterator(O, value){ hidden(O, SYMBOL_ITERATOR, value); // Add iterator for FF iterator protocol SUPPORT_FF_ITER && hidden(O, FF_ITERATOR, value); } function createIterator(Constructor, NAME, next, proto){ Constructor[PROTOTYPE] = create(proto || IteratorPrototype, {next: descriptor(1, next)}); setToStringTag(Constructor, NAME + ' Iterator'); } function defineIterator(Constructor, NAME, value, DEFAULT){ var proto = Constructor[PROTOTYPE] , iter = get(proto, SYMBOL_ITERATOR) || get(proto, FF_ITERATOR) || (DEFAULT && get(proto, DEFAULT)) || value; if(framework){ // Define iterator setIterator(proto, iter); if(iter !== value){ var iterProto = getPrototypeOf(iter.call(new Constructor)); // Set @@toStringTag to native iterators setToStringTag(iterProto, NAME + ' Iterator', true); // FF fix has(proto, FF_ITERATOR) && setIterator(iterProto, returnThis); } } // Plug for library Iterators[NAME] = iter; // FF & v8 fix Iterators[NAME + ' Iterator'] = returnThis; return iter; } function defineStdIterators(Base, NAME, Constructor, next, DEFAULT, IS_SET){ function createIter(kind){ return function(){ return new Constructor(this, kind); } } createIterator(Constructor, NAME, next); var entries = createIter(KEY+VALUE) , values = createIter(VALUE); if(DEFAULT == VALUE)values = defineIterator(Base, NAME, values, 'values'); else entries = defineIterator(Base, NAME, entries, 'entries'); if(DEFAULT){ $define(PROTO + FORCED * BUGGY_ITERATORS, NAME, { entries: entries, keys: IS_SET ? values : createIter(KEY), values: values }); } } function iterResult(done, value){ return {value: value, done: !!done}; } function isIterable(it){ var O = Object(it) , Symbol = global[SYMBOL] , hasExt = !!(Symbol && Symbol[ITERATOR] && Symbol[ITERATOR] in O); return hasExt || SYMBOL_ITERATOR in O || has(Iterators, classof(O)); } function getIterator(it){ var Symbol = global[SYMBOL] , ext = Symbol && Symbol[ITERATOR] && it[Symbol[ITERATOR]] , getIter = ext || it[SYMBOL_ITERATOR] || Iterators[classof(it)]; return assertObject(getIter.call(it)); } function stepCall(fn, value, entries){ return entries ? invoke(fn, value) : fn(value); } function forOf(iterable, entries, fn, that){ var iterator = getIterator(iterable) , f = ctx(fn, that, entries ? 2 : 1) , step; while(!(step = iterator.next()).done)if(stepCall(f, step.value, entries) === false)return; } // core var NODE = cof(process) == PROCESS , core = {} , path = framework ? global : core , old = global.core // type bitmap , FORCED = 1 , GLOBAL = 2 , STATIC = 4 , PROTO = 8 , BIND = 16 , WRAP = 32; function $define(type, name, source){ var key, own, out, exp , isGlobal = type & GLOBAL , target = isGlobal ? global : (type & STATIC) ? global[name] : (global[name] || ObjectProto)[PROTOTYPE] , exports = isGlobal ? core : core[name] || (core[name] = {}); if(isGlobal)source = name; for(key in source){ // there is a similar native own = !(type & FORCED) && target && key in target && (!isFunction(target[key]) || isNative(target[key])); // export native or passed out = (own ? target : source)[key]; // bind timers to global for call from export context if(type & BIND && own)exp = ctx(out, global); // wrap global constructors for prevent change them in library else if(type & WRAP && !framework && target[key] == out){ exp = function(param){ return this instanceof out ? new out(param) : out(param); } exp[PROTOTYPE] = out[PROTOTYPE]; } else exp = type & PROTO && isFunction(out) ? ctx(call, out) : out; // export if(exports[key] != out)hidden(exports, key, exp); // extend global if(framework && target && !own){ if(isGlobal)target[key] = out; else delete target[key] && hidden(target, key, out); } } } // CommonJS export if(typeof module != 'undefined' && module.exports)module.exports = core; // RequireJS export if(isFunction(define) && define.amd)define(function(){return core}); // Export to global object if(!NODE || framework){ core.noConflict = function(){ global.core = old; return core; } global.core = core; } /****************************************************************************** * Module : es5 * ******************************************************************************/ // ECMAScript 5 shim !function(IS_ENUMERABLE, Empty, _classof, $PROTO){ if(!DESC){ getOwnDescriptor = function(O, P){ if(has(O, P))return descriptor(!ObjectProto[IS_ENUMERABLE].call(O, P), O[P]); }; defineProperty = function(O, P, Attributes){ if('value' in Attributes)assertObject(O)[P] = Attributes.value; return O; }; defineProperties = function(O, Properties){ assertObject(O); var keys = getKeys(Properties) , length = keys.length , i = 0 , P, Attributes; while(length > i){ P = keys[i++]; Attributes = Properties[P]; if('value' in Attributes)O[P] = Attributes.value; } return O; }; } $define(STATIC + FORCED * !DESC, OBJECT, { // 19.1.2.6 / 15.2.3.3 Object.getOwnPropertyDescriptor(O, P) getOwnPropertyDescriptor: getOwnDescriptor, // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) defineProperty: defineProperty, // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) defineProperties: defineProperties }); // IE 8- don't enum bug keys var keys1 = [CONSTRUCTOR, HAS_OWN, 'isPrototypeOf', IS_ENUMERABLE, TO_LOCALE, TO_STRING, 'valueOf'] // Additional keys for getOwnPropertyNames , keys2 = keys1.concat('length', PROTOTYPE) , keysLen1 = keys1.length; // Create object with `null` prototype: use iframe Object with cleared prototype function createDict(){ // Thrash, waste and sodomy: IE GC bug var iframe = document[CREATE_ELEMENT]('iframe') , i = keysLen1 , iframeDocument; iframe.style.display = 'none'; html.appendChild(iframe); iframe.src = 'javascript:'; // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write('<script>document.F=Object</script>'); iframeDocument.close(); createDict = iframeDocument.F; while(i--)delete createDict[PROTOTYPE][keys1[i]]; return createDict(); } function createGetKeys(names, length, isNames){ return function(object){ var O = ES5Object(assertDefined(object)) , i = 0 , result = [] , key; for(key in O)if(key != $PROTO)has(O, key) && result.push(key); // Don't enum bug & hidden keys while(length > i)if(has(O, key = names[i++])){ ~indexOf.call(result, key) || result.push(key); } return result; } } function isPrimitive(it){ return !isObject(it) } $define(STATIC, OBJECT, { // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) getPrototypeOf: getPrototypeOf = getPrototypeOf || function(O){ if(has(assertObject(O), $PROTO))return O[$PROTO]; if(isFunction(O[CONSTRUCTOR]) && O instanceof O[CONSTRUCTOR]){ return O[CONSTRUCTOR][PROTOTYPE]; } return O instanceof Object ? ObjectProto : null; }, // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) getOwnPropertyNames: getNames = getNames || createGetKeys(keys2, keys2.length, true), // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) create: create = create || function(O, /*?*/Properties){ var result if(O !== null){ Empty[PROTOTYPE] = assertObject(O); result = new Empty(); Empty[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf shim if(result[CONSTRUCTOR][PROTOTYPE] !== O)result[$PROTO] = O; } else result = createDict(); return Properties === undefined ? result : defineProperties(result, Properties); }, // 19.1.2.14 / 15.2.3.14 Object.keys(O) keys: getKeys = getKeys || createGetKeys(keys1, keysLen1, false), // 19.1.2.17 / 15.2.3.8 Object.seal(O) seal: returnIt, // <- cap // 19.1.2.5 / 15.2.3.9 Object.freeze(O) freeze: returnIt, // <- cap // 19.1.2.15 / 15.2.3.10 Object.preventExtensions(O) preventExtensions: returnIt, // <- cap // 19.1.2.13 / 15.2.3.11 Object.isSealed(O) isSealed: isPrimitive, // <- cap // 19.1.2.12 / 15.2.3.12 Object.isFrozen(O) isFrozen: isPrimitive, // <- cap // 19.1.2.11 / 15.2.3.13 Object.isExtensible(O) isExtensible: isObject // <- cap }); // 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) $define(PROTO, FUNCTION, { bind: function(that /*, args... */){ var fn = assertFunction(this) , partArgs = slice.call(arguments, 1); function bound(/* args... */){ var args = partArgs.concat(slice.call(arguments)); return (this instanceof bound ? construct : invoke)(fn, args, that); } return bound; } }); // Fix for not array-like ES3 string function arrayMethodFix(fn){ return function(){ return fn.apply(ES5Object(this), arguments); } } if(!(0 in Object(DOT) && DOT[0] == DOT)){ ES5Object = function(it){ return cof(it) == STRING ? it.split('') : Object(it); } slice = arrayMethodFix(slice); } $define(PROTO + FORCED * (ES5Object != Object), ARRAY, { slice: slice, join: arrayMethodFix(ArrayProto.join) }); // 22.1.2.2 / 15.4.3.2 Array.isArray(arg) $define(STATIC, ARRAY, { isArray: function(arg){ return cof(arg) == ARRAY } }); function createArrayReduce(isRight){ return function(callbackfn, memo){ assertFunction(callbackfn); var O = ES5Object(this) , length = toLength(O.length) , index = isRight ? length - 1 : 0 , i = isRight ? -1 : 1; if(2 > arguments.length)for(;;){ if(index in O){ memo = O[index]; index += i; break; } index += i; assert(isRight ? index >= 0 : length > index, REDUCE_ERROR); } for(;isRight ? index >= 0 : length > index; index += i)if(index in O){ memo = callbackfn(memo, O[index], index, this); } return memo; } } $define(PROTO, ARRAY, { // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) forEach: forEach = forEach || createArrayMethod(0), // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) map: createArrayMethod(1), // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) filter: createArrayMethod(2), // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) some: createArrayMethod(3), // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg]) every: createArrayMethod(4), // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) reduce: createArrayReduce(false), // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) reduceRight: createArrayReduce(true), // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) indexOf: indexOf = indexOf || createArrayContains(false), // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) lastIndexOf: function(el, fromIndex /* = @[*-1] */){ var O = ES5Object(this) , length = toLength(O.length) , index = length - 1; if(arguments.length > 1)index = min(index, toInteger(fromIndex)); if(index < 0)index = toLength(length + index); for(;index >= 0; index--)if(index in O)if(O[index] === el)return index; return -1; } }); // 21.1.3.25 / 15.5.4.20 String.prototype.trim() $define(PROTO, STRING, {trim: createReplacer(/^\s*([\s\S]*\S)?\s*$/, '$1')}); // 20.3.3.1 / 15.9.4.4 Date.now() $define(STATIC, DATE, {now: function(){ return +new Date; }}); if(_classof(function(){return arguments}()) == OBJECT)classof = function(it){ var cof = _classof(it); return cof == OBJECT && isFunction(it.callee) ? ARGUMENTS : cof; } }('propertyIsEnumerable', Function(), classof, safeSymbol(PROTOTYPE)); /****************************************************************************** * Module : global * ******************************************************************************/ $define(GLOBAL + FORCED, {global: global}); /****************************************************************************** * Module : es6_symbol * ******************************************************************************/ // ECMAScript 6 symbols shim !function(TAG, SymbolRegistry, setter){ // 19.4.1.1 Symbol([description]) if(!isNative(Symbol)){ Symbol = function(description){ assert(!(this instanceof Symbol), SYMBOL + ' is not a ' + CONSTRUCTOR); var tag = uid(description); DESC && setter && defineProperty(ObjectProto, tag, { configurable: true, set: function(value){ hidden(this, tag, value); } }); return set(create(Symbol[PROTOTYPE]), TAG, tag); } hidden(Symbol[PROTOTYPE], TO_STRING, function(){ return this[TAG]; }); } $define(GLOBAL + WRAP, {Symbol: Symbol}); var symbolStatics = { // 19.4.2.1 Symbol.for(key) 'for': function(key){ return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = Symbol(key); }, // 19.4.2.4 Symbol.iterator iterator: SYMBOL_ITERATOR, // 19.4.2.5 Symbol.keyFor(sym) keyFor: part.call(keyOf, SymbolRegistry), // 19.4.2.13 Symbol.toStringTag toStringTag: SYMBOL_TAG = getWellKnownSymbol(TO_STRING_TAG, true), // 19.4.2.14 Symbol.unscopables unscopables: SYMBOL_UNSCOPABLES, pure: safeSymbol, set: set, useSetter: function(){setter = true}, useSimple: function(){setter = false} }; // 19.4.2.2 Symbol.hasInstance // 19.4.2.3 Symbol.isConcatSpreadable // 19.4.2.6 Symbol.match // 19.4.2.8 Symbol.replace // 19.4.2.9 Symbol.search // 19.4.2.10 Symbol.species // 19.4.2.11 Symbol.split // 19.4.2.12 Symbol.toPrimitive forEach.call(array('hasInstance,isConcatSpreadable,match,replace,search,' + 'species,split,toPrimitive'), function(it){ symbolStatics[it] = getWellKnownSymbol(it); } ); $define(STATIC, SYMBOL, symbolStatics); setToStringTag(Symbol, SYMBOL); // 26.1.11 Reflect.ownKeys(target) $define(GLOBAL, {Reflect: {ownKeys: ownKeys}}); }(safeSymbol('tag'), {}, true); /****************************************************************************** * Module : es6 * ******************************************************************************/ // ECMAScript 6 shim !function(RegExpProto, isFinite, tmp){ var RangeError = global.RangeError // 20.1.2.3 Number.isInteger(number) , isInteger = Number.isInteger || function(it){ return !isObject(it) && isFinite(it) && floor(it) === it; } // 20.2.2.28 Math.sign(x) , sign = Math.sign || function sign(it){ return (it = +it) == 0 || it != it ? it : it < 0 ? -1 : 1; } , pow = Math.pow , abs = Math.abs , exp = Math.exp , log = Math.log , sqrt = Math.sqrt , fcc = String.fromCharCode , at = createPointAt(true); var objectStatic = { // 19.1.3.1 Object.assign(target, source) assign: assign, // 19.1.3.10 Object.is(value1, value2) is: function(x, y){ return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; } }; // 19.1.3.19 Object.setPrototypeOf(O, proto) // Works with __proto__ only. Old v8 can't works with null proto objects. '__proto__' in ObjectProto && function(buggy, set){ try { set = ctx(call, getOwnDescriptor(ObjectProto, '__proto__').set, 2); set({}, ArrayProto); } catch(e){ buggy = true } objectStatic.setPrototypeOf = setPrototypeOf = setPrototypeOf || function(O, proto){ assertObject(O); assert(proto === null || isObject(proto), proto, ": can't set as prototype!"); if(buggy)O.__proto__ = proto; else set(O, proto); return O; } }(); $define(STATIC, OBJECT, objectStatic); // 20.2.2.5 Math.asinh(x) function asinh(x){ return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log(x + sqrt(x * x + 1)); } $define(STATIC, NUMBER, { // 20.1.2.1 Number.EPSILON EPSILON: pow(2, -52), // 20.1.2.2 Number.isFinite(number) isFinite: function(it){ return typeof it == 'number' && isFinite(it); }, // 20.1.2.3 Number.isInteger(number) isInteger: isInteger, // 20.1.2.4 Number.isNaN(number) isNaN: sameNaN, // 20.1.2.5 Number.isSafeInteger(number) isSafeInteger: function(number){ return isInteger(number) && abs(number) <= MAX_SAFE_INTEGER; }, // 20.1.2.6 Number.MAX_SAFE_INTEGER MAX_SAFE_INTEGER: MAX_SAFE_INTEGER, // 20.1.2.10 Number.MIN_SAFE_INTEGER MIN_SAFE_INTEGER: -MAX_SAFE_INTEGER, // 20.1.2.12 Number.parseFloat(string) parseFloat: parseFloat, // 20.1.2.13 Number.parseInt(string, radix) parseInt: parseInt }); $define(STATIC, MATH, { // 20.2.2.3 Math.acosh(x) acosh: function(x){ return x < 1 ? NaN : log(x + sqrt(x * x - 1)); }, // 20.2.2.5 Math.asinh(x) asinh: asinh, // 20.2.2.7 Math.atanh(x) atanh: function(x){ return x == 0 ? +x : log((1 + +x) / (1 - x)) / 2; }, // 20.2.2.9 Math.cbrt(x) cbrt: function(x){ return sign(x) * pow(abs(x), 1 / 3); }, // 20.2.2.11 Math.clz32(x) clz32: function(x){ return (x >>>= 0) ? 32 - x[TO_STRING](2).length : 32; }, // 20.2.2.12 Math.cosh(x) cosh: function(x){ return (exp(x) + exp(-x)) / 2; }, // 20.2.2.14 Math.expm1(x) expm1: function(x){ return x == 0 ? +x : x > -1e-6 && x < 1e-6 ? +x + x * x / 2 : exp(x) - 1; }, // 20.2.2.16 Math.fround(x) // TODO: fallback for IE9- fround: function(x){ return new Float32Array([x])[0]; }, // 20.2.2.17 Math.hypot([value1[, value2[, … ]]]) // TODO: work with very large & small numbers hypot: function(value1, value2){ var sum = 0 , length = arguments.length , value; while(length--){ value = +arguments[length]; if(value == Infinity || value == -Infinity)return Infinity; sum += value * value; } return sqrt(sum); }, // 20.2.2.18 Math.imul(x, y) imul: function(x, y){ var UInt16 = 0xffff , xn = +x , yn = +y , xl = UInt16 & xn , yl = UInt16 & yn; return 0 | xl * yl + ((UInt16 & xn >>> 16) * yl + xl * (UInt16 & yn >>> 16) << 16 >>> 0); }, // 20.2.2.20 Math.log1p(x) log1p: function(x){ return x > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + +x); }, // 20.2.2.21 Math.log10(x) log10: function(x){ return log(x) / Math.LN10; }, // 20.2.2.22 Math.log2(x) log2: function(x){ return log(x) / Math.LN2; }, // 20.2.2.28 Math.sign(x) sign: sign, // 20.2.2.30 Math.sinh(x) sinh: function(x){ return x == 0 ? +x : (exp(x) - exp(-x)) / 2; }, // 20.2.2.33 Math.tanh(x) tanh: function(x){ return isFinite(x) ? x == 0 ? +x : (exp(x) - exp(-x)) / (exp(x) + exp(-x)) : sign(x); }, // 20.2.2.34 Math.trunc(x) trunc: trunc }); // 20.2.1.9 Math[@@toStringTag] setToStringTag(Math, MATH, true); function assertNotRegExp(it){ if(cof(it) == REGEXP)throw TypeError(); } $define(STATIC, STRING, { // 21.1.2.2 String.fromCodePoint(...codePoints) fromCodePoint: function(x){ var res = [] , len = arguments.length , i = 0 , code while(len > i){ code = +arguments[i++]; if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point'); res.push(code < 0x10000 ? fcc(code) : fcc(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) ); } return res.join(''); }, // 21.1.2.4 String.raw(callSite, ...substitutions) raw: function(callSite){ var raw = ES5Object(assertDefined(callSite.raw)) , len = toLength(raw.length) , sln = arguments.length , res = [] , i = 0; while(len > i){ res.push(String(raw[i++])); if(i < sln)res.push(String(arguments[i])); } return res.join(''); } }); $define(PROTO, STRING, { // 21.1.3.3 String.prototype.codePointAt(pos) codePointAt: createPointAt(false), // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) endsWith: function(searchString /*, endPosition = @length */){ assertNotRegExp(searchString); var that = String(assertDefined(this)) , endPosition = arguments[1] , len = toLength(that.length) , end = endPosition === undefined ? len : min(toLength(endPosition), len); searchString += ''; return that.slice(end - searchString.length, end) === searchString; }, // 21.1.3.7 String.prototype.includes(searchString, position = 0) includes: function(searchString /*, position = 0 */){ assertNotRegExp(searchString); return !!~String(assertDefined(this)).indexOf(searchString, arguments[1]); }, // 21.1.3.13 String.prototype.repeat(count) repeat: function(count){ var str = String(assertDefined(this)) , res = '' , n = toInteger(count); if(0 > n || n == Infinity)throw RangeError("Count can't be negative"); for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str; return res; }, // 21.1.3.18 String.prototype.startsWith(searchString [, position ]) startsWith: function(searchString /*, position = 0 */){ assertNotRegExp(searchString); var that = String(assertDefined(this)) , index = toLength(min(arguments[1], that.length)); searchString += ''; return that.slice(index, index + searchString.length) === searchString; } }); // 21.1.3.27 String.prototype[@@iterator]() defineStdIterators(String, STRING, function(iterated){ set(this, ITER, {o: String(iterated), i: 0}); // 21.1.5.2.1 %StringIteratorPrototype%.next() }, function(){ var iter = this[ITER] , O = iter.o , index = iter.i , point; if(index >= O.length)return iterResult(1); point = at.call(O, index); iter.i += point.length; return iterResult(0, point); }); $define(STATIC, ARRAY, { // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) from: function(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ var O = Object(assertDefined(arrayLike)) , result = new (generic(this, Array)) , mapfn = arguments[1] , that = arguments[2] , mapping = mapfn !== undefined , f = mapping ? ctx(mapfn, that, 2) : undefined , index = 0 , length; if(isIterable(O))for(var iter = getIterator(O), step; !(step = iter.next()).done; index++){ result[index] = mapping ? f(step.value, index) : step.value; } else for(length = toLength(O.length); length > index; index++){ result[index] = mapping ? f(O[index], index) : O[index]; } result.length = index; return result; }, // 22.1.2.3 Array.of( ...items) of: function(/* ...args */){ var index = 0 , length = arguments.length , result = new (generic(this, Array))(length); while(length > index)result[index] = arguments[index++]; result.length = length; return result; } }); $define(PROTO, ARRAY, { // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) copyWithin: function(target /* = 0 */, start /* = 0, end = @length */){ var O = Object(assertDefined(this)) , len = toLength(O.length) , to = toIndex(target, len) , from = toIndex(start, len) , end = arguments[2] , fin = end === undefined ? len : toIndex(end, len) , count = min(fin - from, len - to) , inc = 1; if(from < to && to < from + count){ inc = -1; from = from + count - 1; to = to + count - 1; } while(count-- > 0){ if(from in O)O[to] = O[from]; else delete O[to]; to += inc; from += inc; } return O; }, // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) fill: function(value /*, start = 0, end = @length */){ var O = Object(assertDefined(this)) , length = toLength(O.length) , index = toIndex(arguments[1], length) , end = arguments[2] , endPos = end === undefined ? length : toIndex(end, length); while(endPos > index)O[index++] = value; return O; }, // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) find: createArrayMethod(5), // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) findIndex: createArrayMethod(6) }); // 22.1.3.4 Array.prototype.entries() // 22.1.3.13 Array.prototype.keys() // 22.1.3.29 Array.prototype.values() // 22.1.3.30 Array.prototype[@@iterator]() defineStdIterators(Array, ARRAY, function(iterated, kind){ set(this, ITER, {o: ES5Object(iterated), i: 0, k: kind}); // 22.1.5.2.1 %ArrayIteratorPrototype%.next() }, function(){ var iter = this[ITER] , O = iter.o , kind = iter.k , index = iter.i++; if(!O || index >= O.length)return iter.o = undefined, iterResult(1); if(kind == KEY) return iterResult(0, index); if(kind == VALUE)return iterResult(0, O[index]); return iterResult(0, [index, O[index]]); }, VALUE); // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) Iterators[ARGUMENTS] = Iterators[ARRAY]; // 24.3.3 JSON[@@toStringTag] setToStringTag(global.JSON, 'JSON', true); function WrappedRegExp(pattern, flags){ return new RegExp(cof(pattern) == REGEXP && flags !== undefined ? pattern.source : pattern, flags); } function wrapObjectMethod(key, MODE){ var fn = Object[key]; try { fn(DOT) } catch(e){ Object[key] = MODE == 1 ? function(it){ return isObject(it) ? fn(it) : it } : MODE == 2 ? function(it){ return isObject(it) ? fn(it) : true } : MODE == 3 ? function(it){ return isObject(it) ? fn(it) : false } : MODE == 4 ? function(it, key){ return fn(Object(assertDefined(it)), key) } : function(it){ return fn(Object(assertDefined(it))) } } } if(framework){ // Object static methods accept primitives wrapObjectMethod('freeze', 1); wrapObjectMethod('seal', 1); wrapObjectMethod('preventExtensions', 1); wrapObjectMethod('isFrozen', 2); wrapObjectMethod('isSealed', 2); wrapObjectMethod('isExtensible', 3); wrapObjectMethod('getOwnPropertyDescriptor', 4); wrapObjectMethod('getPrototypeOf'); wrapObjectMethod('keys'); wrapObjectMethod('getOwnPropertyNames'); // 19.1.3.6 Object.prototype.toString() tmp[SYMBOL_TAG] = DOT; if(cof(tmp) != DOT)hidden(ObjectProto, TO_STRING, function(){ return '[object ' + classof(this) + ']'; }); // RegExp allows a regex with flags as the pattern if(DESC && !function(){try{return RegExp(/a/g, 'i') == '/a/i'}catch(e){}}()){ forEach.call(getNames(RegExp), function(key){ key in WrappedRegExp || defineProperty(WrappedRegExp, key, { configurable: true, get: function(){ return RegExp[key] }, set: function(it){ RegExp[key] = it } }); }); RegExpProto[CONSTRUCTOR] = WrappedRegExp; WrappedRegExp[PROTOTYPE] = RegExpProto; hidden(global, REGEXP, WrappedRegExp); } // 21.2.5.3 get RegExp.prototype.flags() if(/./g.flags != 'g')defineProperty(RegExpProto, 'flags', { configurable: true, get: createReplacer(/^.*\/(\w*)$/, '$1') }); // 22.1.3.31 Array.prototype[@@unscopables] forEach.call(array('find,findIndex,fill,copyWithin,entries,keys,values'), function(it){ ArrayUnscopables[it] = true; }); SYMBOL_UNSCOPABLES in ArrayProto || hidden(ArrayProto, SYMBOL_UNSCOPABLES, ArrayUnscopables); } }(RegExp[PROTOTYPE], isFinite, {}); /****************************************************************************** * Module : immediate * ******************************************************************************/ // setImmediate shim // Node.js 0.9+ & IE10+ has setImmediate, else: isFunction(setImmediate) && isFunction(clearImmediate) || function(ONREADYSTATECHANGE){ var postMessage = global.postMessage , addEventListener = global.addEventListener , MessageChannel = global.MessageChannel , counter = 0 , queue = {} , defer, channel, port; setImmediate = function(fn){ var args = [], i = 1; while(arguments.length > i)args.push(arguments[i++]); queue[++counter] = function(){ invoke(isFunction(fn) ? fn : Function(fn), args); } defer(counter); return counter; } clearImmediate = function(id){ delete queue[id]; } function run(id){ if(has(queue, id)){ var fn = queue[id]; delete queue[id]; fn(); } } function listner(event){ run(event.data); } // Node.js 0.8- if(NODE){ defer = function(id){ nextTick(part.call(run, id)); } // Modern browsers, skip implementation for WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is object } else if(addEventListener && isFunction(postMessage) && !global.importScripts){ defer = function(id){ postMessage(id, '*'); } addEventListener('message', listner, false); // WebWorkers } else if(isFunction(MessageChannel)){ channel = new MessageChannel; port = channel.port2; channel.port1.onmessage = listner; defer = ctx(port.postMessage, port, 1); // IE8- } else if(document && ONREADYSTATECHANGE in document[CREATE_ELEMENT]('script')){ defer = function(id){ html.appendChild(document[CREATE_ELEMENT]('script'))[ONREADYSTATECHANGE] = function(){ html.removeChild(this); run(id); } } // Rest old browsers } else { defer = function(id){ setTimeout(part.call(run, id), 0); } } }('onreadystatechange'); $define(GLOBAL + BIND, { setImmediate: setImmediate, clearImmediate: clearImmediate }); /****************************************************************************** * Module : es6_promise * ******************************************************************************/ // ES6 promises shim // Based on https://github.com/getify/native-promise-only/ !function(Promise, test){ isFunction(Promise) && isFunction(Promise.resolve) && Promise.resolve(test = new Promise(Function())) == test || function(asap, DEF){ function isThenable(o){ var then; if(isObject(o))then = o.then; return isFunction(then) ? then : false; } function notify(def){ var chain = def.chain; chain.length && asap(function(){ var msg = def.msg , ok = def.state == 1 , i = 0; while(chain.length > i)!function(react){ var cb = ok ? react.ok : react.fail , ret, then; try { if(cb){ ret = cb === true ? msg : cb(msg); if(ret === react.P){ react.rej(TypeError(PROMISE + '-chain cycle')); } else if(then = isThenable(ret)){ then.call(ret, react.res, react.rej); } else react.res(ret); } else react.rej(msg); } catch(err){ react.rej(err); } }(chain[i++]); chain.length = 0; }); } function resolve(msg){ var def = this , then, wrapper; if(def.done)return; def.done = true; def = def.def || def; // unwrap try { if(then = isThenable(msg)){ wrapper = {def: def, done: false}; // wrap then.call(msg, ctx(resolve, wrapper, 1), ctx(reject, wrapper, 1)); } else { def.msg = msg; def.state = 1; notify(def); } } catch(err){ reject.call(wrapper || {def: def, done: false}, err); // wrap } } function reject(msg){ var def = this; if(def.done)return; def.done = true; def = def.def || def; // unwrap def.msg = msg; def.state = 2; notify(def); } // 25.4.3.1 Promise(executor) Promise = function(executor){ assertFunction(executor); assertInstance(this, Promise, PROMISE); var def = {chain: [], state: 0, done: false, msg: undefined}; hidden(this, DEF, def); try { executor(ctx(resolve, def, 1), ctx(reject, def, 1)); } catch(err){ reject.call(def, err); } } assignHidden(Promise[PROTOTYPE], { // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) then: function(onFulfilled, onRejected){ var react = { ok: isFunction(onFulfilled) ? onFulfilled : true, fail: isFunction(onRejected) ? onRejected : false } , P = react.P = new this[CONSTRUCTOR](function(resolve, reject){ react.res = assertFunction(resolve); react.rej = assertFunction(reject); }), def = this[DEF]; def.chain.push(react); def.state && notify(def); return P; }, // 25.4.5.1 Promise.prototype.catch(onRejected) 'catch': function(onRejected){ return this.then(undefined, onRejected); } }); assignHidden(Promise, { // 25.4.4.1 Promise.all(iterable) all: function(iterable){ var Promise = this , values = []; return new Promise(function(resolve, reject){ forOf(iterable, false, push, values); var remaining = values.length , results = Array(remaining); if(remaining)forEach.call(values, function(promise, index){ Promise.resolve(promise).then(function(value){ results[index] = value; --remaining || resolve(results); }, reject); }); else resolve(results); }); }, // 25.4.4.4 Promise.race(iterable) race: function(iterable){ var Promise = this; return new Promise(function(resolve, reject){ forOf(iterable, false, function(promise){ Promise.resolve(promise).then(resolve, reject); }); }); }, // 25.4.4.5 Promise.reject(r) reject: function(r){ return new this(function(resolve, reject){ reject(r); }); }, // 25.4.4.6 Promise.resolve(x) resolve: function(x){ return isObject(x) && getPrototypeOf(x) === this[PROTOTYPE] ? x : new this(function(resolve, reject){ resolve(x); }); } }); }(nextTick || setImmediate, safeSymbol('def')); setToStringTag(Promise, PROMISE); $define(GLOBAL + FORCED * !isNative(Promise), {Promise: Promise}); }(global[PROMISE]); /****************************************************************************** * Module : es6_collections * ******************************************************************************/ // ECMAScript 6 collections shim !function(){ var UID = safeSymbol('uid') , DATA = safeSymbol('data') , WEAK = safeSymbol('weak') , LAST = safeSymbol('last') , FIRST = safeSymbol('first') , SIZE = DESC ? safeSymbol('size') : 'size' , uid = 0; function getCollection(C, NAME, methods, commonMethods, isMap, isWeak){ var ADDER = isMap ? 'set' : 'add' , proto = C && C[PROTOTYPE] , O = {}; function initFromIterable(that, iterable){ if(iterable != undefined)forOf(iterable, isMap, that[ADDER], that); return that; } function fixSVZ(key, chain){ var method = proto[key]; framework && hidden(proto, key, function(a, b){ var result = method.call(this, a === 0 ? 0 : a, b); return chain ? this : result; }); } if(!isNative(C) || !(isWeak || (!BUGGY_ITERATORS && has(proto, 'entries')))){ // create collection constructor C = isWeak ? function(iterable){ assertInstance(this, C, NAME); set(this, UID, uid++); initFromIterable(this, iterable); } : function(iterable){ var that = this; assertInstance(that, C, NAME); set(that, DATA, create(null)); set(that, SIZE, 0); set(that, LAST, undefined); set(that, FIRST, undefined); initFromIterable(that, iterable); }; assignHidden(assignHidden(C[PROTOTYPE], methods), commonMethods); isWeak || defineProperty(C[PROTOTYPE], 'size', {get: function(){ return assertDefined(this[SIZE]); }}); } else { var Native = C , inst = new C , chain = inst[ADDER](isWeak ? {} : -0, 1) , buggyZero; // wrap to init collections from iterable if(!NATIVE_ITERATORS || !C.length){ C = function(iterable){ assertInstance(this, C, NAME); return initFromIterable(new Native, iterable); } C[PROTOTYPE] = proto; } isWeak || inst[FOR_EACH](function(val, key){ buggyZero = 1 / key === -Infinity; }); // fix converting -0 key to +0 if(buggyZero){ fixSVZ('delete'); fixSVZ('has'); isMap && fixSVZ('get'); } // + fix .add & .set for chaining if(buggyZero || chain !== inst)fixSVZ(ADDER, true); } setToStringTag(C, NAME); O[NAME] = C; $define(GLOBAL + WRAP + FORCED * !isNative(C), O); // 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 isWeak || defineStdIterators(C, NAME, function(iterated, kind){ set(this, ITER, {o: iterated, k: kind}); }, function(){ var iter = this[ITER] , O = iter.o , kind = iter.k , entry = iter.l; while(entry && entry.r)entry = entry.p; if(!O || !(iter.l = entry = entry ? entry.n : O[FIRST]))return iter.o = undefined, iterResult(1); if(kind == KEY) return iterResult(0, entry.k); if(kind == VALUE)return iterResult(0, entry.v); return iterResult(0, [entry.k, entry.v]); }, isMap ? KEY+VALUE : VALUE, !isMap); return C; } function fastKey(it, create){ // return it with 'S' prefix if it's string or with 'P' prefix for over primitives if(!isObject(it))return (typeof it == 'string' ? 'S' : 'P') + it; // if it hasn't object id - add next if(!has(it, UID)){ if(create)hidden(it, UID, ++uid); else return ''; } // return object id with 'O' prefix return 'O' + it[UID]; } function def(that, key, value){ var index = fastKey(key, true) , data = that[DATA] , last = that[LAST] , entry; if(index in data)data[index].v = value; else { entry = data[index] = {k: key, v: value, p: last}; if(!that[FIRST])that[FIRST] = entry; if(last)last.n = entry; that[LAST] = entry; that[SIZE]++; } return that; } function del(that, index){ var data = that[DATA] , entry = data[index] , next = entry.n , prev = entry.p; delete data[index]; entry.r = true; if(prev)prev.n = next; if(next)next.p = prev; if(that[FIRST] == entry)that[FIRST] = next; if(that[LAST] == entry)that[LAST] = prev; that[SIZE]--; } var collectionMethods = { // 23.1.3.1 Map.prototype.clear() // 23.2.3.2 Set.prototype.clear() clear: function(){ for(var index in this[DATA])del(this, index); }, // 23.1.3.3 Map.prototype.delete(key) // 23.2.3.4 Set.prototype.delete(value) 'delete': function(key){ var index = fastKey(key) , contains = index in this[DATA]; if(contains)del(this, index); return contains; }, // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) forEach: function(callbackfn /*, that = undefined */){ var f = ctx(callbackfn, arguments[1], 3) , entry; while(entry = entry ? entry.n : this[FIRST]){ f(entry.v, entry.k, this); 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(key){ return fastKey(key) in this[DATA]; } } // 23.1 Map Objects Map = getCollection(Map, MAP, { // 23.1.3.6 Map.prototype.get(key) get: function(key){ var entry = this[DATA][fastKey(key)]; return entry && entry.v; }, // 23.1.3.9 Map.prototype.set(key, value) set: function(key, value){ return def(this, key === 0 ? 0 : key, value); } }, collectionMethods, true); // 23.2 Set Objects Set = getCollection(Set, SET, { // 23.2.3.1 Set.prototype.add(value) add: function(value){ return def(this, value = value === 0 ? 0 : value, value); } }, collectionMethods); function setWeak(that, key, value){ has(assertObject(key), WEAK) || hidden(key, WEAK, {}); key[WEAK][that[UID]] = value; return that; } function hasWeak(key){ return isObject(key) && has(key, WEAK) && has(key[WEAK], this[UID]); } var weakMethods = { // 23.3.3.2 WeakMap.prototype.delete(key) // 23.4.3.3 WeakSet.prototype.delete(value) 'delete': function(key){ return hasWeak.call(this, key) && delete key[WEAK][this[UID]]; }, // 23.3.3.4 WeakMap.prototype.has(key) // 23.4.3.4 WeakSet.prototype.has(value) has: hasWeak }; // 23.3 WeakMap Objects WeakMap = getCollection(WeakMap, WEAKMAP, { // 23.3.3.3 WeakMap.prototype.get(key) get: function(key){ if(isObject(key) && has(key, WEAK))return key[WEAK][this[UID]]; }, // 23.3.3.5 WeakMap.prototype.set(key, value) set: function(key, value){ return setWeak(this, key, value); } }, weakMethods, true, true); // 23.4 WeakSet Objects WeakSet = getCollection(WeakSet, WEAKSET, { // 23.4.3.1 WeakSet.prototype.add(value) add: function(value){ return setWeak(this, value, true); } }, weakMethods, false, true); }(); /****************************************************************************** * Module : es6_reflect * ******************************************************************************/ !function(){ function Enumerate(iterated){ var keys = [], key; for(key in iterated)keys.push(key); set(this, ITER, {o: iterated, a: keys, i: 0}); } createIterator(Enumerate, OBJECT, function(){ var iter = this[ITER] , keys = iter.a , key; do { if(iter.i >= keys.length)return iterResult(1); } while(!((key = keys[iter.i++]) in iter.o)); return iterResult(0, key); }); function wrap(fn){ return function(it){ assertObject(it); try { return fn.apply(undefined, arguments), true; } catch(e){ return false; } } } function reflectGet(target, propertyKey/*, receiver*/){ var receiver = arguments.length < 3 ? target : arguments[2] , desc = getOwnDescriptor(assertObject(target), propertyKey), proto; if(desc)return desc.get ? desc.get.call(receiver) : desc.value; return isObject(proto = getPrototypeOf(target)) ? reflectGet(proto, propertyKey, receiver) : undefined; } function reflectSet(target, propertyKey, V/*, receiver*/){ var receiver = arguments.length < 4 ? target : arguments[3] , desc = getOwnDescriptor(assertObject(target), propertyKey), proto; if(desc){ if(desc.writable === false)return false; if(desc.set)return desc.set.call(receiver, V), true; } if(isObject(proto = getPrototypeOf(target)))return reflectSet(proto, propertyKey, V, receiver); desc = getOwnDescriptor(receiver, propertyKey) || descriptor(0); desc.value = V; return defineProperty(receiver, propertyKey, desc), true; } var reflect = { // 26.1.1 Reflect.apply(target, thisArgument, argumentsList) apply: ctx(call, apply, 3), // 26.1.2 Reflect.construct(target, argumentsList) construct: construct, // 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) defineProperty: wrap(defineProperty), // 26.1.4 Reflect.deleteProperty(target, propertyKey) deleteProperty: function(target, propertyKey){ var desc = getOwnDescriptor(assertObject(target), propertyKey); return desc && !desc.configurable ? false : delete target[propertyKey]; }, // 26.1.5 Reflect.enumerate(target) enumerate: function(target){ return new Enumerate(assertObject(target)); }, // 26.1.6 Reflect.get(target, propertyKey [, receiver]) get: reflectGet, // 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey) getOwnPropertyDescriptor: getOwnDescriptor, // 26.1.8 Reflect.getPrototypeOf(target) getPrototypeOf: getPrototypeOf, // 26.1.9 Reflect.has(target, propertyKey) has: function(target, propertyKey){ return propertyKey in target; }, // 26.1.10 Reflect.isExtensible(target) isExtensible: Object.isExtensible || function(target){ return !!assertObject(target); }, // 26.1.11 Reflect.ownKeys(target) ownKeys: ownKeys, // 26.1.12 Reflect.preventExtensions(target) preventExtensions: wrap(Object.preventExtensions || returnIt), // 26.1.13 Reflect.set(target, propertyKey, V [, receiver]) set: reflectSet } // 26.1.14 Reflect.setPrototypeOf(target, proto) if(setPrototypeOf)reflect.setPrototypeOf = function(target, proto){ return setPrototypeOf(assertObject(target), proto), true; }; $define(GLOBAL, {Reflect: {}}); $define(STATIC, 'Reflect', reflect); }(); /****************************************************************************** * Module : es7 * ******************************************************************************/ !function(){ $define(PROTO, ARRAY, { // https://github.com/domenic/Array.prototype.includes includes: createArrayContains(true) }); $define(PROTO, STRING, { // https://github.com/mathiasbynens/String.prototype.at at: createPointAt(true) }); function createObjectToArray(isEntries){ return function(object){ var O = ES5Object(object) , keys = getKeys(object) , length = keys.length , i = 0 , result = Array(length) , key; if(isEntries)while(length > i)result[i] = [key = keys[i++], O[key]]; else while(length > i)result[i] = O[keys[i++]]; return result; } } $define(STATIC, OBJECT, { // https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-04/apr-9.md#51-objectentries-objectvalues values: createObjectToArray(false), entries: createObjectToArray(true) }); $define(STATIC, REGEXP, { // https://gist.github.com/kangax/9698100 escape: createReplacer(/([\\\-[\]{}()*+?.,^$|])/g, '\\$1', true) }); }(); /****************************************************************************** * Module : es7_refs * ******************************************************************************/ // https://github.com/zenparsing/es-abstract-refs !function(REFERENCE){ REFERENCE_GET = getWellKnownSymbol(REFERENCE+'Get', true); var REFERENCE_SET = getWellKnownSymbol(REFERENCE+SET, true) , REFERENCE_DELETE = getWellKnownSymbol(REFERENCE+'Delete', true); $define(STATIC, SYMBOL, { referenceGet: REFERENCE_GET, referenceSet: REFERENCE_SET, referenceDelete: REFERENCE_DELETE }); hidden(FunctionProto, REFERENCE_GET, returnThis); function setMapMethods(Constructor){ if(Constructor){ var MapProto = Constructor[PROTOTYPE]; hidden(MapProto, REFERENCE_GET, MapProto.get); hidden(MapProto, REFERENCE_SET, MapProto.set); hidden(MapProto, REFERENCE_DELETE, MapProto['delete']); } } setMapMethods(Map); setMapMethods(WeakMap); }('reference'); /****************************************************************************** * Module : dict * ******************************************************************************/ !function(DICT){ function Dict(iterable){ var dict = create(null); if(iterable != undefined){ if(isIterable(iterable)){ for(var iter = getIterator(iterable), step, value; !(step = iter.next()).done;){ value = step.value; dict[value[0]] = value[1]; } } else assign(dict, iterable); } return dict; } Dict[PROTOTYPE] = null; function DictIterator(iterated, kind){ set(this, ITER, {o: ES5Object(iterated), a: getKeys(iterated), i: 0, k: kind}); } createIterator(DictIterator, DICT, function(){ var iter = this[ITER] , O = iter.o , keys = iter.a , kind = iter.k , key; do { if(iter.i >= keys.length)return iterResult(1); } while(!has(O, key = keys[iter.i++])); if(kind == KEY) return iterResult(0, key); if(kind == VALUE)return iterResult(0, O[key]); return iterResult(0, [key, O[key]]); }); function createDictIter(kind){ return function(it){ return new DictIterator(it, kind); } } /* * 0 -> forEach * 1 -> map * 2 -> filter * 3 -> some * 4 -> every * 5 -> find * 6 -> findKey * 7 -> mapPairs */ function createDictMethod(type){ var isMap = type == 1 , isEvery = type == 4; return function(object, callbackfn, that /* = undefined */){ var f = ctx(callbackfn, that, 3) , O = ES5Object(object) , result = isMap || type == 7 || type == 2 ? new (generic(this, Dict)) : undefined , key, val, res; for(key in O)if(has(O, key)){ val = O[key]; res = f(val, key, object); if(type){ if(isMap)result[key] = res; // map else if(res)switch(type){ case 2: result[key] = val; break // filter case 3: return true; // some case 5: return val; // find case 6: return key; // findKey case 7: result[res[0]] = res[1]; // mapPairs } else if(isEvery)return false; // every } } return type == 3 || isEvery ? isEvery : result; } } function createDictReduce(isTurn){ return function(object, mapfn, init){ assertFunction(mapfn); var O = ES5Object(object) , keys = getKeys(O) , length = keys.length , i = 0 , memo, key, result; if(isTurn)memo = init == undefined ? new (generic(this, Dict)) : Object(init); else if(arguments.length < 3){ assert(length, REDUCE_ERROR); memo = O[keys[i++]]; } else memo = Object(init); while(length > i)if(has(O, key = keys[i++])){ result = mapfn(memo, O[key], key, object); if(isTurn){ if(result === false)break; } else memo = result; } return memo; } } var findKey = createDictMethod(6); function includes(object, el){ return (el == el ? keyOf(object, el) : findKey(object, sameNaN)) !== undefined; } var dictMethods = { keys: createDictIter(KEY), values: createDictIter(VALUE), entries: createDictIter(KEY+VALUE), forEach: createDictMethod(0), map: createDictMethod(1), filter: createDictMethod(2), some: createDictMethod(3), every: createDictMethod(4), find: createDictMethod(5), findKey: findKey, mapPairs:createDictMethod(7), reduce: createDictReduce(false), turn: createDictReduce(true), keyOf: keyOf, includes:includes, // Has / get / set own property has: has, get: get, set: createDefiner(0), isDict: function(it){ return isObject(it) && getPrototypeOf(it) === Dict[PROTOTYPE]; } }; if(REFERENCE_GET)for(var key in dictMethods)!function(fn){ function method(){ for(var args = [this], i = 0; i < arguments.length;)args.push(arguments[i++]); return invoke(fn, args); } fn[REFERENCE_GET] = function(){ return method; } }(dictMethods[key]); $define(GLOBAL + FORCED, {Dict: assignHidden(Dict, dictMethods)}); }('Dict'); /****************************************************************************** * Module : $for * ******************************************************************************/ !function(ENTRIES, FN){ function $for(iterable, entries){ if(!(this instanceof $for))return new $for(iterable, entries); this[ITER] = getIterator(iterable); this[ENTRIES] = !!entries; } createIterator($for, 'Wrapper', function(){ return this[ITER].next(); }); var $forProto = $for[PROTOTYPE]; setIterator($forProto, function(){ return this[ITER]; // unwrap }); function createChainIterator(next){ function Iter(I, fn, that){ this[ITER] = getIterator(I); this[ENTRIES] = I[ENTRIES]; this[FN] = ctx(fn, that, I[ENTRIES] ? 2 : 1); } createIterator(Iter, 'Chain', next, $forProto); setIterator(Iter[PROTOTYPE], returnThis); // override $forProto iterator return Iter; } var MapIter = createChainIterator(function(){ var step = this[ITER].next(); return step.done ? step : iterResult(0, stepCall(this[FN], step.value, this[ENTRIES])); }); var FilterIter = createChainIterator(function(){ for(;;){ var step = this[ITER].next(); if(step.done || stepCall(this[FN], step.value, this[ENTRIES]))return step; } }); assignHidden($forProto, { of: function(fn, that){ forOf(this, this[ENTRIES], fn, that); }, array: function(fn, that){ var result = []; forOf(fn != undefined ? this.map(fn, that) : this, false, push, result); return result; }, filter: function(fn, that){ return new FilterIter(this, fn, that); }, map: function(fn, that){ return new MapIter(this, fn, that); } }); $for.isIterable = isIterable; $for.getIterator = getIterator; $define(GLOBAL + FORCED, {$for: $for}); }('entries', safeSymbol('fn')); /****************************************************************************** * Module : timers * ******************************************************************************/ // ie9- setTimeout & setInterval additional parameters fix !function(MSIE){ function wrap(set){ return MSIE ? function(fn, time /*, ...args */){ return set(invoke(part, slice.call(arguments, 2), isFunction(fn) ? fn : Function(fn)), time); } : set; } $define(GLOBAL + BIND + FORCED * MSIE, { setTimeout: setTimeout = wrap(setTimeout), setInterval: wrap(setInterval) }); // ie9- dirty check }(!!navigator && /MSIE .\./.test(navigator.userAgent)); /****************************************************************************** * Module : binding * ******************************************************************************/ !function(_, toLocaleString){ // Placeholder core._ = path._ = path._ || {}; $define(PROTO + FORCED, FUNCTION, { part: part, by: function(that){ var fn = this , _ = path._ , holder = false , length = arguments.length , isThat = that === _ , i = +!isThat , indent = i , it, args; if(isThat){ it = fn; fn = call; } else it = that; if(length < 2)return ctx(fn, it, -1); args = Array(length - indent); while(length > i)if((args[i - indent] = arguments[i++]) === _)holder = true; return partial(fn, args, length, holder, _, true, it); }, only: function(numberArguments, that /* = @ */){ var fn = assertFunction(this) , n = toLength(numberArguments) , isThat = arguments.length > 1; return function(/* ...args */){ var length = min(n, arguments.length) , args = Array(length) , i = 0; while(length > i)args[i] = arguments[i++]; return invoke(fn, args, isThat ? that : this); } } }); function tie(key){ var that = this , bound = {}; return hidden(that, _, function(key){ if(key === undefined || !(key in that))return toLocaleString.call(that); return has(bound, key) ? bound[key] : (bound[key] = ctx(that[key], that, -1)); })[_](key); } hidden(path._, TO_STRING, function(){ return _; }); hidden(ObjectProto, _, tie); DESC || hidden(ArrayProto, _, tie); // IE8- dirty hack - redefined toLocaleString is not enumerable }(DESC ? uid('tie') : TO_LOCALE, ObjectProto[TO_LOCALE]); /****************************************************************************** * Module : object * ******************************************************************************/ !function(){ function define(target, mixin){ var keys = ownKeys(ES5Object(mixin)) , length = keys.length , i = 0, key; while(length > i)defineProperty(target, key = keys[i++], getOwnDescriptor(mixin, key)); return target; }; $define(STATIC + FORCED, OBJECT, { isObject: isObject, classof: classof, define: define, make: function(proto, mixin){ return define(create(proto), mixin); } }); }(); /****************************************************************************** * Module : array * ******************************************************************************/ $define(PROTO + FORCED, ARRAY, { turn: function(fn, target /* = [] */){ assertFunction(fn); var memo = target == undefined ? [] : Object(target) , O = ES5Object(this) , length = toLength(O.length) , index = 0; while(length > index)if(fn(memo, O[index], index++, this) === false)break; return memo; } }); if(framework)ArrayUnscopables.turn = true; /****************************************************************************** * Module : array_statics * ******************************************************************************/ // JavaScript 1.6 / Strawman array statics shim !function(arrayStatics){ function setArrayStatics(keys, length){ forEach.call(array(keys), function(key){ if(key in ArrayProto)arrayStatics[key] = ctx(call, ArrayProto[key], length); }); } setArrayStatics('pop,reverse,shift,keys,values,entries', 1); setArrayStatics('indexOf,every,some,forEach,map,filter,find,findIndex,includes', 3); setArrayStatics('join,slice,concat,push,splice,unshift,sort,lastIndexOf,' + 'reduce,reduceRight,copyWithin,fill,turn'); $define(STATIC, ARRAY, arrayStatics); }({}); /****************************************************************************** * Module : number * ******************************************************************************/ !function(numberMethods){ function NumberIterator(iterated){ set(this, ITER, {l: toLength(iterated), i: 0}); } createIterator(NumberIterator, NUMBER, function(){ var iter = this[ITER] , i = iter.i++; return i < iter.l ? iterResult(0, i) : iterResult(1); }); defineIterator(Number, NUMBER, function(){ return new NumberIterator(this); }); numberMethods.random = function(lim /* = 0 */){ var a = +this , b = lim == undefined ? 0 : +lim , m = min(a, b); return random() * (max(a, b) - m) + m; }; forEach.call(array( // ES3: 'round,floor,ceil,abs,sin,asin,cos,acos,tan,atan,exp,sqrt,max,min,pow,atan2,' + // ES6: 'acosh,asinh,atanh,cbrt,clz32,cosh,expm1,hypot,imul,log1p,log10,log2,sign,sinh,tanh,trunc' ), function(key){ var fn = Math[key]; if(fn)numberMethods[key] = function(/* ...args */){ // ie9- dont support strict mode & convert `this` to object -> convert it to number var args = [+this] , i = 0; while(arguments.length > i)args.push(arguments[i++]); return invoke(fn, args); } } ); $define(PROTO + FORCED, NUMBER, numberMethods); }({}); /****************************************************************************** * Module : string * ******************************************************************************/ !function(){ var escapeHTMLDict = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&apos;' }, unescapeHTMLDict = {}, key; for(key in escapeHTMLDict)unescapeHTMLDict[escapeHTMLDict[key]] = key; $define(PROTO + FORCED, STRING, { escapeHTML: createReplacer(/[&<>"']/g, escapeHTMLDict), unescapeHTML: createReplacer(/&(?:amp|lt|gt|quot|apos);/g, unescapeHTMLDict) }); }(); /****************************************************************************** * Module : date * ******************************************************************************/ !function(formatRegExp, flexioRegExp, locales, current, SECONDS, MINUTES, HOURS, MONTH, YEAR){ function createFormat(prefix){ return function(template, locale /* = current */){ var that = this , dict = locales[has(locales, locale) ? locale : current]; function get(unit){ return that[prefix + unit](); } return String(template).replace(formatRegExp, function(part){ switch(part){ case 's' : return get(SECONDS); // Seconds : 0-59 case 'ss' : return lz(get(SECONDS)); // Seconds : 00-59 case 'm' : return get(MINUTES); // Minutes : 0-59 case 'mm' : return lz(get(MINUTES)); // Minutes : 00-59 case 'h' : return get(HOURS); // Hours : 0-23 case 'hh' : return lz(get(HOURS)); // Hours : 00-23 case 'D' : return get(DATE); // Date : 1-31 case 'DD' : return lz(get(DATE)); // Date : 01-31 case 'W' : return dict[0][get('Day')]; // Day : Понедельник case 'N' : return get(MONTH) + 1; // Month : 1-12 case 'NN' : return lz(get(MONTH) + 1); // Month : 01-12 case 'M' : return dict[2][get(MONTH)]; // Month : Январь case 'MM' : return dict[1][get(MONTH)]; // Month : Января case 'Y' : return get(YEAR); // Year : 2014 case 'YY' : return lz(get(YEAR) % 100); // Year : 14 } return part; }); } } function lz(num){ return num > 9 ? num : '0' + num; } function addLocale(lang, locale){ function split(index){ var result = []; forEach.call(array(locale.months), function(it){ result.push(it.replace(flexioRegExp, '$' + index)); }); return result; } locales[lang] = [array(locale.weekdays), split(1), split(2)]; return core; } $define(PROTO + FORCED, DATE, { format: createFormat('get'), formatUTC: createFormat('getUTC') }); addLocale(current, { weekdays: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday', months: 'January,February,March,April,May,June,July,August,September,October,November,December' }); addLocale('ru', { weekdays: 'Воскресенье,Понедельник,Вторник,Среда,Четверг,Пятница,Суббота', months: 'Январ:я|ь,Феврал:я|ь,Март:а|,Апрел:я|ь,Ма:я|й,Июн:я|ь,' + 'Июл:я|ь,Август:а|,Сентябр:я|ь,Октябр:я|ь,Ноябр:я|ь,Декабр:я|ь' }); core.locale = function(locale){ return has(locales, locale) ? current = locale : current; }; core.addLocale = addLocale; }(/\b\w\w?\b/g, /:(.*)\|(.*)$/, {}, 'en', 'Seconds', 'Minutes', 'Hours', 'Month', 'FullYear'); /****************************************************************************** * Module : console * ******************************************************************************/ !function(console, enabled){ var _console = { enable: function(){ enabled = true }, disable: function(){ enabled = false } }; // Methods from: // https://github.com/DeveloperToolsWG/console-object/blob/master/api.md // https://developer.mozilla.org/en-US/docs/Web/API/console forEach.call(array('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,isIndependentlyComposed,log,markTimeline,profile,' + 'profileEnd,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn'), function(key){ var fn = console[key]; _console[key] = function(){ if(enabled && fn)return apply.call(fn, console, arguments); }; } ); // console methods in some browsers are not configurable try { framework && delete global.console; } catch(e){} $define(GLOBAL + FORCED, {console: _console}); }(global.console || {}, true); }(Function('return this'), true);
taydakov/cdnjs
ajax/libs/core-js/0.4.2/core.js
JavaScript
mit
80,499
/** * machina - A library for creating powerful and flexible finite state machines. Loosely inspired by Erlang/OTP's gen_fsm behavior. * Author: Jim Cowart (http://ifandelse.com) * Version: v1.1.1 * Url: http://machina-js.org/ * License(s): MIT, GPL */ (function(t,e){"function"==typeof define&&define.amd?define(["lodash"],function(n){return e(n,t)}):"object"==typeof module&&module.exports?module.exports=e(require("lodash")):t.machina=e(t._,t)})(this,function(t,e,n){function i(){return{initialState:"uninitialized",eventListeners:{"*":[]},states:{},namespace:S.makeFsmNamespace(),useSafeEmit:!1,hierarchy:{},pendingDelegations:{}}}function s(){return{inputQueue:[],targetReplayState:"",state:n,priorState:n,priorAction:"",currentAction:"",currentActionArgs:n,inExitHandler:!1}}function a(t,e){for(var n=[],i=e||0;i<t.length;i++)n[i]=t[i];return n}function r(t){if(t){var e={};return"object"==typeof t?t.factory?e=t:e.factory=function(){return t}:"function"==typeof t&&(e.factory=t),e.instance=e.factory(),e}}function o(t,e){return e.on("*",function(e,n){switch(e){case"nohandler":n.ticket||n.delegated||n.namespace===t.namespace||(n.args[1].bubbling=!0),"_reset"!==n.inputType&&t.handle.apply(t,n.args);break;case"handling":var i=n.ticket;i&&t.pendingDelegations[i]&&delete t.pendingDelegations[i],t.emit(e,n);break;default:t.emit(e,n)}})}function u(){for(var t=[],e="0123456789abcdef",n=0;36>n;n++)t[n]=e.substr(Math.floor(16*Math.random()),1);return t[14]="4",t[19]=e.substr(3&t[19]|8,1),t[8]=t[13]=t[18]=t[23]="-",t.join("")}function c(e){t.extend(this,e),t.defaults(this,i()),this.initialize.apply(this,arguments),E.emit(v,this)}var l=[].slice,h="transition",p="handling",f="handled",d="nohandler",g="transition",m="invalidstate",y="deferred",v="newfsm",A=["states","initialState"],b=function(e,n){var i,s=this,a={},r=function(){};return i=e&&e.hasOwnProperty("constructor")?e.constructor:function(){var e=l.call(arguments,0);e[0]=e[0]||{};var n,i=e[0].states||{};n=t.merge(t.cloneDeep(a),{states:i}),n.initialState=e[0].initialState||this.initialState,t.extend(e[0],n),s.apply(this,e)},t.merge(i,s),r.prototype=s.prototype,i.prototype=new r,e&&(t.extend(i.prototype,e),t.merge(a,t.transform(e,function(t,e,n){-1!==A.indexOf(n)&&(t[n]=e)}))),n&&t.merge(i,n),i.prototype.constructor=i,i.__super__=s.prototype,i},S={makeFsmNamespace:function(){var t=0;return function(){return"fsm."+t++}}(),listenToChild:o,getLeaklessArgs:a,getDefaultOptions:i,getDefaultClientMeta:s,createUUID:u},_={emit:function(e){var n=a(arguments);this.eventListeners["*"]&&t.each(this.eventListeners["*"],function(t){if(this.useSafeEmit)try{t.apply(this,n)}catch(e){console&&"undefined"!=typeof console.log&&console.log(e.stack)}else t.apply(this,n)},this),this.eventListeners[e]&&t.each(this.eventListeners[e],function(t){if(this.useSafeEmit)try{t.apply(this,n.slice(1))}catch(e){console&&"undefined"!=typeof console.log&&console.log(e.stack)}else t.apply(this,n.slice(1))},this)},on:function(t,e){var n=this;return n.eventListeners=n.eventListeners||{"*":[]},n.eventListeners[t]||(n.eventListeners[t]=[]),n.eventListeners[t].push(e),{eventName:t,callback:e,off:function(){n.off(t,e)}}},off:function(e,n){this.eventListeners=this.eventListeners||{"*":[]},e?this.eventListeners[e]=n?t.without(this.eventListeners[e],n):[]:this.eventListeners={}}},k="__machina__";t.extend(c.prototype,{initialize:function(){},initClient:function(t){var e=this.initialState;if(!e)throw new Error("You must specify an initial state for this FSM");if(!this.states[e])throw new Error("The initial state specified does not exist in the states object.");this.transition(t,e)},ensureClientMeta:function(e){if("object"!=typeof e)throw new Error("An FSM client must be an object.");return e[k]=e[k]||{},e[k][this.namespace]||(e[k][this.namespace]=t.cloneDeep(S.getDefaultClientMeta()),this.initClient(e)),e[k][this.namespace]},buildEventPayload:function(e,n){return t.isPlainObject(n)?t.extend(n,{client:e,namespace:this.namespace}):{client:e,data:n||null,namespace:this.namespace}},getHandlerArgs:function(t,e){var n=t.slice(0),i=n[1];return"object"==typeof i&&n.splice(1,1,i.inputType),e?n:[n[0]].concat(n.slice(2))},handle:function(e,i){var s=i;if("undefined"==typeof i)throw new Error("The input argument passed to the FSM's handle method is undefined. Did you forget to pass the input name?");"string"==typeof i&&(s={inputType:i,delegated:!1,ticket:n});var r=this.ensureClientMeta(e),o=a(arguments);"object"!=typeof i&&o.splice(1,1,s),r.currentActionArgs=o.slice(1);var u,c,l,h,g,m=r.state,y=this.states[m],v=!1;if(!r.inExitHandler)if(l=y._child&&y._child.instance,!l||this.pendingDelegations[s.ticket]||s.bubbling){s.ticket&&this.pendingDelegations[s.ticket]&&delete this.pendingDelegations[s.ticket],u=y[s.inputType]?s.inputType:"*",v="*"===u,c=y[u]||this[u]||this["*"],g=r.state+"."+u,r.currentAction=g;var A=this.buildEventPayload(e,{inputType:s.inputType,delegated:s.delegated,ticket:s.ticket});c?(this.emit(p,A),"function"==typeof c?h=c.apply(this,this.getHandlerArgs(o,v)):(h=c,this.transition(e,c)),this.emit(f,A)):this.emit(d,t.extend({args:o},A)),r.priorAction=r.currentAction,r.currentAction=""}else s.ticket=s.ticket||S.createUUID(),s.delegated=!0,this.pendingDelegations[s.ticket]={delegatedTo:l.namespace},h=l.handle.apply(l,o);return h},transition:function(t,e){var n,i=this.ensureClientMeta(t),s=i.state,a=this.states[s],o=this.states[e];if(!i.inExitHandler&&e!==s){if(o){o._child&&(o._child=r(o._child),n=o._child&&o._child.instance),a&&a._onExit&&(i.inExitHandler=!0,a._onExit.call(this,t),i.inExitHandler=!1),a&&a._child&&a._child.instance&&this.hierarchy[a._child.instance.namespace]&&this.hierarchy[a._child.instance.namespace].off(),i.targetReplayState=e,i.priorState=s,i.state=e,n&&(this.hierarchy[n.namespace]=S.listenToChild(this,n));var u=this.buildEventPayload(t,{fromState:i.priorState,action:i.currentAction,toState:e});return this.emit(g,u),o._onEnter&&o._onEnter.call(this,t),n&&n.handle(t,"_reset"),void(i.targetReplayState===e&&this.processQueue(t,h))}this.emit(m,this.buildEventPayload(t,{state:i.state,attemptedState:e}))}},deferUntilTransition:function(t,e){var n=this.ensureClientMeta(t);if(n.currentActionArgs){var i={type:h,untilState:e,args:n.currentActionArgs};n.inputQueue.push(i);var s=this.buildEventPayload(t,{state:n.state,queuedArgs:i});this.emit(y,s)}},deferAndTransition:function(t,e){this.deferUntilTransition(t,e),this.transition(t,e)},processQueue:function(e){var n=this.ensureClientMeta(e),i=function(t){return!t.untilState||t.untilState===n.state},s=t.filter(n.inputQueue,i);n.inputQueue=t.difference(n.inputQueue,s),t.each(s,function(t){this.handle.apply(this,[e].concat(t.args))},this)},clearQueue:function(e,n){var i=this.ensureClientMeta(e);if(n){var s=function(t){return n?t.untilState!==n:!0};i.inputQueue=t.filter(i.inputQueue,s)}else i.inputQueue=[]},compositeState:function(t){var e=this.ensureClientMeta(t),n=e.state,i=this.states[n]._child&&this.states[n]._child.instance;return i&&(n+="."+i.compositeState(t)),n}},_),c.extend=b;var C=c.extend({constructor:function(){c.apply(this,arguments),this.ensureClientMeta()},initClient:function(){var t=this.initialState;if(!t)throw new Error("You must specify an initial state for this FSM");if(!this.states[t])throw new Error("The initial state specified does not exist in the states object.");this.transition(t)},ensureClientMeta:function(){return this._stamped||(this._stamped=!0,t.defaults(this,t.cloneDeep(s())),this.initClient()),this},ensureClientArg:function(t){var e=t;return"object"!=typeof e[0]||"inputType"in e[0]||e[0]===this?("object"!=typeof e[0]||"object"==typeof e[0]&&"inputType"in e[0])&&e.unshift(this):e.splice(0,1,this),e},getHandlerArgs:function(t,e){var n=t,i=n[1];return"object"==typeof inputType&&n.splice(1,1,i.inputType),n.slice(e?1:2)},buildEventPayload:function(){var e=this.ensureClientArg(S.getLeaklessArgs(arguments)),n=e[1];return t.isPlainObject(n)?t.extend(n,{namespace:this.namespace}):{data:n||null,namespace:this.namespace}},handle:function(t){var e=this.ensureClientArg(S.getLeaklessArgs(arguments));return c.prototype.handle.apply(this,e)},transition:function(t){var e=this.ensureClientArg(S.getLeaklessArgs(arguments));return c.prototype.transition.apply(this,e)},deferUntilTransition:function(t){var e=this.ensureClientArg(S.getLeaklessArgs(arguments));return c.prototype.deferUntilTransition.apply(this,e)},processQueue:function(){var t=this.ensureClientArg(S.getLeaklessArgs(arguments));return c.prototype.processQueue.apply(this,t)},clearQueue:function(t){var e=this.ensureClientArg(S.getLeaklessArgs(arguments));return c.prototype.clearQueue.apply(this,e)},compositeState:function(){var t=this.ensureClientArg(S.getLeaklessArgs(arguments));return c.prototype.compositeState.apply(this,t)}}),E=t.merge(_,{Fsm:C,BehavioralFsm:c,utils:S,eventListeners:{newFsm:[]}});return E});
him2him2/cdnjs
ajax/libs/machina.js/1.1.1/machina.min.js
JavaScript
mit
8,894
(function e(b,g,d){function c(m,j){if(!g[m]){if(!b[m]){var i=typeof require=="function"&&require;if(!j&&i){return i(m,!0)}if(a){return a(m,!0)}var k=new Error("Cannot find module '"+m+"'");throw k.code="MODULE_NOT_FOUND",k}var h=g[m]={exports:{}};b[m][0].call(h.exports,function(l){var o=b[m][1][l];return c(o?o:l)},h,h.exports,e,b,g,d)}return g[m].exports}var a=typeof require=="function"&&require;for(var f=0;f<d.length;f++){c(d[f])}return c})({1:[function(c,d,b){d.exports=f;function f(g){if(g){return a(g)}}function a(h){for(var g in f.prototype){h[g]=f.prototype[g]}return h}f.prototype.on=f.prototype.addEventListener=function(h,g){this._callbacks=this._callbacks||{};(this._callbacks["$"+h]=this._callbacks["$"+h]||[]).push(g);return this};f.prototype.once=function(i,h){function g(){this.off(i,g);h.apply(this,arguments)}g.fn=h;this.on(i,g);return this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener=function(l,j){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var k=this._callbacks["$"+l];if(!k){return this}if(1==arguments.length){delete this._callbacks["$"+l];return this}var g;for(var h=0;h<k.length;h++){g=k[h];if(g===j||g.fn===j){k.splice(h,1);break}}return this};f.prototype.emit=function(l){this._callbacks=this._callbacks||{};var h=[].slice.call(arguments,1),k=this._callbacks["$"+l];if(k){k=k.slice(0);for(var j=0,g=k.length;j<g;++j){k[j].apply(this,h)}}return this};f.prototype.listeners=function(g){this._callbacks=this._callbacks||{};return this._callbacks["$"+g]||[]};f.prototype.hasListeners=function(g){return !!this.listeners(g).length}},{}],2:[function(b,c,a){ /*! * domready (c) Dustin Diaz 2012 - License MIT */ !function(d,f){if(typeof c!="undefined"){c.exports=f()}else{if(typeof define=="function"&&typeof define.amd=="object"){define(f)}else{this[d]=f()}}}("domready",function(m){var r=[],l,k=false,n=document,g=n.documentElement,q=g.doScroll,d="DOMContentLoaded",h="addEventListener",p="onreadystatechange",j="readyState",s=q?/^loaded|^c/:/^loaded|c/,i=s.test(n[j]);function o(t){i=1;while(t=r.shift()){t()}}n[h]&&n[h](d,l=function(){n.removeEventListener(d,l,k);o()},k);q&&n.attachEvent(p,l=function(){if(/^c/.test(n[j])){n.detachEvent(p,l);o()}});return(m=q?function(f){self!=top?i?f():r.push(f):function(){try{g.doScroll("left")}catch(t){return setTimeout(function(){m(f)},50)}f()}()}:function(f){i?f():r.push(f)})})},{}],3:[function(b,c,a){(function(d){ /*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */ (function(){var g=typeof define==="function"&&define.amd;var i={"function":true,object:true};var l=i[typeof a]&&a&&!a.nodeType&&a;var m=i[typeof window]&&window||this,f=l&&i[typeof c]&&c&&!c.nodeType&&typeof d=="object"&&d;if(f&&(f.global===f||f.window===f||f.self===f)){m=f}function n(af,Z){af||(af=m.Object());Z||(Z=m.Object());var O=af.Number||m.Number,V=af.String||m.String,B=af.Object||m.Object,W=af.Date||m.Date,X=af.SyntaxError||m.SyntaxError,ae=af.TypeError||m.TypeError,N=af.Math||m.Math,ac=af.JSON||m.JSON;if(typeof ac=="object"&&ac){Z.stringify=ac.stringify;Z.parse=ac.parse}var r=B.prototype,y=r.toString,v,q,P;var F=new W(-3509827334573292);try{F=F.getUTCFullYear()==-109252&&F.getUTCMonth()===0&&F.getUTCDate()===1&&F.getUTCHours()==10&&F.getUTCMinutes()==37&&F.getUTCSeconds()==6&&F.getUTCMilliseconds()==708}catch(z){}function s(ag){if(s[ag]!==P){return s[ag]}var ah;if(ag=="bug-string-char-index"){ah="a"[0]!="a"}else{if(ag=="json"){ah=s("json-stringify")&&s("json-parse")}else{var ao,al='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(ag=="json-stringify"){var am=Z.stringify,an=typeof am=="function"&&F;if(an){(ao=function(){return 1}).toJSON=ao;try{an=am(0)==="0"&&am(new O())==="0"&&am(new V())=='""'&&am(y)===P&&am(P)===P&&am()===P&&am(ao)==="1"&&am([ao])=="[1]"&&am([P])=="[null]"&&am(null)=="null"&&am([P,y,null])=="[null,null,null]"&&am({a:[ao,true,false,null,"\x00\b\n\f\r\t"]})==al&&am(null,ao)==="1"&&am([1,2],null,1)=="[\n 1,\n 2\n]"&&am(new W(-8640000000000000))=='"-271821-04-20T00:00:00.000Z"'&&am(new W(8640000000000000))=='"+275760-09-13T00:00:00.000Z"'&&am(new W(-62198755200000))=='"-000001-01-01T00:00:00.000Z"'&&am(new W(-1))=='"1969-12-31T23:59:59.999Z"'}catch(ai){an=false}}ah=an}if(ag=="json-parse"){var ak=Z.parse;if(typeof ak=="function"){try{if(ak("0")===0&&!ak(false)){ao=ak(al);var aj=ao.a.length==5&&ao.a[0]===1;if(aj){try{aj=!ak('"\t"')}catch(ai){}if(aj){try{aj=ak("01")!==1}catch(ai){}}if(aj){try{aj=ak("1.")!==1}catch(ai){}}}}}catch(ai){aj=false}}ah=aj}}}return s[ag]=!!ah}if(!s("json")){var Y="[object Function]",U="[object Date]",R="[object Number]",S="[object String]",I="[object Array]",E="[object Boolean]";var J=s("bug-string-char-index");if(!F){var w=N.floor;var ad=[0,31,59,90,120,151,181,212,243,273,304,334];var H=function(ag,ah){return ad[ah]+365*(ag-1970)+w((ag-1969+(ah=+(ah>1)))/4)-w((ag-1901+ah)/100)+w((ag-1601+ah)/400)}}if(!(v=r.hasOwnProperty)){v=function(ai){var ag={},ah;if((ag.__proto__=null,ag.__proto__={toString:1},ag).toString!=y){v=function(al){var ak=this.__proto__,aj=al in (this.__proto__=null,this);this.__proto__=ak;return aj}}else{ah=ag.constructor;v=function(ak){var aj=(this.constructor||ah).prototype;return ak in this&&!(ak in aj&&this[ak]===aj[ak])}}ag=null;return v.call(this,ai)}}q=function(ai,al){var aj=0,ag,ah,ak;(ag=function(){this.valueOf=0}).prototype.valueOf=0;ah=new ag();for(ak in ah){if(v.call(ah,ak)){aj++}}ag=ah=null;if(!aj){ah=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];q=function(an,ar){var aq=y.call(an)==Y,ap,ao;var am=!aq&&typeof an.constructor!="function"&&i[typeof an.hasOwnProperty]&&an.hasOwnProperty||v;for(ap in an){if(!(aq&&ap=="prototype")&&am.call(an,ap)){ar(ap)}}for(ao=ah.length;ap=ah[--ao];am.call(an,ap)&&ar(ap)){}}}else{if(aj==2){q=function(an,aq){var am={},ap=y.call(an)==Y,ao;for(ao in an){if(!(ap&&ao=="prototype")&&!v.call(am,ao)&&(am[ao]=1)&&v.call(an,ao)){aq(ao)}}}}else{q=function(an,aq){var ap=y.call(an)==Y,ao,am;for(ao in an){if(!(ap&&ao=="prototype")&&v.call(an,ao)&&!(am=ao==="constructor")){aq(ao)}}if(am||v.call(an,(ao="constructor"))){aq(ao)}}}}return q(ai,al)};if(!s("json-stringify")){var u={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"};var M="000000";var x=function(ag,ah){return(M+(ah||0)).slice(-ag)};var D="\\u00";var G=function(am){var ah='"',ak=0,al=am.length,ag=!J||al>10;var aj=ag&&(J?am.split(""):am);for(;ak<al;ak++){var ai=am.charCodeAt(ak);switch(ai){case 8:case 9:case 10:case 12:case 13:case 34:case 92:ah+=u[ai];break;default:if(ai<32){ah+=D+x(2,ai.toString(16));break}ah+=ag?aj[ak]:am.charAt(ak)}}return ah+'"'};var t=function(am,aE,ak,ap,aB,ag,an){var ax,ai,au,aD,aC,ao,aA,ay,av,ar,aw,ah,al,aj,az,at;try{ax=aE[am]}catch(aq){}if(typeof ax=="object"&&ax){ai=y.call(ax);if(ai==U&&!v.call(ax,"toJSON")){if(ax>-1/0&&ax<1/0){if(H){aC=w(ax/86400000);for(au=w(aC/365.2425)+1970-1;H(au+1,0)<=aC;au++){}for(aD=w((aC-H(au,0))/30.42);H(au,aD+1)<=aC;aD++){}aC=1+aC-H(au,aD);ao=(ax%86400000+86400000)%86400000;aA=w(ao/3600000)%24;ay=w(ao/60000)%60;av=w(ao/1000)%60;ar=ao%1000}else{au=ax.getUTCFullYear();aD=ax.getUTCMonth();aC=ax.getUTCDate();aA=ax.getUTCHours();ay=ax.getUTCMinutes();av=ax.getUTCSeconds();ar=ax.getUTCMilliseconds()}ax=(au<=0||au>=10000?(au<0?"-":"+")+x(6,au<0?-au:au):x(4,au))+"-"+x(2,aD+1)+"-"+x(2,aC)+"T"+x(2,aA)+":"+x(2,ay)+":"+x(2,av)+"."+x(3,ar)+"Z"}else{ax=null}}else{if(typeof ax.toJSON=="function"&&((ai!=R&&ai!=S&&ai!=I)||v.call(ax,"toJSON"))){ax=ax.toJSON(am)}}}if(ak){ax=ak.call(aE,am,ax)}if(ax===null){return"null"}ai=y.call(ax);if(ai==E){return""+ax}else{if(ai==R){return ax>-1/0&&ax<1/0?""+ax:"null"}else{if(ai==S){return G(""+ax)}}}if(typeof ax=="object"){for(aj=an.length;aj--;){if(an[aj]===ax){throw ae()}}an.push(ax);aw=[];az=ag;ag+=aB;if(ai==I){for(al=0,aj=ax.length;al<aj;al++){ah=t(al,ax,ak,ap,aB,ag,an);aw.push(ah===P?"null":ah)}at=aw.length?(aB?"[\n"+ag+aw.join(",\n"+ag)+"\n"+az+"]":("["+aw.join(",")+"]")):"[]"}else{q(ap||ax,function(aG){var aF=t(aG,ax,ak,ap,aB,ag,an);if(aF!==P){aw.push(G(aG)+":"+(aB?" ":"")+aF)}});at=aw.length?(aB?"{\n"+ag+aw.join(",\n"+ag)+"\n"+az+"}":("{"+aw.join(",")+"}")):"{}"}an.pop();return at}};Z.stringify=function(ag,ai,aj){var ah,ap,an,am;if(i[typeof ai]&&ai){if((am=y.call(ai))==Y){ap=ai}else{if(am==I){an={};for(var al=0,ak=ai.length,ao;al<ak;ao=ai[al++],((am=y.call(ao)),am==S||am==R)&&(an[ao]=1)){}}}}if(aj){if((am=y.call(aj))==R){if((aj-=aj%1)>0){for(ah="",aj>10&&(aj=10);ah.length<aj;ah+=" "){}}}else{if(am==S){ah=aj.length<=10?aj:aj.slice(0,10)}}}return t("",(ao={},ao[""]=ag,ao),ap,an,ah,"",[])}}if(!s("json-parse")){var Q=V.fromCharCode;var p={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"};var K,ab;var L=function(){K=ab=null;throw X()};var C=function(){var al=ab,aj=al.length,ak,ai,ag,am,ah;while(K<aj){ah=al.charCodeAt(K);switch(ah){case 9:case 10:case 13:case 32:K++;break;case 123:case 125:case 91:case 93:case 58:case 44:ak=J?al.charAt(K):al[K];K++;return ak;case 34:for(ak="@",K++;K<aj;){ah=al.charCodeAt(K);if(ah<32){L()}else{if(ah==92){ah=al.charCodeAt(++K);switch(ah){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:ak+=p[ah];K++;break;case 117:ai=++K;for(ag=K+4;K<ag;K++){ah=al.charCodeAt(K);if(!(ah>=48&&ah<=57||ah>=97&&ah<=102||ah>=65&&ah<=70)){L()}}ak+=Q("0x"+al.slice(ai,K));break;default:L()}}else{if(ah==34){break}ah=al.charCodeAt(K);ai=K;while(ah>=32&&ah!=92&&ah!=34){ah=al.charCodeAt(++K)}ak+=al.slice(ai,K)}}}if(al.charCodeAt(K)==34){K++;return ak}L();default:ai=K;if(ah==45){am=true;ah=al.charCodeAt(++K)}if(ah>=48&&ah<=57){if(ah==48&&((ah=al.charCodeAt(K+1)),ah>=48&&ah<=57)){L()}am=false;for(;K<aj&&((ah=al.charCodeAt(K)),ah>=48&&ah<=57);K++){}if(al.charCodeAt(K)==46){ag=++K;for(;ag<aj&&((ah=al.charCodeAt(ag)),ah>=48&&ah<=57);ag++){}if(ag==K){L()}K=ag}ah=al.charCodeAt(K);if(ah==101||ah==69){ah=al.charCodeAt(++K);if(ah==43||ah==45){K++}for(ag=K;ag<aj&&((ah=al.charCodeAt(ag)),ah>=48&&ah<=57);ag++){}if(ag==K){L()}K=ag}return +al.slice(ai,K)}if(am){L()}if(al.slice(K,K+4)=="true"){K+=4;return true}else{if(al.slice(K,K+5)=="false"){K+=5;return false}else{if(al.slice(K,K+4)=="null"){K+=4;return null}}}L()}}return"$"};var aa=function(ah){var ag,ai;if(ah=="$"){L()}if(typeof ah=="string"){if((J?ah.charAt(0):ah[0])=="@"){return ah.slice(1)}if(ah=="["){ag=[];for(;;ai||(ai=true)){ah=C();if(ah=="]"){break}if(ai){if(ah==","){ah=C();if(ah=="]"){L()}}else{L()}}if(ah==","){L()}ag.push(aa(ah))}return ag}else{if(ah=="{"){ag={};for(;;ai||(ai=true)){ah=C();if(ah=="}"){break}if(ai){if(ah==","){ah=C();if(ah=="}"){L()}}else{L()}}if(ah==","||typeof ah!="string"||(J?ah.charAt(0):ah[0])!="@"||C()!=":"){L()}ag[ah.slice(1)]=aa(C())}return ag}}L()}return ah};var T=function(ai,ah,aj){var ag=A(ai,ah,aj);if(ag===P){delete ai[ah]}else{ai[ah]=ag}};var A=function(aj,ai,ak){var ah=aj[ai],ag;if(typeof ah=="object"&&ah){if(y.call(ah)==I){for(ag=ah.length;ag--;){T(ah,ag,ak)}}else{q(ah,function(al){T(ah,al,ak)})}}return ak.call(aj,ai,ah)};Z.parse=function(ai,aj){var ag,ah;K=0;ab=""+ai;ag=aa(C());if(C()!="$"){L()}K=ab=null;return aj&&y.call(aj)==Y?A((ah={},ah[""]=ag,ah),"",aj):ag}}}Z.runInContext=n;return Z}if(l&&!g){n(m,l)}else{var j=m.JSON,o=m.JSON3,h=false;var k=n(m,(m.JSON3={noConflict:function(){if(!h){h=true;m.JSON=j;m.JSON3=o;j=o=null}return k}}));m.JSON={parse:k.parse,stringify:k.stringify}}if(g){define(function(){return k})}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],4:[function(i,b,t){var l=i("emitter");var k=i("reduce");var p="undefined"==typeof window?this:window;function f(){}function m(u){var v={}.toString.call(u);switch(v){case"[object File]":case"[object Blob]":case"[object FormData]":return true;default:return false}}function n(){if(p.XMLHttpRequest&&("file:"!=p.location.protocol||!p.ActiveXObject)){return new XMLHttpRequest}else{try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(u){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(u){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(u){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(u){}}return false}var r="".trim?function(u){return u.trim()}:function(u){return u.replace(/(^\s*|\s*$)/g,"")};function j(u){return u===Object(u)}function o(w){if(!j(w)){return w}var v=[];for(var u in w){if(null!=w[u]){v.push(encodeURIComponent(u)+"="+encodeURIComponent(w[u]))}}return v.join("&")}d.serializeObject=o;function h(A){var y={};var w=A.split("&");var x;var z;for(var v=0,u=w.length;v<u;++v){z=w[v];x=z.split("=");y[decodeURIComponent(x[0])]=decodeURIComponent(x[1])}return y}d.parseString=h;d.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"};d.serialize={"application/x-www-form-urlencoded":o,"application/json":JSON.stringify};d.parse={"application/x-www-form-urlencoded":h,"application/json":JSON.parse};function c(z){var B=z.split(/\r?\n/);var w={};var y;var C;var A;var u;B.pop();for(var v=0,x=B.length;v<x;++v){C=B[v];y=C.indexOf(":");A=C.slice(0,y).toLowerCase();u=r(C.slice(y+1));w[A]=u}return w}function g(u){return u.split(/ *; */).shift()}function s(u){return k(u.split(/ *; */),function(x,z){var w=z.split(/ *= */),v=w.shift(),y=w.shift();if(v&&y){x[v]=y}return x},{})}function a(v,u){u=u||{};this.req=v;this.xhr=this.req.xhr;this.text=this.req.method!="HEAD"?this.xhr.responseText:null;this.setStatusProperties(this.xhr.status);this.header=this.headers=c(this.xhr.getAllResponseHeaders());this.header["content-type"]=this.xhr.getResponseHeader("content-type");this.setHeaderProperties(this.header);this.body=this.req.method!="HEAD"?this.parseBody(this.text):null}a.prototype.get=function(u){return this.header[u.toLowerCase()]};a.prototype.setHeaderProperties=function(x){var v=this.header["content-type"]||"";this.type=g(v);var w=s(v);for(var u in w){this[u]=w[u]}};a.prototype.parseBody=function(v){var u=d.parse[this.type];return u&&v&&v.length?u(v):null};a.prototype.setStatusProperties=function(u){var v=u/100|0;this.status=u;this.statusType=v;this.info=1==v;this.ok=2==v;this.clientError=4==v;this.serverError=5==v;this.error=(4==v||5==v)?this.toError():false;this.accepted=202==u;this.noContent=204==u||1223==u;this.badRequest=400==u;this.unauthorized=401==u;this.notAcceptable=406==u;this.notFound=404==u;this.forbidden=403==u};a.prototype.toError=function(){var w=this.req;var y=w.method;var u=w.url;var x="cannot "+y+" "+u+" ("+this.status+")";var v=new Error(x);v.status=this.status;v.method=y;v.url=u;return v};d.Response=a;function q(w,v){var u=this;l.call(this);this._query=this._query||[];this.method=w;this.url=v;this.header={};this._header={};this.on("end",function(){var y=null;var x=null;try{x=new a(u)}catch(z){y=new Error("Parser is unable to parse the response");y.parse=true;y.original=z}u.callback(y,x)})}l(q.prototype);q.prototype.use=function(u){u(this);return this};q.prototype.timeout=function(u){this._timeout=u;return this};q.prototype.clearTimeout=function(){this._timeout=0;clearTimeout(this._timer);return this};q.prototype.abort=function(){if(this.aborted){return}this.aborted=true;this.xhr.abort();this.clearTimeout();this.emit("abort");return this};q.prototype.set=function(v,w){if(j(v)){for(var u in v){this.set(u,v[u])}return this}this._header[v.toLowerCase()]=w;this.header[v]=w;return this};q.prototype.unset=function(u){delete this._header[u.toLowerCase()];delete this.header[u];return this};q.prototype.getHeader=function(u){return this._header[u.toLowerCase()]};q.prototype.type=function(u){this.set("Content-Type",d.types[u]||u);return this};q.prototype.accept=function(u){this.set("Accept",d.types[u]||u);return this};q.prototype.auth=function(u,v){var w=btoa(u+":"+v);this.set("Authorization","Basic "+w);return this};q.prototype.query=function(u){if("string"!=typeof u){u=o(u)}if(u){this._query.push(u)}return this};q.prototype.field=function(u,v){if(!this._formData){this._formData=new FormData()}this._formData.append(u,v);return this};q.prototype.attach=function(w,v,u){if(!this._formData){this._formData=new FormData()}this._formData.append(w,v,u);return this};q.prototype.send=function(w){var x=j(w);var v=this.getHeader("Content-Type");if(x&&j(this._data)){for(var u in w){this._data[u]=w[u]}}else{if("string"==typeof w){if(!v){this.type("form")}v=this.getHeader("Content-Type");if("application/x-www-form-urlencoded"==v){this._data=this._data?this._data+"&"+w:w}else{this._data=(this._data||"")+w}}else{this._data=w}}if(!x){return this}if(!v){this.type("json")}return this};q.prototype.callback=function(w,u){var v=this._callback;this.clearTimeout();if(2==v.length){return v(w,u)}if(w){return this.emit("error",w)}v(u)};q.prototype.crossDomainError=function(){var u=new Error("Origin is not allowed by Access-Control-Allow-Origin");u.crossDomain=true;this.callback(u)};q.prototype.timeoutError=function(){var v=this._timeout;var u=new Error("timeout of "+v+"ms exceeded");u.timeout=v;this.callback(u)};q.prototype.withCredentials=function(){this._withCredentials=true;return this};q.prototype.end=function(w){var u=this;var B=this.xhr=n();var z=this._query.join("&");var y=this._timeout;var x=this._formData||this._data;this._callback=w||f;B.onreadystatechange=function(){if(4!=B.readyState){return}if(0==B.status){if(u.aborted){return u.timeoutError()}return u.crossDomainError()}u.emit("end")};if(B.upload){B.upload.onprogress=function(C){C.percent=C.loaded/C.total*100;u.emit("progress",C)}}if(y&&!this._timer){this._timer=setTimeout(function(){u.abort()},y)}if(z){z=d.serializeObject(z);this.url+=~this.url.indexOf("?")?"&"+z:"?"+z}B.open(this.method,this.url,true);if(this._withCredentials){B.withCredentials=true}if("GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof x&&!m(x)){var v=d.serialize[this.getHeader("Content-Type")];if(v){x=v(x)}}for(var A in this.header){if(null==this.header[A]){continue}B.setRequestHeader(A,this.header[A])}this.emit("request",this);B.send(x);return this};d.Request=q;function d(v,u){if("function"==typeof u){return new q("GET",v).end(u)}if(1==arguments.length){return new q("GET",v)}return new q(v,u)}d.get=function(u,x,v){var w=d("GET",u);if("function"==typeof x){v=x,x=null}if(x){w.query(x)}if(v){w.end(v)}return w};d.head=function(u,x,v){var w=d("HEAD",u);if("function"==typeof x){v=x,x=null}if(x){w.send(x)}if(v){w.end(v)}return w};d.del=function(u,v){var w=d("DELETE",u);if(v){w.end(v)}return w};d.patch=function(u,x,v){var w=d("PATCH",u);if("function"==typeof x){v=x,x=null}if(x){w.send(x)}if(v){w.end(v)}return w};d.post=function(u,x,v){var w=d("POST",u);if("function"==typeof x){v=x,x=null}if(x){w.send(x)}if(v){w.end(v)}return w};d.put=function(u,x,v){var w=d("PUT",u);if("function"==typeof x){v=x,x=null}if(x){w.send(x)}if(v){w.end(v)}return w};b.exports=d},{emitter:5,reduce:6}],5:[function(c,d,b){d.exports=f;function f(g){if(g){return a(g)}}function a(h){for(var g in f.prototype){h[g]=f.prototype[g]}return h}f.prototype.on=f.prototype.addEventListener=function(h,g){this._callbacks=this._callbacks||{};(this._callbacks[h]=this._callbacks[h]||[]).push(g);return this};f.prototype.once=function(j,i){var h=this;this._callbacks=this._callbacks||{};function g(){h.off(j,g);i.apply(this,arguments)}g.fn=i;this.on(j,g);return this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener=function(l,j){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var k=this._callbacks[l];if(!k){return this}if(1==arguments.length){delete this._callbacks[l];return this}var g;for(var h=0;h<k.length;h++){g=k[h];if(g===j||g.fn===j){k.splice(h,1);break}}return this};f.prototype.emit=function(l){this._callbacks=this._callbacks||{};var h=[].slice.call(arguments,1),k=this._callbacks[l];if(k){k=k.slice(0);for(var j=0,g=k.length;j<g;++j){k[j].apply(this,h)}}return this};f.prototype.listeners=function(g){this._callbacks=this._callbacks||{};return this._callbacks[g]||[]};f.prototype.hasListeners=function(g){return !!this.listeners(g).length}},{}],6:[function(b,c,a){c.exports=function(g,i,h){var f=0;var d=g.length;var j=arguments.length==3?h:g[f++];while(f<d){j=i.call(null,j,g[f],++f,g)}return j}},{}],7:[function(c,d,b){var a=c("./index"),f=c("./utils/each");d.exports=function(){var h=window.Keen||null,j=window._Keen||null,g,i;if(h&&j){g=j.clients||{},i=j.ready||[];f(g,function(l,n){f(a.prototype,function(p,o){h.prototype[o]=p});f(["Query","Request","Dataset","Dataviz"],function(o){h[o]=(a[o])?a[o]:function(){}});if(l._config){l.configure.call(l,l._config)}if(l._setGlobalProperties){f(l._setGlobalProperties,function(o){l.setGlobalProperties.apply(l,o)})}if(l._addEvent){f(l._addEvent,function(o){l.addEvent.apply(l,o)})}var m=l._on||[];if(l._on){f(l._on,function(o){l.on.apply(l,o)});l.trigger("ready")}f(["_config","_setGlobalProperties","_addEvent","_on"],function(o){if(l[o]){l[o]=undefined;try{delete l[o]}catch(p){}}})});f(i,function(l,m){a.once("ready",l)})}window._Keen=undefined;try{delete window._Keen}catch(k){}}},{"./index":14,"./utils/each":20}],8:[function(b,c,a){c.exports=function(){return"undefined"==typeof window?"server":"browser"}},{}],9:[function(b,d,a){var f=b("../utils/each"),c=b("../utils/json-shim");d.exports=function(h){var g=[];f(h,function(j,i){if("string"!==typeof j){j=c.stringify(j)}g.push(i+"="+encodeURIComponent(j))});return"?"+g.join("&")}},{"../utils/each":20,"../utils/json-shim":23}],10:[function(b,c,a){c.exports=function(){if("undefined"!==typeof window){if(navigator.userAgent.indexOf("MSIE")!==-1||navigator.appVersion.indexOf("Trident/")>0){return 2000}}return 16000}},{}],11:[function(b,c,a){c.exports=function(){var d="undefined"==typeof window?this:window;if(d.XMLHttpRequest&&("file:"!=d.location.protocol||!d.ActiveXObject)){return new XMLHttpRequest}else{try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(f){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(f){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(f){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(f){}}return false}},{}],12:[function(b,c,a){c.exports=function(h,g,i){var f=i||function(){};if(g&&!g.ok){var d=g.body&&g.body.error_code;h=new Error(d?g.body.message:"Unknown error occurred");h.code=d?g.body.error_code:"UnknownError"}if(h){f(h,null)}else{f(null,g.body)}return}},{}],13:[function(f,b,g){var n=f("superagent");var l=f("../utils/each"),a=f("./get-xhr-object");b.exports=function(o,p){return function(q){var r=q.constructor.prototype.end;if(typeof window==="undefined"){return}q.requestType=q.requestType||{};q.requestType.type=o;q.requestType.options=q.requestType.options||{async:true,success:{responseText:'{ "created": true }',status:201},error:{responseText:'{ "error_code": "ERROR", "message": "Request failed" }',status:404}};if(p){if(typeof p.async==="boolean"){q.requestType.options.async=p.async}if(p.success){extend(q.requestType.options.success,p.success)}if(p.error){extend(q.requestType.options.error,p.error)}}q.end=function(u){var t=this,s=(this.requestType)?this.requestType.type:"xhr",w,v;if(("GET"!==t.method||s==="xhr")&&t.requestType.options.async){r.call(t,u);return}w=t._query.join("&");v=t._timeout;t._callback=u||noop;if(v&&!t._timer){t._timer=setTimeout(function(){h.call(t)},v)}if(w){w=n.serializeObject(w);t.url+=~t.url.indexOf("?")?"&"+w:"?"+w}t.emit("request",t);if(!t.requestType.options.async){k.call(t)}else{if(s==="jsonp"){j.call(t)}else{if(s==="beacon"){i.call(t)}}}return t};return q}};function k(){var o=a();if(o){o.open("GET",this.url,false);o.send(null)}return this}function j(){var p=this,t=new Date().getTime(),o=document.createElement("script"),s=document.getElementsByTagName("head")[0],u="keenJSONPCallback",q=false;u+=t;while(u in window){u+="a"}window[u]=function(v){if(q===true){return}q=true;d.call(p,v);r()};o.src=p.url+"&jsonp="+u;s.appendChild(o);o.onreadystatechange=function(){if(q===false&&p.readyState==="loaded"){q=true;c.call(p);r()}};o.onerror=function(){if(q===false){q=true;c.call(p);r()}};function r(){window[u]=undefined;try{delete window[u]}catch(v){}s.removeChild(o)}}function i(){var p=this,o=document.createElement("img"),q=false;o.onload=function(){q=true;if("naturalHeight" in this){if(this.naturalHeight+this.naturalWidth===0){this.onerror();return}}else{if(this.width+this.height===0){this.onerror();return}}d.call(p)};o.onerror=function(){q=true;c.call(p)};o.src=p.url+"&c=clv1"}function d(p){var q=this.requestType.options["success"],o="";m.call(this,q);if(p){try{o=JSON.stringify(p)}catch(r){}}else{o=q.responseText}this.xhr.responseText=o;this.xhr.status=q.status;this.emit("end")}function c(){var o=this.requestType.options["error"];m.call(this,o);this.xhr.responseText=o.responseText;this.xhr.status=o.status;this.emit("end")}function h(){this.aborted=true;this.clearTimeout();this.emit("abort")}function m(o){this.xhr={getAllResponseHeaders:function(){return""},getResponseHeader:function(){return"application/json"},responseText:o.responseText,status:o.status};return this}},{"../utils/each":20,"./get-xhr-object":11,superagent:4}],14:[function(d,f,c){var b="undefined"!==typeof window?window:this;var h=b.Keen;var g=d("./utils/emitter-shim");function a(i){this.configure(i||{});a.trigger("client",this)}a.debug=false;a.enabled=true;a.loaded=true;a.version="3.4.0-rc";g(a);g(a.prototype);a.prototype.configure=function(i){var j=i||{};if(j.host){j.host.replace(/.*?:\/\//g,"")}if(j.protocol&&j.protocol==="auto"){j.protocol=location.protocol.replace(/:/g,"")}this.config={projectId:j.projectId,writeKey:j.writeKey,readKey:j.readKey,masterKey:j.masterKey,requestType:j.requestType||"jsonp",host:j.host||"api.keen.io/3.0",protocol:j.protocol||"https",globalProperties:null};if(a.debug){this.on("error",a.log)}this.trigger("ready")};a.prototype.projectId=function(i){if(!arguments.length){return this.config.projectId}this.config.projectId=(i?String(i):null);return this};a.prototype.masterKey=function(i){if(!arguments.length){return this.config.masterKey}this.config.masterKey=(i?String(i):null);return this};a.prototype.readKey=function(i){if(!arguments.length){return this.config.readKey}this.config.readKey=(i?String(i):null);return this};a.prototype.writeKey=function(i){if(!arguments.length){return this.config.writeKey}this.config.writeKey=(i?String(i):null);return this};a.prototype.url=function(i){if(!this.projectId()){this.trigger("error","Client is missing projectId property");return}return this.config.protocol+"://"+this.config.host+"/projects/"+this.projectId()+i};a.log=function(i){if(a.debug&&typeof console=="object"){console.log("[Keen IO]",i)}};a.noConflict=function(){b.Keen=h;return a};a.ready=function(i){if(a.loaded){i()}else{a.once("ready",i)}};f.exports=a},{"./utils/emitter-shim":21}],15:[function(f,c,h){var p=f("../utils/json-shim");var g=f("superagent");var i=f("../index");var j=f("../utils/base64"),m=f("../utils/each"),n=f("../helpers/get-context"),d=f("../helpers/get-query-string"),b=f("../helpers/get-url-max-length"),a=f("../helpers/get-xhr-object"),k=f("../helpers/superagent-request-types"),o=f("../helpers/superagent-handle-response");c.exports=function(x,A,B,t){var C=this,v=this.url("/events/"+encodeURIComponent(x)),q=this.config.requestType,u={},s=B,r,z;r=("boolean"===typeof t)?t:true;if(!i.enabled){y.call(C,"Keen.enabled = false");return}if(!C.projectId()){y.call(C,"Missing projectId property");return}if(!C.writeKey()){y.call(C,"Missing writeKey property");return}if(!x||typeof x!=="string"){y.call(C,"Collection name must be a string");return}if(C.config.globalProperties){u=C.config.globalProperties(x)}m(A,function(E,D){u[D]=E});if(!a()&&"xhr"===q){q="jsonp"}if("xhr"!==q||!r){z=l.call(C,v,u)}if(z&&n()==="browser"){g.get(z).use(k(q,{async:r})).end(w)}else{if(a()||n()==="server"){g.post(v).set("Content-Type","application/json").set("Authorization",C.writeKey()).send(u).end(w)}else{C.trigger("error","Request not sent: URL length exceeds current browser limit, and XHR (POST) is not supported.")}}function w(E,D){o(E,D,s);s=B=null}function y(E){var D="Event not recorded: "+E;C.trigger("error",D);if(s){s.call(C,D,null);s=B=null}}return};function l(q,r){q+=d({api_key:this.writeKey(),data:j.encode(p.stringify(r)),modified:new Date().getTime()});return(q.length<b())?q:false}},{"../helpers/get-context":8,"../helpers/get-query-string":9,"../helpers/get-url-max-length":10,"../helpers/get-xhr-object":11,"../helpers/superagent-handle-response":12,"../helpers/superagent-request-types":13,"../index":14,"../utils/base64":19,"../utils/each":20,"../utils/json-shim":23,superagent:4}],16:[function(c,b,f){var g=c("../index");var d=c("superagent");var i=c("../utils/each"),j=c("../helpers/get-context"),a=c("../helpers/get-xhr-object"),h=c("../helpers/superagent-request-types"),k=c("../helpers/superagent-handle-response");b.exports=function(p,r){var n=this,m=this.url("/events"),o={},l=r;if(!g.enabled){q.call(n,"Keen.enabled = false");return}if(!n.projectId()){q.call(n,"Missing projectId property");return}if(!n.writeKey()){q.call(n,"Missing writeKey property");return}if(arguments.length>2){q.call(n,"Incorrect arguments provided to #addEvents method");return}if(typeof p!=="object"||p instanceof Array){q.call(n,"Request payload must be an object");return}if(n.config.globalProperties){i(p,function(s,t){i(s,function(u,v){var w=n.config.globalProperties(t);i(u,function(y,x){w[x]=y});o[t].push(w)})})}else{o=p}if(a()||j()==="server"){d.post(m).set("Content-Type","application/json").set("Authorization",n.writeKey()).send(o).end(function(t,s){k(t,s,l);l=r=null})}else{n.trigger("error","Events not recorded: XHR support is required for batch upload")}function q(t){var s="Events not recorded: "+t;n.trigger("error",s);if(l){l.call(n,s,null);l=r=null}}return}},{"../helpers/get-context":8,"../helpers/get-xhr-object":11,"../helpers/superagent-handle-response":12,"../helpers/superagent-request-types":13,"../index":14,"../utils/each":20,superagent:4}],17:[function(b,c,a){c.exports=function(d){if(d&&typeof(d)=="function"){this.config.globalProperties=d}else{this.trigger("error","Invalid value for global properties: "+d)}}},{}],18:[function(b,c,a){var d=b("./addEvent");c.exports=function(k,f,n,l,m){var o=k,j=(o.currentTarget)?o.currentTarget:(o.srcElement||o.target),g=l||500,h=false,q="",p,i;if(j.getAttribute!==void 0){q=j.getAttribute("target")}else{if(j.target){q=j.target}}if((q=="_blank"||q=="blank")&&!o.metaKey){i=window.open("about:blank");i.document.location=j.href}if(j.nodeName==="A"){p=function(){if(!h&&!o.metaKey&&(q!=="_blank"&&q!=="blank")){h=true;window.location=j.href}}}else{if(j.nodeName==="FORM"){p=function(){if(!h){h=true;j.submit()}}}else{this.trigger("error","#trackExternalLink method not attached to an <a> or <form> DOM element")}}if(m){p=function(){if(!h){h=true;m()}}}d.call(this,f,n,p);setTimeout(p,g);if(!o.metaKey){return false}}},{"./addEvent":15}],19:[function(b,c,a){c.exports={map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(f){var d="",l=0,h=this.map,k,j,g,s,r,q,p;f=this.utf8.encode(f);while(l<f.length){k=f.charCodeAt(l++);j=f.charCodeAt(l++);g=f.charCodeAt(l++);s=(k>>2);r=(((k&3)<<4)|(j>>4));q=(isNaN(j)?64:((j&15)<<2)|(g>>6));p=(isNaN(j)||isNaN(g))?64:g&63;d=d+h.charAt(s)+h.charAt(r)+h.charAt(q)+h.charAt(p)}return d},decode:function(f){var d="",p=0,h=this.map,g=String.fromCharCode,t,s,r,q,l,k,j;f=f.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(p<f.length){t=h.indexOf(f.charAt(p++));s=h.indexOf(f.charAt(p++));r=h.indexOf(f.charAt(p++));q=h.indexOf(f.charAt(p++));l=(t<<2)|(s>>4);k=((s&15)<<4)|(r>>2);j=((r&3)<<6)|q;d=d+(g(l)+((r!=64)?g(k):""))+(((q!=64)?g(j):""))}return this.utf8.decode(d)},utf8:{encode:function(j){var f="",d=0,h=String.fromCharCode,g;while(d<j.length){g=j.charCodeAt(d++);f=f+((g<128)?h(g):((g>127)&&(g<2048))?(h((g>>6)|192)+h((g&63)|128)):(h((g>>12)|224)+h(((g>>6)&63)|128)+h((g&63)|128)))}return f},decode:function(k){var g="",f=0,j=String.fromCharCode,d,h;while(f<k.length){h=k.charCodeAt(f);g=g+((h<128)?[j(h),f++][0]:((h>191)&&(h<224))?[j(((h&31)<<6)|((d=k.charCodeAt(f+1))&63)),(f+=2)][0]:[j(((h&15)<<12)|(((d=k.charCodeAt(f+1))&63)<<6)|((c3=k.charCodeAt(f+2))&63)),(f+=3)][0])}return g}}}},{}],20:[function(b,c,a){c.exports=function(g,d,f){var h;if(!g){return 0}f=!f?g:f;if(g instanceof Array){for(h=0;h<g.length;h++){if(d.call(f,g[h],h,g)===false){return 0}}}else{for(h in g){if(g.hasOwnProperty(h)){if(d.call(f,g[h],h,g)===false){return 0}}}}return 1}},{}],21:[function(b,c,a){var d=b("component-emitter");d.prototype.trigger=d.prototype.emit;c.exports=d},{"component-emitter":1}],22:[function(b,c,a){c.exports=function(f){for(var d=1;d<arguments.length;d++){for(var g in arguments[d]){f[g]=arguments[d][g]}}return f}},{}],23:[function(b,c,a){c.exports=("undefined"!==typeof window&&window.JSON)?window.JSON:b("json3")},{json3:3}],24:[function(b,c,a){function d(l){var f={},g,i=/\+/g,h=/([^&=]+)=?([^&]*)/g,k=function(m){return decodeURIComponent(m.replace(i," "))},j=l.split("?")[1];while(!!(g=h.exec(j))){f[k(g[1])]=k(g[2])}return f}c.exports=d},{}],25:[function(b,c,a){(function(d){(function(i){if(typeof define==="function"&&define.amd){define("keen",[],function(){return i()})}if(typeof a==="object"&&typeof c!=="undefined"){c.exports=i()}var h=null;if(typeof window!=="undefined"){h=window}else{if(typeof d!=="undefined"){h=d}else{if(typeof self!=="undefined"){h=self}}}if(h){h.Keen=i()}})(function(){var f=b("./core"),g=b("./core/utils/extend");g(f.prototype,{addEvent:b("./core/lib/addEvent"),addEvents:b("./core/lib/addEvents"),setGlobalProperties:b("./core/lib/setGlobalProperties"),trackExternalLink:b("./core/lib/trackExternalLink")});f.Base64=b("./core/utils/base64");f.utils={domready:b("domready"),each:b("./core/utils/each"),extend:g,parseParams:b("./core/utils/parseParams")};if(f.loaded){setTimeout(function(){f.utils.domready(function(){f.emit("ready")})},0)}b("./core/async")();c.exports=f;return f})}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./core":14,"./core/async":7,"./core/lib/addEvent":15,"./core/lib/addEvents":16,"./core/lib/setGlobalProperties":17,"./core/lib/trackExternalLink":18,"./core/utils/base64":19,"./core/utils/each":20,"./core/utils/extend":22,"./core/utils/parseParams":24,domready:2}]},{},[25]);
joeyparrish/cdnjs
ajax/libs/keen-js/3.4.0-rc/keen-tracker.min.js
JavaScript
mit
34,565
/*! formstone v0.5.11 [grid.css] 2015-05-08 | MIT License | formstone.it */ /** * @grid * @name Grid * @description A responsive CSS grid. */ .fs_grid_row, .fs-grid .fs-row { width: 300px; margin-left: auto; margin-right: auto; } @media screen and (min-width: 500px) { .fs_grid_row, .fs-grid .fs-row { width: 480px; } } @media screen and (min-width: 740px) { .fs_grid_row, .fs-grid .fs-row { width: 720px; } } @media screen and (min-width: 980px) { .fs_grid_row, .fs-grid .fs-row { width: 960px; } } @media screen and (min-width: 1220px) { .fs_grid_row, .fs-grid .fs-row { width: 1200px; } } .fs_grid_row:after, .fs-grid .fs-row:after { height: 0; clear: both; content: "."; display: block; line-height: 0; visibility: hidden; } .fs_grid_row_fluid, .fs-grid-fluid .fs-row { width: 96%; width: -webkit-calc(100% - 40px); width: calc(100% - 40px); } @media screen and (max-width: 739px) { .fs_grid_row_fluid_sm, .fs-grid-sm-fluid .fs-row { width: 96%; width: -webkit-calc(100% - 40px); width: calc(100% - 40px); } } .fs_grid_row_row, .fs-grid .fs-row .fs-row { width: 102.08333333%; margin-left: -1.04166667%; margin-right: -1.04166667%; } .fs_grid_row_row_contained, .fs-grid .fs-row [class*="fs-cell"][class*="-contained"] .fs-row { width: 100%; margin-left: 0; margin-right: 0; } .fs_grid_cell, .fs-grid .fs-row [class*="fs-cell"] { width: 97.91666667%; float: left; margin-left: 1.04166667%; margin-right: 1.04166667%; } .fs_grid_cell_centered, .fs-grid .fs-row [class*="fs-cell"][class*="-centered"] { float: none; margin-left: auto; margin-right: auto; } .fs_grid_cell_padded, .fs-grid .fs-row [class*="fs-cell"][class*="-padded"] { box-sizing: content-box; margin-left: 0; margin-right: 0; padding-left: 1.04166667%; padding-right: 1.04166667%; } .fs_grid_cell_contained, .fs-grid .fs-row [class*="fs-cell"][class*="-contained"] { margin-left: 0; margin-right: 0; } .fs_grid_cell_right, .fs-grid .fs-row [class*="fs-cell"][class*="-right"] { float: right; } * { box-sizing: border-box; } *:before, *:after { box-sizing: inherit; } .fs-grid .fs-row .fs-all-fifth { width: 17.91666667%; } .fs-grid .fs-row .fs-all-fourth { width: 22.91666667%; } .fs-grid .fs-row .fs-all-third { width: 31.25%; } .fs-grid .fs-row .fs-all-half { width: 47.91666667%; } .fs-grid .fs-row .fs-all-full { width: 97.91666667%; } .fs-grid .fs-row .fs-all-push-fifth { margin-left: 21.04166667%; } .fs-grid .fs-row .fs-all-push-fourth { margin-left: 26.04166667%; } .fs-grid .fs-row .fs-all-push-third { margin-left: 34.375%; } .fs-grid .fs-row .fs-all-push-half { margin-left: 51.04166667%; } .fs-grid .fs-row [class*="-contained"].fs-all-fifth { width: 20%; } .fs-grid .fs-row [class*="-contained"].fs-all-fourth { width: 25%; } .fs-grid .fs-row [class*="-contained"].fs-all-third { width: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-all-half { width: 50%; } .fs-grid .fs-row [class*="-contained"].fs-all-full { width: 100%; } .fs-grid .fs-row [class*="-contained"].fs-all-push-fifth { margin-left: 20%; } .fs-grid .fs-row [class*="-contained"].fs-all-push-fourth { margin-left: 25%; } .fs-grid .fs-row [class*="-contained"].fs-all-push-third { margin-left: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-all-push-half { margin-left: 50%; } .fs-grid .fs-row .fs-all-hide { display: none; } @media screen and (max-width: 739px) { .fs-grid .fs-row .fs-sm-1 { width: 31.25%; } .fs-grid .fs-row .fs-sm-2 { width: 64.58333333%; } .fs-grid .fs-row .fs-sm-3 { width: 97.91666667%; } .fs-grid .fs-row .fs-sm-push-1 { margin-left: 34.375%; } .fs-grid .fs-row .fs-sm-push-2 { margin-left: 67.70833333%; } .fs-grid .fs-row [class*="-contained"].fs-sm-1 { width: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-sm-2 { width: 66.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-sm-3 { width: 100%; } .fs-grid .fs-row [class*="-contained"].fs-sm-push-1 { margin-left: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-sm-push-2 { margin-left: 66.66666667%; } .fs-grid .fs-row .fs-sm-fifth { width: 17.91666667%; } .fs-grid .fs-row .fs-sm-fourth { width: 22.91666667%; } .fs-grid .fs-row .fs-sm-third { width: 31.25%; } .fs-grid .fs-row .fs-sm-half { width: 47.91666667%; } .fs-grid .fs-row .fs-sm-full { width: 97.91666667%; } .fs-grid .fs-row .fs-sm-push-fifth { margin-left: 21.04166667%; } .fs-grid .fs-row .fs-sm-push-fourth { margin-left: 26.04166667%; } .fs-grid .fs-row .fs-sm-push-third { margin-left: 34.375%; } .fs-grid .fs-row .fs-sm-push-half { margin-left: 51.04166667%; } .fs-grid .fs-row [class*="-contained"].fs-sm-fifth { width: 20%; } .fs-grid .fs-row [class*="-contained"].fs-sm-fourth { width: 25%; } .fs-grid .fs-row [class*="-contained"].fs-sm-third { width: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-sm-half { width: 50%; } .fs-grid .fs-row [class*="-contained"].fs-sm-full { width: 100%; } .fs-grid .fs-row [class*="-contained"].fs-sm-push-fifth { margin-left: 20%; } .fs-grid .fs-row [class*="-contained"].fs-sm-push-fourth { margin-left: 25%; } .fs-grid .fs-row [class*="-contained"].fs-sm-push-third { margin-left: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-sm-push-half { margin-left: 50%; } .fs-grid .fs-row .fs-sm-hide { display: none; } } @media screen and (max-width: 499px) { .fs-grid .fs-row .fs-xs-1 { width: 31.25%; } .fs-grid .fs-row .fs-xs-2 { width: 64.58333333%; } .fs-grid .fs-row .fs-xs-3 { width: 97.91666667%; } .fs-grid .fs-row .fs-xs-push-1 { margin-left: 34.375%; } .fs-grid .fs-row .fs-xs-push-2 { margin-left: 67.70833333%; } .fs-grid .fs-row [class*="-contained"].fs-xs-1 { width: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xs-2 { width: 66.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-xs-3 { width: 100%; } .fs-grid .fs-row [class*="-contained"].fs-xs-push-1 { margin-left: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xs-push-2 { margin-left: 66.66666667%; } .fs-grid .fs-row .fs-xs-fifth { width: 17.91666667%; } .fs-grid .fs-row .fs-xs-fourth { width: 22.91666667%; } .fs-grid .fs-row .fs-xs-third { width: 31.25%; } .fs-grid .fs-row .fs-xs-half { width: 47.91666667%; } .fs-grid .fs-row .fs-xs-full { width: 97.91666667%; } .fs-grid .fs-row .fs-xs-push-fifth { margin-left: 21.04166667%; } .fs-grid .fs-row .fs-xs-push-fourth { margin-left: 26.04166667%; } .fs-grid .fs-row .fs-xs-push-third { margin-left: 34.375%; } .fs-grid .fs-row .fs-xs-push-half { margin-left: 51.04166667%; } .fs-grid .fs-row [class*="-contained"].fs-xs-fifth { width: 20%; } .fs-grid .fs-row [class*="-contained"].fs-xs-fourth { width: 25%; } .fs-grid .fs-row [class*="-contained"].fs-xs-third { width: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xs-half { width: 50%; } .fs-grid .fs-row [class*="-contained"].fs-xs-full { width: 100%; } .fs-grid .fs-row [class*="-contained"].fs-xs-push-fifth { margin-left: 20%; } .fs-grid .fs-row [class*="-contained"].fs-xs-push-fourth { margin-left: 25%; } .fs-grid .fs-row [class*="-contained"].fs-xs-push-third { margin-left: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xs-push-half { margin-left: 50%; } .fs-grid .fs-row .fs-xs-hide { display: none; } } @media screen and (min-width: 740px) and (max-width: 979px) { .fs-grid .fs-row .fs-md-1 { width: 14.58333333%; } .fs-grid .fs-row .fs-md-2 { width: 31.25%; } .fs-grid .fs-row .fs-md-3 { width: 47.91666667%; } .fs-grid .fs-row .fs-md-4 { width: 64.58333333%; } .fs-grid .fs-row .fs-md-5 { width: 81.25%; } .fs-grid .fs-row .fs-md-6 { width: 97.91666667%; } .fs-grid .fs-row .fs-md-push-1 { margin-left: 17.70833333%; } .fs-grid .fs-row .fs-md-push-2 { margin-left: 34.375%; } .fs-grid .fs-row .fs-md-push-3 { margin-left: 51.04166667%; } .fs-grid .fs-row .fs-md-push-4 { margin-left: 67.70833333%; } .fs-grid .fs-row .fs-md-push-5 { margin-left: 84.375%; } .fs-grid .fs-row [class*="-contained"].fs-md-1 { width: 16.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-md-2 { width: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-md-3 { width: 50%; } .fs-grid .fs-row [class*="-contained"].fs-md-4 { width: 66.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-md-5 { width: 83.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-md-6 { width: 100%; } .fs-grid .fs-row [class*="-contained"].fs-md-push-1 { margin-left: 16.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-md-push-2 { margin-left: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-md-push-3 { margin-left: 50%; } .fs-grid .fs-row [class*="-contained"].fs-md-push-4 { margin-left: 66.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-md-push-5 { margin-left: 83.33333333%; } .fs-grid .fs-row .fs-md-fifth { width: 17.91666667%; } .fs-grid .fs-row .fs-md-fourth { width: 22.91666667%; } .fs-grid .fs-row .fs-md-third { width: 31.25%; } .fs-grid .fs-row .fs-md-half { width: 47.91666667%; } .fs-grid .fs-row .fs-md-full { width: 97.91666667%; } .fs-grid .fs-row .fs-md-push-fifth { margin-left: 21.04166667%; } .fs-grid .fs-row .fs-md-push-fourth { margin-left: 26.04166667%; } .fs-grid .fs-row .fs-md-push-third { margin-left: 34.375%; } .fs-grid .fs-row .fs-md-push-half { margin-left: 51.04166667%; } .fs-grid .fs-row [class*="-contained"].fs-md-fifth { width: 20%; } .fs-grid .fs-row [class*="-contained"].fs-md-fourth { width: 25%; } .fs-grid .fs-row [class*="-contained"].fs-md-third { width: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-md-half { width: 50%; } .fs-grid .fs-row [class*="-contained"].fs-md-full { width: 100%; } .fs-grid .fs-row [class*="-contained"].fs-md-push-fifth { margin-left: 20%; } .fs-grid .fs-row [class*="-contained"].fs-md-push-fourth { margin-left: 25%; } .fs-grid .fs-row [class*="-contained"].fs-md-push-third { margin-left: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-md-push-half { margin-left: 50%; } .fs-grid .fs-row .fs-md-hide { display: none; } } @media screen and (min-width: 980px) { .fs-grid .fs-row .fs-lg-1 { width: 6.25%; } .fs-grid .fs-row .fs-lg-2 { width: 14.58333333%; } .fs-grid .fs-row .fs-lg-3 { width: 22.91666667%; } .fs-grid .fs-row .fs-lg-4 { width: 31.25%; } .fs-grid .fs-row .fs-lg-5 { width: 39.58333333%; } .fs-grid .fs-row .fs-lg-6 { width: 47.91666667%; } .fs-grid .fs-row .fs-lg-7 { width: 56.25%; } .fs-grid .fs-row .fs-lg-8 { width: 64.58333333%; } .fs-grid .fs-row .fs-lg-9 { width: 72.91666667%; } .fs-grid .fs-row .fs-lg-10 { width: 81.25%; } .fs-grid .fs-row .fs-lg-11 { width: 89.58333333%; } .fs-grid .fs-row .fs-lg-12 { width: 97.91666667%; } .fs-grid .fs-row .fs-lg-push-1 { margin-left: 9.375%; } .fs-grid .fs-row .fs-lg-push-2 { margin-left: 17.70833333%; } .fs-grid .fs-row .fs-lg-push-3 { margin-left: 26.04166667%; } .fs-grid .fs-row .fs-lg-push-4 { margin-left: 34.375%; } .fs-grid .fs-row .fs-lg-push-5 { margin-left: 42.70833333%; } .fs-grid .fs-row .fs-lg-push-6 { margin-left: 51.04166667%; } .fs-grid .fs-row .fs-lg-push-7 { margin-left: 59.375%; } .fs-grid .fs-row .fs-lg-push-8 { margin-left: 67.70833333%; } .fs-grid .fs-row .fs-lg-push-9 { margin-left: 76.04166667%; } .fs-grid .fs-row .fs-lg-push-10 { margin-left: 84.375%; } .fs-grid .fs-row .fs-lg-push-11 { margin-left: 92.70833333%; } .fs-grid .fs-row [class*="-contained"].fs-lg-1 { width: 8.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-lg-2 { width: 16.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-lg-3 { width: 25%; } .fs-grid .fs-row [class*="-contained"].fs-lg-4 { width: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-lg-5 { width: 41.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-lg-6 { width: 50%; } .fs-grid .fs-row [class*="-contained"].fs-lg-7 { width: 58.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-lg-8 { width: 66.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-lg-9 { width: 75%; } .fs-grid .fs-row [class*="-contained"].fs-lg-10 { width: 83.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-lg-11 { width: 91.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-lg-12 { width: 100%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-1 { margin-left: 8.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-2 { margin-left: 16.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-3 { margin-left: 25%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-4 { margin-left: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-5 { margin-left: 41.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-6 { margin-left: 50%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-7 { margin-left: 58.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-8 { margin-left: 66.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-9 { margin-left: 75%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-10 { margin-left: 83.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-11 { margin-left: 91.66666667%; } .fs-grid .fs-row .fs-lg-fifth { width: 17.91666667%; } .fs-grid .fs-row .fs-lg-fourth { width: 22.91666667%; } .fs-grid .fs-row .fs-lg-third { width: 31.25%; } .fs-grid .fs-row .fs-lg-half { width: 47.91666667%; } .fs-grid .fs-row .fs-lg-full { width: 97.91666667%; } .fs-grid .fs-row .fs-lg-push-fifth { margin-left: 21.04166667%; } .fs-grid .fs-row .fs-lg-push-fourth { margin-left: 26.04166667%; } .fs-grid .fs-row .fs-lg-push-third { margin-left: 34.375%; } .fs-grid .fs-row .fs-lg-push-half { margin-left: 51.04166667%; } .fs-grid .fs-row [class*="-contained"].fs-lg-fifth { width: 20%; } .fs-grid .fs-row [class*="-contained"].fs-lg-fourth { width: 25%; } .fs-grid .fs-row [class*="-contained"].fs-lg-third { width: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-lg-half { width: 50%; } .fs-grid .fs-row [class*="-contained"].fs-lg-full { width: 100%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-fifth { margin-left: 20%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-fourth { margin-left: 25%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-third { margin-left: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-lg-push-half { margin-left: 50%; } .fs-grid .fs-row .fs-lg-hide { display: none; } } @media screen and (min-width: 1220px) { .fs-grid .fs-row .fs-xl-1 { width: 6.25%; } .fs-grid .fs-row .fs-xl-2 { width: 14.58333333%; } .fs-grid .fs-row .fs-xl-3 { width: 22.91666667%; } .fs-grid .fs-row .fs-xl-4 { width: 31.25%; } .fs-grid .fs-row .fs-xl-5 { width: 39.58333333%; } .fs-grid .fs-row .fs-xl-6 { width: 47.91666667%; } .fs-grid .fs-row .fs-xl-7 { width: 56.25%; } .fs-grid .fs-row .fs-xl-8 { width: 64.58333333%; } .fs-grid .fs-row .fs-xl-9 { width: 72.91666667%; } .fs-grid .fs-row .fs-xl-10 { width: 81.25%; } .fs-grid .fs-row .fs-xl-11 { width: 89.58333333%; } .fs-grid .fs-row .fs-xl-12 { width: 97.91666667%; } .fs-grid .fs-row .fs-xl-push-1 { margin-left: 9.375%; } .fs-grid .fs-row .fs-xl-push-2 { margin-left: 17.70833333%; } .fs-grid .fs-row .fs-xl-push-3 { margin-left: 26.04166667%; } .fs-grid .fs-row .fs-xl-push-4 { margin-left: 34.375%; } .fs-grid .fs-row .fs-xl-push-5 { margin-left: 42.70833333%; } .fs-grid .fs-row .fs-xl-push-6 { margin-left: 51.04166667%; } .fs-grid .fs-row .fs-xl-push-7 { margin-left: 59.375%; } .fs-grid .fs-row .fs-xl-push-8 { margin-left: 67.70833333%; } .fs-grid .fs-row .fs-xl-push-9 { margin-left: 76.04166667%; } .fs-grid .fs-row .fs-xl-push-10 { margin-left: 84.375%; } .fs-grid .fs-row .fs-xl-push-11 { margin-left: 92.70833333%; } .fs-grid .fs-row [class*="-contained"].fs-xl-1 { width: 8.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xl-2 { width: 16.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-xl-3 { width: 25%; } .fs-grid .fs-row [class*="-contained"].fs-xl-4 { width: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xl-5 { width: 41.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-xl-6 { width: 50%; } .fs-grid .fs-row [class*="-contained"].fs-xl-7 { width: 58.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xl-8 { width: 66.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-xl-9 { width: 75%; } .fs-grid .fs-row [class*="-contained"].fs-xl-10 { width: 83.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xl-11 { width: 91.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-xl-12 { width: 100%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-1 { margin-left: 8.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-2 { margin-left: 16.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-3 { margin-left: 25%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-4 { margin-left: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-5 { margin-left: 41.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-6 { margin-left: 50%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-7 { margin-left: 58.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-8 { margin-left: 66.66666667%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-9 { margin-left: 75%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-10 { margin-left: 83.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-11 { margin-left: 91.66666667%; } .fs-grid .fs-row .fs-xl-fifth { width: 17.91666667%; } .fs-grid .fs-row .fs-xl-fourth { width: 22.91666667%; } .fs-grid .fs-row .fs-xl-third { width: 31.25%; } .fs-grid .fs-row .fs-xl-half { width: 47.91666667%; } .fs-grid .fs-row .fs-xl-full { width: 97.91666667%; } .fs-grid .fs-row .fs-xl-push-fifth { margin-left: 21.04166667%; } .fs-grid .fs-row .fs-xl-push-fourth { margin-left: 26.04166667%; } .fs-grid .fs-row .fs-xl-push-third { margin-left: 34.375%; } .fs-grid .fs-row .fs-xl-push-half { margin-left: 51.04166667%; } .fs-grid .fs-row [class*="-contained"].fs-xl-fifth { width: 20%; } .fs-grid .fs-row [class*="-contained"].fs-xl-fourth { width: 25%; } .fs-grid .fs-row [class*="-contained"].fs-xl-third { width: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xl-half { width: 50%; } .fs-grid .fs-row [class*="-contained"].fs-xl-full { width: 100%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-fifth { margin-left: 20%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-fourth { margin-left: 25%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-third { margin-left: 33.33333333%; } .fs-grid .fs-row [class*="-contained"].fs-xl-push-half { margin-left: 50%; } .fs-grid .fs-row .fs-xl-hide { display: none; } }
dhenson02/cdnjs
ajax/libs/formstone/0.5.11/css/grid.css
CSS
mit
20,370
/* * # Semantic UI - 1.6.1 * https://github.com/Semantic-Org/Semantic-UI * http://www.semantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ .ui.modal{display:none;position:fixed;z-index:1001;top:50%;left:50%;text-align:left;width:90%;margin-left:-45%;background:#fff;border:none;box-shadow:0 1px 4px 1px rgba(0,0,0,.3);border-radius:.2857rem;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;will-change:top,left,margin,transform,opacity}.ui.modal>.icon:first-child+*,.ui.modal>:first-child:not(.icon){border-top-left-radius:.2857rem;border-top-right-radius:.2857rem}.ui.modal>:last-child{border-bottom-left-radius:.2857rem;border-bottom-right-radius:.2857rem}.ui.modal>.close{cursor:pointer;position:absolute;top:-2.5rem;right:-2.5rem;z-index:1;opacity:.8;font-size:1.25em;color:#fff;width:2.25rem;height:2.25rem;padding:.625rem 0 0}.ui.modal>.close:hover{opacity:1}.ui.modal>.header{display:block;font-family:Lato,'Helvetica Neue',Arial,Helvetica,sans-serif;background:-webkit-linear-gradient(transparent,rgba(0,0,0,.05)) #fff;background:linear-gradient(transparent,rgba(0,0,0,.05)) #fff;margin:0;padding:1.2rem 2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05);font-size:1.6em;line-height:1.3em;font-weight:700;color:rgba(0,0,0,.85);border-bottom:1px solid rgba(39,41,43,.15)}.ui.modal>.content{display:table;table-layout:fixed;width:100%;font-size:1em;line-height:1.4;padding:2rem;background:#fff}.ui.modal>.content>.image{display:table-cell;width:'';vertical-align:top}.ui.modal>.content>.image[class*="top aligned"]{vertical-align:middle}.ui.modal>.content>.description{display:table-cell;vertical-align:top}.ui.modal>.content>.icon+.description,.ui.modal>.content>.image+.description{min-width:'';width:80%;padding-left:2em}.ui.modal>.content>.image>i.icon{font-size:8rem;margin:0;opacity:1;width:auto}.ui.modal .actions{background:#efefef;padding:1rem 2rem;border-top:1px solid rgba(39,41,43,.15);text-align:right}.ui.modal .actions>.button{margin-left:.75em}@media only screen and (max-width:767px){.ui.modal{width:95%;margin:0 0 0 -47.5%}}@media only screen and (min-width:768px){.ui.modal{width:88%;margin:0 0 0 -44%}}@media only screen and (min-width:992px){.ui.modal{width:74%;margin:0 0 0 -37%}}@media only screen and (min-width:1400px){.ui.modal{width:56%;margin:0 0 0 -28%}}@media only screen and (min-width:1920px){.ui.modal{width:42%;margin:0 0 0 -21%}}@media only screen and (max-width:992px){.ui.modal>.header{padding-right:2.25rem}.ui.modal>.close{top:.905rem;right:1rem;color:rgba(0,0,0,.8)}}@media only screen and (max-width:767px){.ui.modal>.header{padding:.75rem 2.25rem .75rem 1rem!important}.ui.modal>.content{display:block;padding:1rem!important}.ui.modal>.close{top:.5rem!important;right:.5rem!important}.ui.modal .content>.image{display:block;max-width:100%;margin:0 auto!important;text-align:center;padding:0 0 1rem!important}.ui.modal>.content>.image>i.icon{font-size:5rem;text-align:center}.ui.modal .content>.description{display:block;width:100%!important;margin:0!important;padding:1rem 0!important;box-shadow:none}.ui.modal>.actions{padding:1rem 1rem -1rem!important}.ui.modal .actions>.button,.ui.modal .actions>.buttons{margin-bottom:2rem}}.ui.basic.modal{background-color:transparent;border:none;box-shadow:0 0;color:#fff}.ui.basic.modal>.actions,.ui.basic.modal>.content,.ui.basic.modal>.header{background-color:transparent}.ui.basic.modal>.header{color:#fff}.ui.basic.modal>.close{top:1rem;right:1.5rem}@media only screen and (max-width:992px){.ui.basic.modal>.close{color:#fff}}.scrolling.dimmable.dimmed{overflow:hidden}.scrolling.dimmable.dimmed>.dimmer{overflow:auto;-webkit-overflow-scrolling:touch}.scrolling.dimmable>.dimmer{position:fixed}.ui.scrolling.modal{position:static;margin:3.5rem auto!important}@media only screen and (max-width:992px){.ui.scrolling.modal{margin-top:1rem;margin-bottom:1rem}}.ui.active.modal{display:block}.ui.fullscreen.modal{width:95%!important;left:2.5%!important;margin:1em auto}.ui.fullscreen.scrolling.modal{left:0!important}.ui.fullscreen.modal>.header{padding-right:2.25rem}.ui.fullscreen.modal>.close{top:.905rem;right:1rem;color:rgba(0,0,0,.8)}.ui.modal{font-size:1rem}.ui.small.modal>.header{font-size:1.3em}@media only screen and (max-width:767px){.ui.small.modal{width:95%;margin:0 0 0 -47.5%}}@media only screen and (min-width:768px){.ui.small.modal{width:52.8%;margin:0 0 0 -26.4%}}@media only screen and (min-width:992px){.ui.small.modal{width:44.4%;margin:0 0 0 -22.2%}}@media only screen and (min-width:1400px){.ui.small.modal{width:33.6%;margin:0 0 0 -16.8%}}@media only screen and (min-width:1920px){.ui.small.modal{width:25.2%;margin:0 0 0 -12.6%}}.ui.large.modal>.header{font-size:1.6em}@media only screen and (max-width:767px){.ui.large.modal{width:95%;margin:0 0 0 -47.5%}}@media only screen and (min-width:768px){.ui.large.modal{width:88%;margin:0 0 0 -44%}}@media only screen and (min-width:992px){.ui.large.modal{width:88.8%;margin:0 0 0 -44.4%}}@media only screen and (min-width:1400px){.ui.large.modal{width:67.2%;margin:0 0 0 -33.6%}}@media only screen and (min-width:1920px){.ui.large.modal{width:50.4%;margin:0 0 0 -25.2%}}
dryajov/cdnjs
ajax/libs/semantic-ui/1.6.1/components/modal.min.css
CSS
mit
5,239
/*! UIkit 2.16.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ !function(t,i){"use strict";i.component("buttonRadio",{defaults:{target:".@-button"},boot:function(){i.$html.on("click.buttonradio.uikit","[data-@-button-radio]",function(t){var n=i.$(this);if(!n.data("buttonRadio")){var o=i.buttonRadio(n,i.Utils.options(n.attr("data-@-button-radio"))),e=i.$(t.target);e.is(o.options.target)&&e.trigger("click")}})},init:function(){var t=this;this.on("click",this.options.target,function(n){var o=i.$(this);o.is('a[href="#"]')&&n.preventDefault(),t.find(t.options.target).not(o).removeClass(i.prefix("@-active")).blur(),t.trigger("change.uk.button",[o.addClass("@-active")])})},getSelected:function(){return this.find(".@-active")}}),i.component("buttonCheckbox",{defaults:{target:".@-button"},boot:function(){i.$html.on("click.buttoncheckbox.uikit","[data-@-button-checkbox]",function(t){var n=i.$(this);if(!n.data("buttonCheckbox")){var o=i.buttonCheckbox(n,i.Utils.options(n.attr("data-@-button-checkbox"))),e=i.$(t.target);e.is(o.options.target)&&n.trigger("change.uk.button",[e.toggleClass("@-active").blur()])}})},init:function(){var n=this;this.on("click",this.options.target,function(o){t(this).is('a[href="#"]')&&o.preventDefault(),n.trigger("change.uk.button",[i.$(this).toggleClass("@-active").blur()])})},getSelected:function(){return this.find(".@-active")}}),i.component("button",{defaults:{},boot:function(){i.$html.on("click.button.uikit","[data-@-button]",function(){var t=i.$(this);if(!t.data("button")){{i.button(t,i.Utils.options(t.attr("data-@-button")))}t.trigger("click")}})},init:function(){var t=this;this.on("click",function(i){t.element.is('a[href="#"]')&&i.preventDefault(),t.toggle(),t.trigger("change.uk.button",[t.element.blur().hasClass("@-active")])})},toggle:function(){this.element.toggleClass("@-active")}})}(jQuery,UIkit);
narikei/cdnjs
ajax/libs/uikit/2.16.0/js/core/button.min.js
JavaScript
mit
1,873
L.Icon.Text = L.Icon.extend({ initialize: function (text, options) { this._text = text; L.Icon.prototype.initialize.apply(this, [options]); }, createIcon: function() { var el = document.createElement('div'); el.appendChild(document.createTextNode(this._text)); this._setIconStyles(el, 'icon'); el.style.textShadow = '2px 2px 2px #fff'; return el; }, createShadow: function() { return null; } }); L.Marker.Text = L.Marker.extend({ initialize: function (latlng, text, options) { L.Marker.prototype.initialize.apply(this, [latlng, options]); this._fakeicon = new L.Icon.Text(text); }, _initIcon: function() { L.Marker.prototype._initIcon.apply(this); var i = this._icon, s = this._shadow, obj = this.options.icon; this._icon = this._shadow = null; this.options.icon = this._fakeicon; L.Marker.prototype._initIcon.apply(this); this.options.icon = obj; if (s) { s.parentNode.removeChild(s); this._icon.appendChild(s); } i.parentNode.removeChild(i); this._icon.appendChild(i); var w = this._icon.clientWidth, h = this._icon.clientHeight; this._icon.style.marginLeft = -w / 2 + 'px'; //this._icon.style.backgroundColor = "red"; var off = new L.Point(w/2, 0); if (L.Browser.webkit) off.y = -h; L.DomUtil.setPosition(i, off); if (s) L.DomUtil.setPosition(s, off); } });
cdnjs/cdnjs
ajax/libs/leaflet-plugins/1.3.4/layer/Marker.Text.js
JavaScript
mit
1,361
(function(f){var c="addImage_";var e=function(m){var l,h;if(!m.charCodeAt(0)===255||!m.charCodeAt(1)===216||!m.charCodeAt(2)===255||!m.charCodeAt(3)===224||!m.charCodeAt(6)==="J".charCodeAt(0)||!m.charCodeAt(7)==="F".charCodeAt(0)||!m.charCodeAt(8)==="I".charCodeAt(0)||!m.charCodeAt(9)==="F".charCodeAt(0)||!m.charCodeAt(10)===0){throw new Error("getJpegSize requires a binary jpeg file")}var j=m.charCodeAt(4)*256+m.charCodeAt(5);var k=4,g=m.length;while(k<g){k+=j;if(m.charCodeAt(k)!==255){throw new Error("getJpegSize could not find the size of the image")}if(m.charCodeAt(k+1)===192||m.charCodeAt(k+1)===193||m.charCodeAt(k+1)===194||m.charCodeAt(k+1)===195||m.charCodeAt(k+1)===196||m.charCodeAt(k+1)===197||m.charCodeAt(k+1)===198||m.charCodeAt(k+1)===199){h=m.charCodeAt(k+5)*256+m.charCodeAt(k+6);l=m.charCodeAt(k+7)*256+m.charCodeAt(k+8);return[l,h]}else{k+=2;j=m.charCodeAt(k)*256+m.charCodeAt(k+1)}}},b=function(g){var m=this.internal.newObject(),h=this.internal.write,l=this.internal.putStream;g.n=m;h("<</Type /XObject");h("/Subtype /Image");h("/Width "+g.w);h("/Height "+g.h);if(g.cs==="Indexed"){h("/ColorSpace [/Indexed /DeviceRGB "+(g.pal.length/3-1)+" "+(m+1)+" 0 R]")}else{h("/ColorSpace /"+g.cs);if(g.cs==="DeviceCMYK"){h("/Decode [1 0 1 0 1 0 1 0]")}}h("/BitsPerComponent "+g.bpc);if("f" in g){h("/Filter /"+g.f)}if("dp" in g){h("/DecodeParms <<"+g.dp+">>")}if("trns" in g&&g.trns.constructor==Array){var k="";for(var j=0;j<g.trns.length;j++){k+=(g[k][j]+" "+g.trns[j]+" ");h("/Mask ["+k+"]")}}if("smask" in g){h("/SMask "+(m+1)+" 0 R")}h("/Length "+g.data.length+">>");l(g.data);h("endobj")},d=function(){var g=this.internal.collections[c+"images"];for(var h in g){b.call(this,g[h])}},a=function(){var g=this.internal.collections[c+"images"],h=this.internal.write,k;for(var j in g){k=g[j];h("/I"+k.i,k.n,"0","R")}};f.addImage=function(g,s,q,p,t,l){if(typeof g==="object"&&g.nodeType===1){var j=document.createElement("canvas");j.width=g.clientWidth;j.height=g.clientHeight;var u=j.getContext("2d");if(!u){throw ("addImage requires canvas to be supported by browser.")}u.drawImage(g,0,0,j.width,j.height);g=j.toDataURL("image/jpeg");s="JPEG"}if(s.toUpperCase()!=="JPEG"){throw new Error("addImage currently only supports format 'JPEG', not '"+s+"'")}var i,n=this.internal.collections[c+"images"],m=this.internal.getCoordinateString,o=this.internal.getVerticalCoordinateString;if(g.substring(0,23)==="data:image/jpeg;base64,"){g=atob(g.replace("data:image/jpeg;base64,",""))}if(n){i=Object.keys?Object.keys(n).length:(function(w){var h=0;for(var v in w){if(w.hasOwnProperty(v)){h++}}return h})(n)}else{i=0;this.internal.collections[c+"images"]=n={};this.internal.events.subscribe("putResources",d);this.internal.events.subscribe("putXobjectDict",a)}var r=e(g);var k={w:r[0],h:r[1],cs:"DeviceRGB",bpc:8,f:"DCTDecode",i:i,data:g};n[i]=k;if(!t&&!l){t=-96;l=-96}if(t<0){t=(-1)*k.w*72/t/this.internal.scaleFactor}if(l<0){l=(-1)*k.h*72/l/this.internal.scaleFactor}if(t===0){t=l*k.w/k.h}if(l===0){l=t*k.h/k.w}this.internal.write("q",m(t),"0 0",m(l),m(q),o(p+l),"cm /I"+k.i,"Do Q");return this}})(jsPDF.API);
fastest963/cdnjs
ajax/libs/amcharts/3.10.0/exporting/jspdf.plugin.addimage.min.js
JavaScript
mit
3,121
/* * /MathJax/jax/output/SVG/fonts/TeX/Main/Bold/SpacingModLetters.js * * Copyright (c) 2012 Design Science, Inc. * * Part of the MathJax library. * See http://www.mathjax.org for details. * * Licensed under the Apache License, Version 2.0; * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 */ MathJax.Hub.Insert(MathJax.OutputJax.SVG.FONTDATA.FONTS["MathJax_Main-bold"],{710:[694,-520,575,126,449,"207 632L287 694Q289 693 368 632T448 570T431 545T413 520Q410 520 350 559L287 597L224 559Q164 520 161 520Q160 520 143 544T126 570T207 632"],711:[660,-515,575,130,443,"131 603Q130 604 136 618T150 646T158 659L223 635L287 611L351 635L416 659Q417 660 424 647T437 619T443 603Q440 601 364 558T287 515T210 558T131 603"],713:[607,-540,575,80,494,"80 540V607H494V540H80"],714:[706,-503,575,236,460,"391 706Q419 706 439 683T460 634Q460 608 441 593T366 550Q356 545 351 543L275 503L256 527Q236 552 237 553Q242 558 292 620Q299 629 309 641T324 659T336 673T346 685T354 693T363 699T371 703T380 705T391 706"],715:[706,-503,575,113,338,"114 634Q114 663 136 684T183 706Q191 706 196 705T208 700T219 693T232 681T245 666T262 645T282 620Q332 558 337 553Q338 552 318 527L299 503L223 543Q215 547 202 553T183 563T167 571T153 580T141 587T131 595T124 603T118 612T115 622T114 634"],728:[694,-500,575,102,472,"287 500Q208 500 155 558T102 689V694H153V685Q153 681 154 674T164 648T186 615T226 590T287 578Q347 578 382 611T421 685V694H472V689Q472 623 422 562T287 500"],729:[695,-525,575,202,372,"202 610Q202 647 227 671T283 695Q324 695 348 669T372 610T350 551T287 525Q248 525 225 551T202 610"],730:[702,-535,575,160,414,"160 618Q160 653 193 677T279 702H284Q381 702 407 647Q414 634 414 618Q414 607 410 596T395 570T355 546T287 536T220 545T181 568T165 594T160 618ZM352 618Q352 645 341 652T301 659H292Q286 659 278 659T268 660Q247 660 236 653T224 638T222 619Q222 591 234 585T287 578Q315 578 326 580T345 590T352 618"],732:[694,-552,575,96,478,"343 552Q320 552 278 575T215 599Q181 599 146 564L134 552L115 569Q111 572 106 576T98 584L96 586Q158 656 165 663Q199 694 230 694Q239 694 244 693Q262 689 300 668T359 647Q393 647 428 682L440 694L459 677Q463 674 468 670T476 662L478 660Q416 590 409 583Q375 552 343 552"]});MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/SpacingModLetters.js");
gereon/cdnjs
ajax/libs/mathjax/2.1/jax/output/SVG/fonts/TeX/Main/Bold/SpacingModLetters.js
JavaScript
mit
2,350
/* Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang("specialchar","it",{euro:"Simbolo Euro",lsquo:"Virgoletta singola sinistra",rsquo:"Virgoletta singola destra",ldquo:"Virgolette aperte",rdquo:"Virgolette chiuse",ndash:"Trattino",mdash:"Trattino lungo",iexcl:"Punto esclavamativo invertito",cent:"Simbolo Cent",pound:"Simbolo Sterlina",curren:"Simbolo Moneta",yen:"Simbolo Yen",brvbar:"Barra interrotta",sect:"Simbolo di sezione",uml:"Dieresi",copy:"Simbolo Copyright",ordf:"Indicatore ordinale femminile",laquo:"Virgolette basse aperte", not:"Nessun segno",reg:"Simbolo Registrato",macr:"Macron",deg:"Simbolo Grado",sup2:"Apice Due",sup3:"Apice Tre",acute:"Accento acuto",micro:"Simbolo Micro",para:"Simbolo Paragrafo",middot:"Punto centrale",cedil:"Cediglia",sup1:"Apice Uno",ordm:"Indicatore ordinale maschile",raquo:"Virgolette basse chiuse",frac14:"Frazione volgare un quarto",frac12:"Frazione volgare un mezzo",frac34:"Frazione volgare tre quarti",iquest:"Punto interrogativo invertito",Agrave:"Lettera maiuscola latina A con accento grave", Aacute:"Lettera maiuscola latina A con accento acuto",Acirc:"Lettera maiuscola latina A con accento circonflesso",Atilde:"Lettera maiuscola latina A con tilde",Auml:"Lettera maiuscola latina A con dieresi",Aring:"Lettera maiuscola latina A con anello sopra",AElig:"Lettera maiuscola latina AE",Ccedil:"Lettera maiuscola latina C con cediglia",Egrave:"Lettera maiuscola latina E con accento grave",Eacute:"Lettera maiuscola latina E con accento acuto",Ecirc:"Lettera maiuscola latina E con accento circonflesso", Euml:"Lettera maiuscola latina E con dieresi",Igrave:"Lettera maiuscola latina I con accento grave",Iacute:"Lettera maiuscola latina I con accento acuto",Icirc:"Lettera maiuscola latina I con accento circonflesso",Iuml:"Lettera maiuscola latina I con dieresi",ETH:"Lettera maiuscola latina Eth",Ntilde:"Lettera maiuscola latina N con tilde",Ograve:"Lettera maiuscola latina O con accento grave",Oacute:"Lettera maiuscola latina O con accento acuto",Ocirc:"Lettera maiuscola latina O con accento circonflesso", Otilde:"Lettera maiuscola latina O con tilde",Ouml:"Lettera maiuscola latina O con dieresi",times:"Simbolo di moltiplicazione",Oslash:"Lettera maiuscola latina O barrata",Ugrave:"Lettera maiuscola latina U con accento grave",Uacute:"Lettera maiuscola latina U con accento acuto",Ucirc:"Lettera maiuscola latina U con accento circonflesso",Uuml:"Lettera maiuscola latina U con accento circonflesso",Yacute:"Lettera maiuscola latina Y con accento acuto",THORN:"Lettera maiuscola latina Thorn",szlig:"Lettera latina minuscola doppia S", agrave:"Lettera minuscola latina a con accento grave",aacute:"Lettera minuscola latina a con accento acuto",acirc:"Lettera minuscola latina a con accento circonflesso",atilde:"Lettera minuscola latina a con tilde",auml:"Lettera minuscola latina a con dieresi",aring:"Lettera minuscola latina a con anello superiore",aelig:"Lettera minuscola latina ae",ccedil:"Lettera minuscola latina c con cediglia",egrave:"Lettera minuscola latina e con accento grave",eacute:"Lettera minuscola latina e con accento acuto", ecirc:"Lettera minuscola latina e con accento circonflesso",euml:"Lettera minuscola latina e con dieresi",igrave:"Lettera minuscola latina i con accento grave",iacute:"Lettera minuscola latina i con accento acuto",icirc:"Lettera minuscola latina i con accento circonflesso",iuml:"Lettera minuscola latina i con dieresi",eth:"Lettera minuscola latina eth",ntilde:"Lettera minuscola latina n con tilde",ograve:"Lettera minuscola latina o con accento grave",oacute:"Lettera minuscola latina o con accento acuto", ocirc:"Lettera minuscola latina o con accento circonflesso",otilde:"Lettera minuscola latina o con tilde",ouml:"Lettera minuscola latina o con dieresi",divide:"Simbolo di divisione",oslash:"Lettera minuscola latina o barrata",ugrave:"Lettera minuscola latina u con accento grave",uacute:"Lettera minuscola latina u con accento acuto",ucirc:"Lettera minuscola latina u con accento circonflesso",uuml:"Lettera minuscola latina u con dieresi",yacute:"Lettera minuscola latina y con accento acuto",thorn:"Lettera minuscola latina thorn", yuml:"Lettera minuscola latina y con dieresi",OElig:"Legatura maiuscola latina OE",oelig:"Legatura minuscola latina oe",372:"Lettera maiuscola latina W con accento circonflesso",374:"Lettera maiuscola latina Y con accento circonflesso",373:"Lettera minuscola latina w con accento circonflesso",375:"Lettera minuscola latina y con accento circonflesso",sbquo:"Singola virgoletta bassa low-9",8219:"Singola virgoletta bassa low-9 inversa",bdquo:"Doppia virgoletta bassa low-9",hellip:"Ellissi orizzontale", trade:"Simbolo TM",9658:"Puntatore nero rivolto verso destra",bull:"Punto",rarr:"Freccia verso destra",rArr:"Doppia freccia verso destra",hArr:"Doppia freccia sinistra destra",diams:"Simbolo nero diamante",asymp:"Quasi uguale a"});
seogi1004/cdnjs
ajax/libs/ckeditor/4.5.4/plugins/specialchar/dialogs/lang/it.js
JavaScript
mit
5,016
<?php /** * CodeIgniter * * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * * Copyright (c) 2014 - 2017, 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 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); /** * CodeIgniter Smiley Helpers * * @package CodeIgniter * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team * @link https://codeigniter.com/user_guide/helpers/smiley_helper.html * @deprecated 3.0.0 This helper is too specific for CI. */ // ------------------------------------------------------------------------ if ( ! function_exists('smiley_js')) { /** * Smiley Javascript * * Returns the javascript required for the smiley insertion. Optionally takes * an array of aliases to loosely couple the smiley array to the view. * * @param mixed alias name or array of alias->field_id pairs * @param string field_id if alias name was passed in * @param bool * @return array */ function smiley_js($alias = '', $field_id = '', $inline = TRUE) { static $do_setup = TRUE; $r = ''; if ($alias !== '' && ! is_array($alias)) { $alias = array($alias => $field_id); } if ($do_setup === TRUE) { $do_setup = FALSE; $m = array(); if (is_array($alias)) { foreach ($alias as $name => $id) { $m[] = '"'.$name.'" : "'.$id.'"'; } } $m = '{'.implode(',', $m).'}'; $r .= <<<EOF var smiley_map = {$m}; function insert_smiley(smiley, field_id) { var el = document.getElementById(field_id), newStart; if ( ! el && smiley_map[field_id]) { el = document.getElementById(smiley_map[field_id]); if ( ! el) return false; } el.focus(); smiley = " " + smiley; if ('selectionStart' in el) { newStart = el.selectionStart + smiley.length; el.value = el.value.substr(0, el.selectionStart) + smiley + el.value.substr(el.selectionEnd, el.value.length); el.setSelectionRange(newStart, newStart); } else if (document.selection) { document.selection.createRange().text = smiley; } } EOF; } elseif (is_array($alias)) { foreach ($alias as $name => $id) { $r .= 'smiley_map["'.$name.'"] = "'.$id."\";\n"; } } return ($inline) ? '<script type="text/javascript" charset="utf-8">/*<![CDATA[ */'.$r.'// ]]></script>' : $r; } } // ------------------------------------------------------------------------ if ( ! function_exists('get_clickable_smileys')) { /** * Get Clickable Smileys * * Returns an array of image tag links that can be clicked to be inserted * into a form field. * * @param string the URL to the folder containing the smiley images * @param array * @return array */ function get_clickable_smileys($image_url, $alias = '') { // For backward compatibility with js_insert_smiley if (is_array($alias)) { $smileys = $alias; } elseif (FALSE === ($smileys = _get_smiley_array())) { return FALSE; } // Add a trailing slash to the file path if needed $image_url = rtrim($image_url, '/').'/'; $used = array(); foreach ($smileys as $key => $val) { // Keep duplicates from being used, which can happen if the // mapping array contains multiple identical replacements. For example: // :-) and :) might be replaced with the same image so both smileys // will be in the array. if (isset($used[$smileys[$key][0]])) { continue; } $link[] = '<a href="javascript:void(0);" onclick="insert_smiley(\''.$key.'\', \''.$alias.'\')"><img src="'.$image_url.$smileys[$key][0].'" alt="'.$smileys[$key][3].'" style="width: '.$smileys[$key][1].'; height: '.$smileys[$key][2].'; border: 0;" /></a>'; $used[$smileys[$key][0]] = TRUE; } return $link; } } // ------------------------------------------------------------------------ if ( ! function_exists('parse_smileys')) { /** * Parse Smileys * * Takes a string as input and swaps any contained smileys for the actual image * * @param string the text to be parsed * @param string the URL to the folder containing the smiley images * @param array * @return string */ function parse_smileys($str = '', $image_url = '', $smileys = NULL) { if ($image_url === '' OR ( ! is_array($smileys) && FALSE === ($smileys = _get_smiley_array()))) { return $str; } // Add a trailing slash to the file path if needed $image_url = rtrim($image_url, '/').'/'; foreach ($smileys as $key => $val) { $str = str_replace($key, '<img src="'.$image_url.$smileys[$key][0].'" alt="'.$smileys[$key][3].'" style="width: '.$smileys[$key][1].'; height: '.$smileys[$key][2].'; border: 0;" />', $str); } return $str; } } // ------------------------------------------------------------------------ if ( ! function_exists('_get_smiley_array')) { /** * Get Smiley Array * * Fetches the config/smiley.php file * * @return mixed */ function _get_smiley_array() { static $_smileys; if ( ! is_array($_smileys)) { if (file_exists(APPPATH.'config/smileys.php')) { include(APPPATH.'config/smileys.php'); } if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); } if (empty($smileys) OR ! is_array($smileys)) { $_smileys = array(); return FALSE; } $_smileys = $smileys; } return $_smileys; } }
lab3-team/lab3-starter-gallery
system/helpers/smiley_helper.php
PHP
mit
6,906
/** * Select2 Lithuanian translation. * * @author CRONUS Karmalakas <cronus dot karmalakas at gmail dot com> * @author Uriy Efremochkin <efremochkin@uriy.me> */ (function ($) { "use strict"; $.fn.select2.locales['lt'] = { formatNoMatches: function () { return "Atitikmenų nerasta"; }, formatInputTooShort: function (input, min) { return "Įrašykite dar" + character(min - input.length); }, formatInputTooLong: function (input, max) { return "Pašalinkite" + character(input.length - max); }, formatSelectionTooBig: function (limit) { return "Jūs galite pasirinkti tik " + limit + " element" + ((limit%100 > 9 && limit%100 < 21) || limit%10 == 0 ? "ų" : limit%10 > 1 ? "us" : "ą"); }, formatLoadMore: function (pageNumber) { return "Kraunama daugiau rezultatų…"; }, formatSearching: function () { return "Ieškoma…"; } }; $.extend($.fn.select2.defaults, $.fn.select2.locales['lt']); function character (n) { return " " + n + " simbol" + ((n%100 > 9 && n%100 < 21) || n%10 == 0 ? "ių" : n%10 > 1 ? "ius" : "į"); } })(jQuery);
leschenko/ab_admin
vendor/assets/javascripts/select2_3_5_2/select2_locale_lt.js
JavaScript
mit
1,144
/* Flot plugin for thresholding data. Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. The plugin supports these options: series: { threshold: { below: number color: colorspec } } It can also be applied to a single series, like this: $.plot( $("#placeholder"), [{ data: [ ... ], threshold: { ... } }]) An array can be passed for multiple thresholding, like this: threshold: [{ below: number1 color: color1 },{ below: number2 color: color2 }] These multiple threshold objects can be passed in any order since they are sorted by the processing function. The data points below "below" are drawn with the specified color. This makes it easy to mark points below 0, e.g. for budget data. Internally, the plugin works by splitting the data into two series, above and below the threshold. The extra series below the threshold will have its label cleared and the special "originSeries" attribute set to the original series. You may need to check for this in hover events. */ (function ($) { var options = { series: { threshold: null } // or { below: number, color: color spec} }; function init(plot) { function thresholdData(plot, s, datapoints, below, color) { var ps = datapoints.pointsize, i, x, y, p, prevp, thresholded = $.extend({}, s); // note: shallow copy thresholded.datapoints = { points: [], pointsize: ps, format: datapoints.format }; thresholded.label = null; thresholded.color = color; thresholded.threshold = null; thresholded.originSeries = s; thresholded.data = []; var origpoints = datapoints.points, addCrossingPoints = s.lines.show; var threspoints = []; var newpoints = []; var m; for (i = 0; i < origpoints.length; i += ps) { x = origpoints[i]; y = origpoints[i + 1]; prevp = p; if (y < below) p = threspoints; else p = newpoints; if (addCrossingPoints && prevp != p && x != null && i > 0 && origpoints[i - ps] != null) { var interx = x + (below - y) * (x - origpoints[i - ps]) / (y - origpoints[i - ps + 1]); prevp.push(interx); prevp.push(below); for (m = 2; m < ps; ++m) prevp.push(origpoints[i + m]); p.push(null); // start new segment p.push(null); for (m = 2; m < ps; ++m) p.push(origpoints[i + m]); p.push(interx); p.push(below); for (m = 2; m < ps; ++m) p.push(origpoints[i + m]); } p.push(x); p.push(y); for (m = 2; m < ps; ++m) p.push(origpoints[i + m]); } datapoints.points = newpoints; thresholded.datapoints.points = threspoints; if (thresholded.datapoints.points.length > 0) { var origIndex = $.inArray(s, plot.getData()); // Insert newly-generated series right after original one (to prevent it from becoming top-most) plot.getData().splice(origIndex + 1, 0, thresholded); } // FIXME: there are probably some edge cases left in bars } function processThresholds(plot, s, datapoints) { if (!s.threshold) return; if (s.threshold instanceof Array) { s.threshold.sort(function(a, b) { return a.below - b.below; }); $(s.threshold).each(function(i, th) { thresholdData(plot, s, datapoints, th.below, th.color); }); } else { thresholdData(plot, s, datapoints, s.threshold.below, s.threshold.color); } } plot.hooks.processDatapoints.push(processThresholds); } $.plot.plugins.push({ init: init, options: options, name: 'threshold', version: '1.2' }); })(jQuery);
patyalves17/blueMoney
vendors/Flot/jquery.flot.threshold.js
JavaScript
mit
4,480
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """The debug module contains utilities and functions for better debugging Gunicorn.""" import sys import linecache import re import inspect __all__ = ['spew', 'unspew'] _token_spliter = re.compile('\W+') class Spew(object): """ """ def __init__(self, trace_names=None, show_values=True): self.trace_names = trace_names self.show_values = show_values def __call__(self, frame, event, arg): if event == 'line': lineno = frame.f_lineno if '__file__' in frame.f_globals: filename = frame.f_globals['__file__'] if (filename.endswith('.pyc') or filename.endswith('.pyo')): filename = filename[:-1] name = frame.f_globals['__name__'] line = linecache.getline(filename, lineno) else: name = '[unknown]' try: src = inspect.getsourcelines(frame) line = src[lineno] except IOError: line = 'Unknown code named [%s]. VM instruction #%d' % ( frame.f_code.co_name, frame.f_lasti) if self.trace_names is None or name in self.trace_names: print('%s:%s: %s' % (name, lineno, line.rstrip())) if not self.show_values: return self details = [] tokens = _token_spliter.split(line) for tok in tokens: if tok in frame.f_globals: details.append('%s=%r' % (tok, frame.f_globals[tok])) if tok in frame.f_locals: details.append('%s=%r' % (tok, frame.f_locals[tok])) if details: print("\t%s" % ' '.join(details)) return self def spew(trace_names=None, show_values=False): """Install a trace hook which writes incredibly detailed logs about what code is being executed to stdout. """ sys.settrace(Spew(trace_names, show_values)) def unspew(): """Remove the trace hook installed by spew. """ sys.settrace(None)
sfrenza/test-for-bot
venv/Lib/site-packages/gunicorn/debug.py
Python
mit
2,303
/** * selectize.css (v0.8.2) * Copyright (c) 2013 Brian Reavis & contributors * * 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. * * @author Brian Reavis <brian@thirdroute.com> */ .selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder { background: #f2f2f2 !important; background: rgba(0, 0, 0, 0.06) !important; border: 0 none !important; visibility: visible !important; -webkit-box-shadow: inset 0 0 12px 4px #ffffff; box-shadow: inset 0 0 12px 4px #ffffff; } .selectize-control.plugin-drag_drop .ui-sortable-placeholder::after { content: '!'; visibility: hidden; } .selectize-control.plugin-drag_drop .ui-sortable-helper { -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); } .selectize-dropdown-header { position: relative; padding: 5px 8px; background: #f8f8f8; border-bottom: 1px solid #d0d0d0; -webkit-border-radius: 3px 3px 0 0; -moz-border-radius: 3px 3px 0 0; border-radius: 3px 3px 0 0; } .selectize-dropdown-header-close { position: absolute; top: 50%; right: 8px; margin-top: -12px; font-size: 20px !important; line-height: 20px; color: #303030; opacity: 0.4; } .selectize-dropdown-header-close:hover { color: #000000; } .selectize-dropdown.plugin-optgroup_columns .optgroup { float: left; border-top: 0 none; border-right: 1px solid #f2f2f2; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .selectize-dropdown.plugin-optgroup_columns .optgroup:last-child { border-right: 0 none; } .selectize-dropdown.plugin-optgroup_columns .optgroup:before { display: none; } .selectize-dropdown.plugin-optgroup_columns .optgroup-header { border-top: 0 none; } .selectize-control.plugin-remove_button [data-value] { position: relative; padding-right: 24px !important; } .selectize-control.plugin-remove_button [data-value] .remove { position: absolute; top: 0; right: 0; bottom: 0; display: inline-block; width: 17px; padding: 2px 0 0 0; font-size: 12px; font-weight: bold; color: inherit; text-align: center; text-decoration: none; vertical-align: middle; border-left: 1px solid #d0d0d0; -webkit-border-radius: 0 2px 2px 0; -moz-border-radius: 0 2px 2px 0; border-radius: 0 2px 2px 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .selectize-control.plugin-remove_button [data-value] .remove:hover { background: rgba(0, 0, 0, 0.05); } .selectize-control.plugin-remove_button [data-value].active .remove { border-left-color: #cacaca; } .selectize-control.plugin-remove_button .disabled [data-value] .remove:hover { background: none; } .selectize-control.plugin-remove_button .disabled [data-value] .remove { border-left-color: #ffffff; } .selectize-control { position: relative; } .selectize-dropdown, .selectize-input, .selectize-input input { font-family: inherit; font-size: 13px; -webkit-font-smoothing: inherit; line-height: 18px; color: #303030; } .selectize-input, .selectize-control.single .selectize-input.input-active { display: inline-block; cursor: text; background: #ffffff; } .selectize-input { position: relative; z-index: 1; display: inline-block; width: 100%; padding: 8px 8px; overflow: hidden; border: 1px solid #d0d0d0; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .selectize-control.multi .selectize-input.has-items { padding: 6px 8px 3px; } .selectize-input.full { background-color: #ffffff; } .selectize-input.disabled, .selectize-input.disabled * { cursor: default !important; } .selectize-input.focus { -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); } .selectize-input.dropdown-active { -webkit-border-radius: 3px 3px 0 0; -moz-border-radius: 3px 3px 0 0; border-radius: 3px 3px 0 0; } .selectize-input > * { display: -moz-inline-stack; display: inline-block; *display: inline; vertical-align: baseline; zoom: 1; } .selectize-control.multi .selectize-input > div { padding: 2px 6px; margin: 0 3px 3px 0; color: #303030; cursor: pointer; background: #f2f2f2; border: 0 solid #d0d0d0; } .selectize-control.multi .selectize-input > div.active { color: #303030; background: #e8e8e8; border: 0 solid #cacaca; } .selectize-control.multi .selectize-input.disabled > div, .selectize-control.multi .selectize-input.disabled > div.active { color: #7d7d7d; background: #ffffff; border: 0 solid #ffffff; } .selectize-input > input { max-width: 100% !important; max-height: none !important; min-height: 0 !important; padding: 0 !important; margin: 0 2px 0 0 !important; line-height: inherit !important; text-indent: 0 !important; background: none !important; border: 0 none !important; -webkit-box-shadow: none !important; box-shadow: none !important; -webkit-user-select: auto !important; } .selectize-input > input:focus { outline: none !important; } .selectize-input::after { display: block; clear: left; content: ' '; } .selectize-input.dropdown-active::before { position: absolute; right: 0; bottom: 0; left: 0; display: block; height: 1px; background: #f0f0f0; content: ' '; } .selectize-dropdown { position: absolute; z-index: 10; margin: -1px 0 0 0; background: #ffffff; border: 1px solid #d0d0d0; border-top: 0 none; -webkit-border-radius: 0 0 3px 3px; -moz-border-radius: 0 0 3px 3px; border-radius: 0 0 3px 3px; -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .selectize-dropdown [data-selectable] { overflow: hidden; cursor: pointer; } .selectize-dropdown [data-selectable] .highlight { background: rgba(125, 168, 208, 0.2); -webkit-border-radius: 1px; -moz-border-radius: 1px; border-radius: 1px; } .selectize-dropdown [data-selectable], .selectize-dropdown .optgroup-header { padding: 5px 8px; } .selectize-dropdown .optgroup:first-child .optgroup-header { border-top: 0 none; } .selectize-dropdown .optgroup-header { color: #303030; cursor: default; background: #ffffff; } .selectize-dropdown .active { color: #495c68; background-color: #f5fafd; } .selectize-dropdown .active.create { color: #495c68; } .selectize-dropdown .create { color: rgba(48, 48, 48, 0.5); } .selectize-dropdown-content { max-height: 200px; overflow-x: hidden; overflow-y: auto; } .selectize-control.single .selectize-input, .selectize-control.single .selectize-input input { cursor: pointer; } .selectize-control.single .selectize-input.input-active, .selectize-control.single .selectize-input.input-active input { cursor: text; } .selectize-control.single .selectize-input:after { position: absolute; top: 50%; right: 15px; display: block; width: 0; height: 0; margin-top: -3px; border-color: #808080 transparent transparent transparent; border-style: solid; border-width: 5px 5px 0 5px; content: ' '; } .selectize-control.single .selectize-input.dropdown-active:after { margin-top: -4px; border-color: transparent transparent #808080 transparent; border-width: 0 5px 5px 5px; } .selectize-control.rtl.single .selectize-input:after { right: auto; left: 15px; } .selectize-control.rtl .selectize-input > input { margin: 0 4px 0 -2px !important; } .selectize-control .selectize-input.disabled { background-color: #fafafa; opacity: 0.5; }
ErikSchierboom/cdnjs
ajax/libs/selectize.js/0.8.2/css/selectize.css
CSS
mit
8,484
/*-- Chart --*/ .c3 svg { font: 10px sans-serif; } .c3 path, .c3 line { fill: none; stroke: #000; stroke-width: 1px; } .c3 text { -webkit-user-select: none; -moz-user-select: none; user-select: none; } .c3-chart-arc path { stroke: #fff; } .c3-chart-arc text { fill: #fff; font-size: 13px; } /*-- Grid --*/ .c3-grid line { stroke: #aaa; } .c3-grid text { fill: #aaa; } .c3-xgrid, .c3-ygrid { stroke-dasharray: 3 3; } .c3-xgrid-focus { } /*-- Text on Chart --*/ .c3-text { } /*-- Line --*/ .c3-line { stroke-width: 1px; } /*-- Point --*/ .c3-circle._expanded_ { stroke-width: 1px; stroke: white; } .c3-selected-circle { fill: white; stroke-width: 2px; } /*-- Bar --*/ .c3-bar._expanded_ { fill-opacity: 0.75; } /*-- Arc --*/ .c3-chart-arcs-title { font-size: 1.3em; } /*-- Focus --*/ .c3-target.c3-focused path.c3-line { stroke-width: 2px; } /*-- Region --*/ .c3-region { fill: steelblue; fill-opacity: .1; } /*-- Brush --*/ .c3-brush .extent { fill-opacity: .1; } /*-- Select - Drag --*/ .c3-dragarea { } /*-- Legend --*/ .c3-legend-item { font-size: 12px; } /*-- Tooltip --*/ .c3-tooltip { border-collapse:collapse; border-spacing:0; background-color:#fff; empty-cells:show; -webkit-box-shadow: 7px 7px 12px -9px rgb(119,119,119); -moz-box-shadow: 7px 7px 12px -9px rgb(119,119,119); box-shadow: 7px 7px 12px -9px rgb(119,119,119); opacity: 0.9; } .c3-tooltip tr { border:1px solid #CCC; } .c3-tooltip th { background-color: #aaa; font-size:14px; padding:2px 5px; text-align:left; color:#FFF; } .c3-tooltip td { font-size:13px; padding: 3px 6px; background-color:#fff; border-left:1px dotted #999; } .c3-tooltip td > span { display: inline-block; width: 10px; height: 10px; margin-right: 6px; } .c3-tooltip td.value{ text-align: right; } .c3-area { stroke-width: 0; opacity: 0.2; }
billybonz1/cdnjs
ajax/libs/c3/0.1.24/c3.css
CSS
mit
1,931
/* * # Semantic UI - 1.6.2 * https://github.com/Semantic-Org/Semantic-UI * http://www.semantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ .ui.modal{display:none;position:fixed;z-index:1001;top:50%;left:50%;text-align:left;width:90%;margin-left:-45%;background:#fff;border:none;box-shadow:0 1px 4px 1px rgba(0,0,0,.3);border-radius:.2857rem;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;will-change:top,left,margin,transform,opacity}.ui.modal>.icon:first-child+*,.ui.modal>:first-child:not(.icon){border-top-left-radius:.2857rem;border-top-right-radius:.2857rem}.ui.modal>:last-child{border-bottom-left-radius:.2857rem;border-bottom-right-radius:.2857rem}.ui.modal>.close{cursor:pointer;position:absolute;top:-2.5rem;right:-2.5rem;z-index:1;opacity:.8;font-size:1.25em;color:#fff;width:2.25rem;height:2.25rem;padding:.625rem 0 0}.ui.modal>.close:hover{opacity:1}.ui.modal>.header{display:block;font-family:Lato,'Helvetica Neue',Arial,Helvetica,sans-serif;background:-webkit-linear-gradient(transparent,rgba(0,0,0,.05)) #fff;background:linear-gradient(transparent,rgba(0,0,0,.05)) #fff;margin:0;padding:1.2rem 2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05);font-size:1.6em;line-height:1.3em;font-weight:700;color:rgba(0,0,0,.85);border-bottom:1px solid rgba(39,41,43,.15)}.ui.modal>.content{display:table;table-layout:fixed;width:100%;font-size:1em;line-height:1.4;padding:2rem;background:#fff}.ui.modal>.content>.image{display:table-cell;width:'';vertical-align:top}.ui.modal>.content>.image[class*="top aligned"]{vertical-align:middle}.ui.modal>.content>.description{display:table-cell;vertical-align:top}.ui.modal>.content>.icon+.description,.ui.modal>.content>.image+.description{min-width:'';width:80%;padding-left:2em}.ui.modal>.content>.image>i.icon{font-size:8rem;margin:0;opacity:1;width:auto}.ui.modal .actions{background:#efefef;padding:1rem 2rem;border-top:1px solid rgba(39,41,43,.15);text-align:right}.ui.modal .actions>.button{margin-left:.75em}@media only screen and (max-width:767px){.ui.modal{width:95%;margin:0 0 0 -47.5%}}@media only screen and (min-width:768px){.ui.modal{width:88%;margin:0 0 0 -44%}}@media only screen and (min-width:992px){.ui.modal{width:74%;margin:0 0 0 -37%}}@media only screen and (min-width:1400px){.ui.modal{width:56%;margin:0 0 0 -28%}}@media only screen and (min-width:1920px){.ui.modal{width:42%;margin:0 0 0 -21%}}@media only screen and (max-width:992px){.ui.modal>.header{padding-right:2.25rem}.ui.modal>.close{top:.905rem;right:1rem;color:rgba(0,0,0,.8)}}@media only screen and (max-width:767px){.ui.modal>.header{padding:.75rem 2.25rem .75rem 1rem!important}.ui.modal>.content{display:block;padding:1rem!important}.ui.modal>.close{top:.5rem!important;right:.5rem!important}.ui.modal .content>.image{display:block;max-width:100%;margin:0 auto!important;text-align:center;padding:0 0 1rem!important}.ui.modal>.content>.image>i.icon{font-size:5rem;text-align:center}.ui.modal .content>.description{display:block;width:100%!important;margin:0!important;padding:1rem 0!important;box-shadow:none}.ui.modal>.actions{padding:1rem 1rem -1rem!important}.ui.modal .actions>.button,.ui.modal .actions>.buttons{margin-bottom:2rem}}.ui.basic.modal{background-color:transparent;border:none;box-shadow:0 0;color:#fff}.ui.basic.modal>.actions,.ui.basic.modal>.content,.ui.basic.modal>.header{background-color:transparent}.ui.basic.modal>.header{color:#fff}.ui.basic.modal>.close{top:1rem;right:1.5rem}@media only screen and (max-width:992px){.ui.basic.modal>.close{color:#fff}}.scrolling.dimmable.dimmed{overflow:hidden}.scrolling.dimmable.dimmed>.dimmer{overflow:auto;-webkit-overflow-scrolling:touch}.scrolling.dimmable>.dimmer{position:fixed}.ui.scrolling.modal{position:static;margin:3.5rem auto!important}@media only screen and (max-width:992px){.ui.scrolling.modal{margin-top:1rem;margin-bottom:1rem}}.ui.active.modal{display:block}.ui.fullscreen.modal{width:95%!important;left:2.5%!important;margin:1em auto}.ui.fullscreen.scrolling.modal{left:0!important}.ui.fullscreen.modal>.header{padding-right:2.25rem}.ui.fullscreen.modal>.close{top:.905rem;right:1rem;color:rgba(0,0,0,.8)}.ui.modal{font-size:1rem}.ui.small.modal>.header{font-size:1.3em}@media only screen and (max-width:767px){.ui.small.modal{width:95%;margin:0 0 0 -47.5%}}@media only screen and (min-width:768px){.ui.small.modal{width:52.8%;margin:0 0 0 -26.4%}}@media only screen and (min-width:992px){.ui.small.modal{width:44.4%;margin:0 0 0 -22.2%}}@media only screen and (min-width:1400px){.ui.small.modal{width:33.6%;margin:0 0 0 -16.8%}}@media only screen and (min-width:1920px){.ui.small.modal{width:25.2%;margin:0 0 0 -12.6%}}.ui.large.modal>.header{font-size:1.6em}@media only screen and (max-width:767px){.ui.large.modal{width:95%;margin:0 0 0 -47.5%}}@media only screen and (min-width:768px){.ui.large.modal{width:88%;margin:0 0 0 -44%}}@media only screen and (min-width:992px){.ui.large.modal{width:88.8%;margin:0 0 0 -44.4%}}@media only screen and (min-width:1400px){.ui.large.modal{width:67.2%;margin:0 0 0 -33.6%}}@media only screen and (min-width:1920px){.ui.large.modal{width:50.4%;margin:0 0 0 -25.2%}}
Piicksarn/cdnjs
ajax/libs/semantic-ui/1.6.2/components/modal.min.css
CSS
mit
5,239
/* rome@v1.1.3, MIT licensed. https://github.com/bevacqua/rome */ .rd-container{display:inline-block;border:1px solid #333;background-color:#fff;padding:10px;text-align:center}.rd-container-attachment{position:absolute}.rd-month{display:inline-block;margin-right:25px}.rd-month:last-child{margin-right:0}.rd-back,.rd-next{cursor:pointer;border:none;outline:0;background:0 0;padding:0;margin:0}.rd-back[disabled],.rd-next[disabled]{cursor:default}.rd-back{float:left}.rd-next{float:right}.rd-back:before{display:block;content:'\2190'}.rd-next:before{display:block;content:'\2192'}.rd-day-body{cursor:pointer;text-align:center}.rd-day-selected,.rd-time-option:hover,.rd-time-selected{cursor:pointer;background-color:#333;color:#fff}.rd-day-next-month,.rd-day-prev-month{color:#999}.rd-day-disabled{cursor:default;color:#fcc}.rd-time{position:relative;display:inline-block;margin-top:5px;min-width:80px}.rd-time-list{display:none;position:absolute;overflow-y:scroll;max-height:160px;left:0;right:0;background-color:#fff;color:#333}.rd-time-option,.rd-time-selected{padding:5px}.rd-day-concealed{visibility:hidden}
dhenson02/cdnjs
ajax/libs/rome/1.1.3/rome.min.css
CSS
mit
1,110
<!doctype html> <title>CodeMirror: Sieve (RFC5228) mode</title> <meta charset="utf-8"/> <link rel=stylesheet href="../../doc/docs.css"> <link rel="stylesheet" href="../../lib/codemirror.css"> <script src="../../lib/codemirror.js"></script> <script src="sieve.js"></script> <style>.CodeMirror {background: #f8f8f8;}</style> <div id=nav> <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a> <ul> <li><a href="../../index.html">Home</a> <li><a href="../../doc/manual.html">Manual</a> <li><a href="https://github.com/marijnh/codemirror">Code</a> </ul> <ul> <li><a href="../index.html">Language modes</a> <li><a class=active href="#">Sieve (RFC5228)</a> </ul> </div> <article> <h2>Sieve (RFC5228) mode</h2> <form><textarea id="code" name="code"> # # Example Sieve Filter # Declare any optional features or extension used by the script # require ["fileinto", "reject"]; # # Reject any large messages (note that the four leading dots get # "stuffed" to three) # if size :over 1M { reject text: Please do not send me large attachments. Put your file on a server and send me the URL. Thank you. .... Fred . ; stop; } # # Handle messages from known mailing lists # Move messages from IETF filter discussion list to filter folder # if header :is "Sender" "owner-ietf-mta-filters@imc.org" { fileinto "filter"; # move to "filter" folder } # # Keep all messages to or from people in my company # elsif address :domain :is ["From", "To"] "example.com" { keep; # keep in "In" folder } # # Try and catch unsolicited email. If a message is not to me, # or it contains a subject known to be spam, file it away. # elsif anyof (not address :all :contains ["To", "Cc", "Bcc"] "me@example.com", header :matches "subject" ["*make*money*fast*", "*university*dipl*mas*"]) { # If message header does not contain my address, # it's from a list. fileinto "spam"; # move to "spam" folder } else { # Move all other (non-company) mail to "personal" # folder. fileinto "personal"; } </textarea></form> <script> var editor = CodeMirror.fromTextArea(document.getElementById("code"), {}); </script> <p><strong>MIME types defined:</strong> <code>application/sieve</code>.</p> </article>
EragonJ/cdnjs
ajax/libs/codemirror/3.18.0/mode/sieve/index.html
HTML
mit
2,313
/* Name: 3024 day Author: Jan T. Sott (http://github.com/idleberg) CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ .cm-s-3024-day.CodeMirror {background: #f7f7f7; color: #3a3432;} .cm-s-3024-day div.CodeMirror-selected {background: #d6d5d4 !important;} .cm-s-3024-day.CodeMirror ::selection { background: #d6d5d4; } .cm-s-3024-day.CodeMirror ::-moz-selection { background: #d9d9d9; } .cm-s-3024-day .CodeMirror-gutters {background: #f7f7f7; border-right: 0px;} .cm-s-3024-day .CodeMirror-guttermarker { color: #db2d20; } .cm-s-3024-day .CodeMirror-guttermarker-subtle { color: #807d7c; } .cm-s-3024-day .CodeMirror-linenumber {color: #807d7c;} .cm-s-3024-day .CodeMirror-cursor {border-left: 1px solid #5c5855 !important;} .cm-s-3024-day span.cm-comment {color: #cdab53;} .cm-s-3024-day span.cm-atom {color: #a16a94;} .cm-s-3024-day span.cm-number {color: #a16a94;} .cm-s-3024-day span.cm-property, .cm-s-3024-day span.cm-attribute {color: #01a252;} .cm-s-3024-day span.cm-keyword {color: #db2d20;} .cm-s-3024-day span.cm-string {color: #fded02;} .cm-s-3024-day span.cm-variable {color: #01a252;} .cm-s-3024-day span.cm-variable-2 {color: #01a0e4;} .cm-s-3024-day span.cm-def {color: #e8bbd0;} .cm-s-3024-day span.cm-bracket {color: #3a3432;} .cm-s-3024-day span.cm-tag {color: #db2d20;} .cm-s-3024-day span.cm-link {color: #a16a94;} .cm-s-3024-day span.cm-error {background: #db2d20; color: #5c5855;} .cm-s-3024-day .CodeMirror-activeline-background {background: #e8f2ff !important;} .cm-s-3024-day .CodeMirror-matchingbracket { text-decoration: underline; color: #a16a94 !important;}
redmunds/cdnjs
ajax/libs/codemirror/5.4.0/theme/3024-day.css
CSS
mit
1,747
/* * /MathJax/jax/output/SVG/fonts/TeX/AMS/Regular/Main.js * * Copyright (c) 2012 Design Science, Inc. * * Part of the MathJax library. * See http://www.mathjax.org for details. * * Licensed under the Apache License, Version 2.0; * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 */ MathJax.OutputJax.SVG.FONTDATA.FONTS.MathJax_AMS={directory:"AMS/Regular",family:"MathJax_AMS",id:"MJAMS",Ranges:[[128,255,"Latin1Supplement"],[256,383,"LatinExtendedA"],[688,767,"SpacingModLetters"],[768,879,"CombDiacritMarks"],[880,1023,"GreekAndCoptic"],[8192,8303,"GeneralPunctuation"],[8448,8527,"LetterlikeSymbols"],[8592,8703,"Arrows"],[8704,8959,"MathOperators"],[8960,9215,"MiscTechnical"],[9312,9471,"EnclosedAlphanum"],[9472,9599,"BoxDrawing"],[9632,9727,"GeometricShapes"],[9728,9983,"MiscSymbols"],[9984,10175,"Dingbats"],[10624,10751,"MiscMathSymbolsB"],[10752,11007,"SuppMathOperators"],[57344,63743,"PUA"]],32:[0,0,250,0,0,""],65:[701,1,722,17,703,"130 -1H63Q34 -1 26 2T17 17Q17 24 22 29T35 35Q49 35 64 44T88 66Q101 93 210 383Q331 693 335 697T346 701T357 697Q358 696 493 399Q621 104 633 83Q656 35 686 35Q693 35 698 30T703 17Q703 5 693 2T643 -1H541Q388 -1 386 1Q378 6 378 16Q378 24 383 29T397 35Q412 35 434 45T456 65Q456 93 428 170L419 197H197L195 179Q184 134 184 97Q184 82 186 71T190 55T198 45T205 39T214 36L219 35Q241 31 241 17Q241 5 233 2T196 -1H130ZM493 68Q493 51 481 35H619Q604 56 515 256Q486 321 468 361L348 637Q347 637 330 592T313 543Q313 538 358 436T448 219T493 68ZM404 235Q404 239 355 355T295 488L275 430Q241 348 208 232H306Q404 232 404 235ZM155 48Q151 55 148 88V117L135 86Q118 47 117 46L110 37L135 35H159Q157 41 155 48"],66:[683,1,667,11,620,"11 665Q11 672 22 683H213Q407 681 431 677Q582 649 582 515Q582 488 573 468Q554 413 484 372L474 366H475Q620 317 620 178Q620 115 568 69T420 6Q393 1 207 -1H22Q11 10 11 18Q11 35 51 35Q79 37 88 39T102 52Q107 70 107 341T102 630Q97 640 88 643T51 648H46Q11 648 11 665ZM142 341Q142 129 141 88T134 37Q133 36 133 35H240L233 48L229 61V623L233 635L240 648H133L138 639Q142 621 142 341ZM284 370Q365 378 391 411T417 508Q417 551 406 581T378 624T347 643T320 648Q298 648 278 635Q267 628 266 611T264 492V370H284ZM546 515Q546 551 531 577T494 617T454 635T422 641L411 643L420 630Q439 604 445 579T452 510V504Q452 481 451 467T441 430T415 383Q420 383 439 391T483 413T527 455T546 515ZM585 185Q585 221 570 249T534 294T490 320T453 334T436 337L435 336L440 330Q445 325 452 315T467 288T479 246T484 188Q484 145 474 110T454 62T442 48Q442 47 444 47Q450 47 470 54T517 75T564 119T585 185ZM449 184Q449 316 358 332Q355 332 335 333T302 335H264V199Q266 68 270 57Q275 50 289 43Q300 37 324 37Q449 37 449 184"],67:[702,19,722,39,684,"684 131Q684 125 672 109T633 71T573 29T489 -5T386 -19Q330 -19 276 -3T174 46T91 134T44 261Q39 283 39 341T44 421Q66 538 143 611T341 699Q344 699 364 700T395 701Q449 698 503 677T585 655Q603 655 611 662T620 678T625 694T639 702Q650 702 657 690V481L653 474Q640 467 628 472Q624 476 618 496T595 541Q562 587 507 625T390 663H381Q337 663 299 625Q212 547 212 336Q212 249 233 179Q274 30 405 30Q533 30 641 130Q658 147 666 147Q671 147 677 143T684 131ZM250 625Q264 643 261 643Q238 635 214 620T161 579T110 510T79 414Q74 384 74 341T79 268Q89 213 113 169T164 101T217 61T260 39L277 34Q270 41 264 48Q199 111 181 254Q178 281 178 344T181 434Q200 559 250 625ZM621 565V625Q617 623 613 623Q603 619 590 619H575L588 605Q608 583 610 579L621 565"],68:[683,1,722,16,688,"16 666Q16 675 28 683H193Q329 683 364 682T430 672Q534 650 600 585T686 423Q688 406 688 352Q688 274 673 226Q641 130 565 72T381 1Q368 -1 195 -1H28Q16 5 16 16Q16 35 53 35Q68 36 75 37T87 42T95 52Q98 61 98 341T95 630Q91 640 83 643T53 648Q16 648 16 666ZM237 646Q237 648 184 648H128Q128 647 133 632Q136 620 136 341Q136 64 133 50L128 35H237L230 48L226 61V343Q228 620 231 633Q232 636 237 646ZM264 61Q278 40 310 35Q363 35 401 55T461 112T496 193T513 295Q515 333 515 349Q515 411 504 459Q481 598 373 641Q351 648 321 648Q304 648 292 643T277 635T264 621V61ZM461 628Q462 627 471 616T489 594T509 559T529 509T544 441T550 352Q550 165 479 75L468 59Q474 61 484 65T522 87T573 128T618 195T650 290Q654 322 654 354Q654 418 638 464T581 552Q559 576 529 595T480 621L461 628"],69:[683,1,667,12,640,"12 666Q12 675 24 683H582Q590 680 593 672V588Q593 514 591 502T575 490Q567 490 563 495T555 517Q552 556 517 590Q486 623 445 634T340 648H282Q266 636 264 620T260 492V370H277Q329 375 358 391T404 439Q420 480 420 506Q420 529 436 529Q445 529 451 521Q455 517 455 361Q455 333 455 298T456 253Q456 217 453 207T437 197Q420 196 420 217Q420 240 406 270Q377 328 284 335H260V201Q261 174 261 134Q262 73 264 61T278 38Q281 36 282 35H331Q400 35 449 50Q571 93 602 179Q605 203 622 203Q629 203 634 197T640 183Q638 181 624 95T604 3L600 -1H24Q12 5 12 16Q12 35 51 35Q92 38 97 52Q102 60 102 341T97 632Q91 645 51 648Q12 648 12 666ZM137 341Q137 131 136 89T130 37Q129 36 129 35H235Q233 41 231 48L226 61V623L231 635L235 648H129Q132 641 133 638T135 603T137 517T137 341ZM557 603V648H504Q504 646 515 639Q527 634 542 619L557 603ZM420 317V397L406 383Q394 370 380 363L366 355Q373 350 382 346Q400 333 409 328L420 317ZM582 61L586 88Q585 88 582 83Q557 61 526 46L511 37L542 35H577Q577 36 578 39T580 49T582 61"],70:[683,1,611,12,584,"584 499Q569 490 566 490Q558 490 552 497T546 515Q546 535 533 559Q526 574 506 593T469 621Q415 648 326 648Q293 648 287 647T275 641Q264 630 263 617Q262 609 260 492V370L275 372Q323 376 350 392T393 441Q409 473 409 506Q409 529 427 529Q437 529 442 519Q444 511 444 362Q444 212 442 206Q436 197 426 197Q409 197 409 217Q409 265 375 299Q346 328 280 335H260V206Q260 70 262 63Q265 46 276 41T326 35Q362 35 366 28Q377 17 366 3L360 -1H24Q12 5 12 16Q12 35 51 35Q92 38 97 52Q102 60 102 341T97 632Q91 645 51 648Q12 648 12 666Q12 675 24 683H573Q576 678 584 670V499ZM137 341Q137 131 136 89T130 37Q129 36 129 35H182Q233 35 233 39Q226 54 225 92T224 346L226 623L231 635L235 648H129Q132 641 133 638T135 603T137 517T137 341ZM549 603V648H495L506 641Q531 621 533 619L549 603ZM409 317V395L400 386Q390 376 375 366L357 355L373 346Q394 331 397 328L409 317"],71:[702,19,778,39,749,"737 285Q749 277 749 268Q749 260 744 255T730 250Q695 250 677 217Q666 195 666 119Q666 52 664 50Q656 36 555 3Q483 -16 415 -19Q364 -19 348 -17Q226 -3 146 70T44 261Q39 283 39 341T44 421Q66 538 143 611T341 699Q344 699 364 700T395 701Q449 698 503 677T585 655Q603 655 611 662T620 678T625 694T639 702Q650 702 657 690V481L653 474Q640 467 628 472Q624 476 618 496T595 541Q562 587 507 625T390 663H381Q337 663 299 625Q213 547 213 337Q213 75 341 23Q357 19 397 19Q440 19 462 22T492 30T513 45V119Q513 184 506 203Q491 237 435 250Q421 250 415 257Q404 267 415 281L421 285H737ZM250 43Q250 45 243 55T225 87T203 139T185 224T177 343V361Q184 533 250 625Q264 643 261 643Q238 635 214 620T161 579T110 510T79 414Q74 384 74 341T79 268Q106 117 230 52L250 43ZM621 565V625Q617 623 613 623Q603 619 590 619H575L588 605Q608 583 610 579L621 565ZM655 250H517L524 241Q548 213 548 149V114V39Q549 39 562 44T592 55T615 63L630 70V134Q632 190 634 204T648 237Q655 245 655 250"],72:[683,1,778,14,762,"14 666Q14 675 26 683H344L351 679Q361 665 351 655Q344 648 317 648Q287 645 282 641Q270 637 269 623T266 497V370H511V497Q511 519 510 553Q509 615 507 626T496 641H495Q489 645 459 648Q420 648 420 665Q420 672 426 679L433 683H751Q762 676 762 666Q762 648 724 648Q684 645 677 632Q675 626 675 341Q675 57 677 52Q684 38 724 35Q762 35 762 16Q762 6 751 -1H433L426 3Q420 10 420 17Q420 35 459 35Q501 38 506 52Q511 64 511 190V323H266V190Q266 60 271 52Q276 38 317 35Q342 35 351 28Q360 17 351 3L344 -1H26Q14 5 14 16Q14 35 53 35Q94 38 99 52Q104 60 104 341T99 632Q93 645 53 648Q14 648 14 666ZM233 341V553Q233 635 239 648H131Q134 641 135 638T137 603T139 517T139 341Q139 131 138 89T132 37Q131 36 131 35H239Q233 47 233 129V341ZM639 341V489Q639 548 639 576T640 620T642 639T646 648H537L542 639Q546 625 546 341Q546 130 545 88T538 37Q537 36 537 35H646Q643 41 643 42T641 55T639 84T639 140V341"],73:[683,1,389,20,369,"20 666Q20 676 31 683H358Q369 676 369 666Q369 648 331 648Q288 645 282 632Q278 626 278 341Q278 57 282 50Q286 42 295 40T331 35Q369 35 369 16Q369 6 358 -1H31Q20 4 20 16Q20 35 58 35Q84 37 93 39T107 50Q113 60 113 341Q113 623 107 632Q101 645 58 648Q20 648 20 666ZM249 35Q246 40 246 41T244 54T242 83T242 139V341Q242 632 244 639L249 648H140Q146 634 147 596T149 341Q149 124 148 86T140 35H249"],74:[683,77,500,6,478,"79 103Q108 103 129 83T151 38Q151 9 130 -15Q116 -34 130 -37Q133 -39 157 -39Q208 -39 219 -8L226 3V305Q226 612 224 621Q220 636 211 641T166 647Q137 647 128 654Q119 665 128 679L135 683H466Q478 677 478 666Q478 647 439 647Q399 644 393 632Q388 620 388 347Q386 69 384 59Q364 -6 316 -39T184 -77H172Q102 -77 56 -48T6 30Q6 62 26 82T79 103ZM353 354Q353 556 354 596T361 645Q362 646 362 647H253Q257 639 258 628T261 547T262 312V-4L255 -17Q248 -29 250 -29Q253 -29 258 -28T277 -20T302 -5T327 22T348 65Q350 74 353 354ZM115 36Q115 47 105 57T79 67Q73 67 67 66T52 56T44 34Q44 9 62 -8Q66 -11 71 -15T81 -22T86 -24L90 -13Q100 3 102 5Q115 22 115 36"],75:[683,1,778,22,768,"22 666Q22 676 33 683H351L358 679Q368 665 358 655Q351 648 324 648Q288 645 280 637Q275 631 274 605T273 477L275 343L382 446Q473 530 492 553T512 599Q512 617 502 631T475 648Q455 651 455 666Q455 677 465 680T510 683H593H720Q732 676 732 666Q732 659 727 654T713 648Q670 648 589 581Q567 562 490 489T413 415Q413 413 554 245T711 61Q737 35 751 35Q758 35 763 29T768 15Q768 6 758 -1H624Q491 -1 486 3Q480 10 480 17Q480 25 487 30T506 35Q518 36 520 38T520 48L400 195L302 310L286 297L273 283V170Q275 65 277 57Q280 41 300 38Q302 37 324 35Q349 35 358 28Q367 17 358 3L351 -1H33Q22 4 22 16Q22 35 60 35Q101 38 106 52Q111 60 111 341T106 632Q100 645 60 648Q22 648 22 666ZM240 341V553Q240 635 246 648H138Q141 641 142 638T144 603T146 517T146 341Q146 131 145 89T139 37Q138 36 138 35H246Q240 47 240 129V341ZM595 632L615 648H535L542 637Q542 636 544 625T549 610V595L562 606Q565 608 577 618T595 632ZM524 226L386 388Q386 389 378 382T358 361Q330 338 330 333Q330 332 330 332L331 330L533 90Q558 55 558 41V35H684L671 50Q667 54 524 226"],76:[683,1,667,12,640,"12 666Q12 675 24 683H333L340 679Q350 665 340 655Q333 648 309 648Q287 646 279 643T266 630Q264 623 264 346Q264 68 266 57Q274 40 284 35H340Q413 37 460 55Q514 78 553 117T602 197Q605 221 622 221Q629 221 634 215T640 201Q638 194 625 105T611 12Q611 6 600 -1H24Q12 5 12 16Q12 35 51 35Q92 38 97 52Q102 60 102 341T97 632Q91 645 51 648Q12 648 12 666ZM137 341Q137 131 136 89T130 37Q129 36 129 35H237Q235 41 233 48L229 61L226 339Q226 621 229 628Q230 630 231 636T233 643V648H129Q132 641 133 638T135 603T137 517T137 341ZM580 48Q580 59 583 74T586 97Q586 98 585 97T579 92T571 86Q549 64 513 43L500 35H577L580 48"],77:[683,1,944,17,926,"18 666Q18 677 27 680T73 683H146Q261 683 266 679L465 215Q469 215 566 443Q663 676 668 681Q673 683 790 683H908L915 679Q924 664 915 655Q912 648 897 648Q851 639 835 606L833 346Q833 86 835 79Q838 69 849 58T873 41Q877 40 887 38T901 35Q926 35 926 16Q926 6 915 -1H604L597 3Q588 19 597 28Q600 35 615 35Q660 42 673 68L679 79V339Q679 409 679 443T679 520T679 580T677 597Q646 521 584 375T473 117T424 3Q416 -1 410 -1T401 1Q399 3 273 301L148 599L146 343Q146 86 148 79Q152 69 163 58T186 41Q190 40 200 38T215 35Q226 35 235 28Q244 17 235 3L228 -1H28Q17 4 17 17Q17 35 39 35Q84 42 97 68L104 79V639L88 641Q72 644 53 648Q34 648 26 651T18 666ZM457 166Q451 169 449 171T435 198T404 268T344 412L244 648H157L166 637Q169 633 293 346L413 66Q424 88 435 117L457 166ZM817 646Q817 648 766 648H715V72L708 57Q701 45 697 41L695 37Q695 35 757 35H819L813 46Q802 61 800 76Q797 105 797 346L799 612L804 626Q812 638 815 641L817 646ZM124 42Q119 42 119 38Q119 35 128 35Q132 35 132 36Q125 42 124 42"],78:[683,20,722,20,702,"20 664Q20 666 31 683H142Q256 683 258 681Q259 680 279 653T342 572T422 468L582 259V425Q582 451 582 490T583 541Q583 611 573 628T522 648Q500 648 493 654Q484 665 493 679L500 683H691Q702 676 702 666Q702 657 698 652Q688 648 680 648Q633 648 627 612Q624 601 624 294V-8Q616 -20 607 -20Q601 -20 596 -15Q593 -13 371 270L156 548L153 319Q153 284 153 234T152 167Q152 103 156 78T172 44T213 34Q236 34 242 28Q253 17 242 3L236 -1H36Q24 6 24 16Q24 34 56 34Q58 35 69 36T86 40T100 50T109 72Q111 83 111 345V603L96 619Q72 643 44 648Q20 648 20 664ZM413 419L240 648H120L136 628Q137 626 361 341T587 54L589 68Q589 78 589 121V192L413 419"],79:[701,19,778,34,742,"131 601Q180 652 249 676T387 701Q485 701 562 661Q628 629 671 575T731 448Q742 410 742 341T731 234Q707 140 646 81Q549 -19 389 -19Q228 -19 131 81Q57 155 37 274Q34 292 34 341Q34 392 37 410Q58 528 131 601ZM568 341Q568 613 437 659Q406 664 395 665Q329 665 286 625Q232 571 213 439Q210 408 210 341Q210 275 213 245Q232 111 286 57Q309 37 342 23Q357 19 389 19Q420 19 437 23Q469 38 491 57Q568 132 568 341ZM174 341Q174 403 177 441T197 535T249 639Q246 639 224 627T193 608Q189 606 183 601T169 589T155 577Q69 488 69 344Q69 133 231 52Q244 45 246 45Q248 45 246 48Q231 69 222 85T200 141T177 239Q174 269 174 341ZM708 341Q708 415 684 475T635 563T582 610Q578 612 565 619T546 630Q533 637 531 637Q530 637 530 636V635L531 634Q562 591 577 543Q602 471 602 341V316Q602 264 599 230T580 144T531 48L530 47V46Q530 45 531 45Q533 45 547 52T583 75T622 105Q708 195 708 341"],80:[683,1,611,16,597,"16 666Q16 675 28 683H195Q334 683 370 682T437 672Q511 657 554 611T597 495Q597 343 404 309Q402 308 401 308Q381 303 319 303H261V181Q261 157 262 120Q262 60 267 50T304 36Q310 35 313 35Q352 35 352 17Q352 10 346 3L339 -1H28Q16 5 16 16Q16 35 53 35Q68 36 75 37T87 42T95 52Q98 61 98 341T95 630Q91 640 83 643T53 648Q16 648 16 666ZM235 35Q228 46 227 84Q226 129 226 337V621L230 635L237 648H128Q128 647 133 632Q136 620 136 341Q136 64 133 50L128 35H235ZM301 341H313Q339 341 354 344T389 362T417 410T426 498Q426 586 401 616T322 647Q301 647 293 643Q271 637 264 621Q261 617 261 479V341H301ZM429 350Q431 350 443 353T476 367T515 391T548 432T562 490Q562 550 524 592Q507 607 484 619Q481 621 448 635L433 639L439 621Q462 578 462 506Q462 448 454 413T437 366T428 350H429"],81:[701,181,778,34,742,"480 -10Q480 -13 486 -24T507 -50T541 -80T588 -104T648 -114Q666 -114 688 -110T714 -106Q724 -106 728 -114T729 -130Q723 -145 663 -163T548 -181Q503 -181 463 -169T395 -139T343 -97T307 -56T284 -19L280 -3L262 1Q188 24 131 81Q57 155 37 275Q34 292 34 342T37 410Q58 528 131 601Q179 652 248 676T388 701Q485 701 562 661Q698 595 731 448Q742 410 742 341T731 235Q707 141 646 81Q616 50 575 27T493 -5L480 -10ZM568 342Q568 613 437 659L395 666Q329 666 286 626Q232 570 213 439Q210 408 210 342T213 246Q231 113 286 57Q309 37 342 23Q357 19 389 19Q420 19 437 23Q469 38 491 57Q568 134 568 342ZM174 341V354Q174 393 175 419T183 484T205 561T246 635L249 639Q246 639 224 627T193 608Q189 606 183 601T169 589T155 577Q69 491 69 344Q69 133 231 52Q247 42 247 46Q247 46 246 48Q231 69 222 85T200 141T177 239Q174 269 174 341ZM708 341Q708 410 689 467T640 556T588 606T546 630Q532 638 531 638Q530 638 531 635Q563 590 577 543Q602 472 602 341V316Q602 264 599 230T580 144T531 48Q529 44 532 45T546 52Q575 68 596 84T642 128T683 200T706 299Q708 327 708 341ZM391 -17H333Q329 -15 326 -15Q324 -15 324 -17Q324 -21 362 -68Q424 -130 506 -143Q518 -144 544 -144Q569 -144 577 -143L589 -141L575 -139Q544 -127 509 -101T453 -37L442 -19L391 -17"],82:[683,1,722,16,705,"17 665Q17 672 28 683H221Q415 681 439 677Q461 673 481 667T516 654T544 639T566 623T584 607T597 592T607 578T614 565T618 554L621 548Q626 530 626 497Q626 447 613 419Q578 348 473 326L455 321Q462 310 473 292T517 226T578 141T637 72T686 35Q705 30 705 16Q705 7 693 -1H510Q503 6 404 159L306 310H268V183Q270 67 271 59Q274 42 291 38Q295 37 319 35Q344 35 353 28Q362 17 353 3L346 -1H28Q16 5 16 16Q16 35 55 35Q96 38 101 52Q106 60 106 341T101 632Q95 645 55 648Q17 648 17 665ZM241 35Q238 42 237 45T235 78T233 163T233 337V621L237 635L244 648H133Q136 641 137 638T139 603T141 517T141 341Q141 131 140 89T134 37Q133 36 133 35H241ZM457 496Q457 540 449 570T425 615T400 634T377 643Q374 643 339 648Q300 648 281 635Q271 628 270 610T268 481V346H284Q327 346 375 352Q421 364 439 392T457 496ZM492 537T492 496T488 427T478 389T469 371T464 361Q464 360 465 360Q469 360 497 370Q593 400 593 495Q593 592 477 630L457 637L461 626Q474 611 488 561Q492 537 492 496ZM464 243Q411 317 410 317Q404 317 401 315Q384 315 370 312H346L526 35H619L606 50Q553 109 464 243"],83:[702,12,556,28,528,"54 238Q72 238 72 212Q72 174 106 121Q113 110 132 90T166 59Q221 23 264 23Q315 23 348 41Q368 50 384 79Q393 102 393 129Q393 181 356 219T221 299Q120 343 74 390T28 501Q28 561 55 610Q98 682 212 699Q214 699 231 700T261 701Q309 698 340 687T408 675Q431 678 445 690T465 702Q474 702 481 690V497L477 490Q464 481 450 490Q446 500 446 501Q446 546 386 606T260 666Q215 666 182 639T148 565Q148 528 186 496T319 428Q352 414 370 405T418 379T468 338T506 284Q528 239 528 191Q528 102 456 46T266 -10Q211 -10 176 2T110 15Q86 9 73 -1T53 -12Q44 -12 37 -1V112V182Q37 214 40 226T54 238ZM446 619Q446 648 444 648Q439 646 435 644Q425 644 415 639H404L417 624Q435 606 439 601L446 592V619ZM124 619L128 635Q126 635 108 617Q64 576 64 502Q64 489 65 479T76 449T102 414T150 376T228 335Q335 291 381 245T427 128Q427 94 419 75L415 61Q421 61 448 88Q490 127 490 190Q490 233 475 264Q456 299 430 321Q402 349 369 367T287 404T204 441Q138 481 119 526Q113 544 113 565Q113 596 124 619ZM75 43Q76 43 90 46T110 50H119L106 64L74 101Q72 101 72 72T75 43"],84:[683,1,667,33,635,"33 672Q36 680 44 683H624Q632 680 635 672V490L631 483Q621 479 617 479Q611 479 606 485T600 499Q600 525 584 552Q577 567 558 588T524 617Q479 642 426 646L415 648V355Q415 62 422 52Q425 42 434 40T473 35Q500 35 509 28Q518 17 509 3L502 -1H166L160 3Q149 17 160 28Q167 35 195 35Q224 37 234 39T249 52Q253 66 253 355V648L242 646Q192 642 144 617Q129 609 110 588T84 552Q69 527 69 499Q69 490 64 484T50 478Q39 478 33 490V672ZM113 639L126 648H69V597L84 612Q93 623 113 639ZM389 35Q382 46 381 86Q380 134 380 350V648H289V350Q289 199 288 131T286 53T280 35H389ZM600 597V648H542L555 639Q575 623 584 612L600 597"],85:[683,19,722,16,709,"16 666Q16 677 28 683H341L348 679Q359 665 348 654Q342 648 315 648Q270 644 266 632Q262 627 262 598T261 399Q261 372 261 325T260 260Q260 149 274 99T339 30Q355 25 393 25Q430 25 457 33T494 49T519 72Q562 115 575 205Q576 219 576 379Q576 538 575 550Q568 597 550 622T506 648Q498 648 493 654T487 667T499 683H697Q709 675 709 667T704 654T690 648Q653 648 633 597Q624 573 622 546T619 377Q617 193 613 174Q596 95 544 41Q477 -19 355 -19H344Q275 -16 226 5T153 57T120 110T106 154Q101 172 99 399Q99 618 95 632Q88 644 53 648Q16 648 16 666ZM228 639L233 648H128Q128 647 133 632Q135 621 135 412Q135 197 137 185Q148 115 181 79Q209 51 235 41Q242 36 258 31T277 25Q276 27 268 38T254 59T241 92T228 145Q226 161 226 399Q226 632 228 639ZM604 621Q606 626 619 648H577L586 634Q587 632 591 625T595 614L597 608L604 621"],86:[683,20,722,0,719,"316 683Q327 676 327 666Q327 648 302 648Q272 642 258 628Q249 621 249 608Q252 589 263 556T289 485T322 406T357 325T388 256T411 205L420 185Q423 185 473 317Q547 497 547 590Q547 621 541 632T516 648Q501 648 498 654Q488 664 498 679L504 683H607H660Q695 683 707 680T719 667Q719 660 714 654T700 648Q678 648 658 628L642 614L513 301Q484 231 449 148T397 25T380 -15Q373 -20 368 -20Q361 -20 358 -15Q354 -13 287 135T149 438T67 610Q45 648 18 648Q11 648 6 653T0 666Q0 677 9 680T59 683H164H316ZM216 614Q216 620 216 622T216 628T216 633T217 635T218 638T219 640T221 644T224 648H84L96 632Q118 592 236 330L367 43L387 88L404 132L380 185Q250 468 222 568Q216 590 216 614ZM576 645Q584 628 584 597L587 568L598 597Q609 624 618 637L624 648H600Q576 648 576 645"],87:[683,19,1000,5,994,"785 664Q785 670 795 683H982Q994 675 994 665Q994 650 975 648Q953 643 939 619Q931 593 823 292T710 -15Q706 -19 699 -19T688 -15Q682 -6 639 107T555 328T513 437Q513 438 500 409T462 325T413 212Q315 -14 310 -17Q308 -19 302 -19T288 -15L57 619Q45 643 24 648Q5 650 5 665Q5 677 17 683H146H200Q256 683 270 681T285 666Q285 659 280 654T268 648Q253 648 239 634Q230 630 230 619Q230 598 264 481L362 192Q363 193 428 341T493 492Q493 496 473 546T446 608Q426 648 399 648Q392 648 387 653T382 667Q382 678 393 683H679Q690 670 690 665Q690 662 685 655T673 648Q653 648 633 632L622 625V610Q626 576 657 479T719 300T751 218Q754 218 779 294Q847 492 847 581Q847 648 802 648Q796 648 791 652T785 664ZM194 623Q194 630 199 648H82L90 632Q99 616 199 332L302 50Q303 50 322 94T342 141Q342 142 305 245T231 467T194 623ZM585 620Q585 634 593 648H530Q466 648 466 645Q479 632 595 323L699 54Q701 56 718 103T735 154L702 245Q585 562 585 620ZM884 572L890 587Q896 602 903 620T915 645Q915 648 893 648H868L875 634Q883 598 883 576Q883 572 884 572"],88:[683,1,722,16,705,"22 666Q22 677 31 680T80 683H184H335Q346 675 346 667Q346 660 341 655Q335 648 315 648Q280 644 273 637Q273 630 300 583T356 492T386 448Q430 504 450 535T474 577T478 601Q478 620 469 634T444 648Q428 648 428 666Q428 678 436 680T488 683H559H630Q673 683 681 681T690 666Q690 648 673 648Q652 648 619 637Q571 615 517 550Q490 517 450 464T410 408Q415 399 501 273T617 106Q648 61 661 48T688 35Q705 35 705 16Q705 5 695 -1H539Q384 -1 379 3Q373 10 373 17Q373 27 380 31T408 35Q459 40 459 49Q459 59 418 129T335 259Q334 260 332 260Q328 260 273 197Q210 127 208 117Q199 104 199 82Q199 57 213 46T239 35Q247 35 252 29T257 15Q257 10 256 7T253 3T248 0L246 -1H28Q16 7 16 15T21 29T35 35Q61 35 117 88Q289 279 304 297Q307 303 255 377Q117 586 79 626Q60 648 39 648Q32 648 27 653T22 666ZM237 639V648H173Q113 647 113 646Q113 642 137 612Q186 546 302 373T453 139Q497 63 497 43Q497 39 495 35H559Q622 35 622 37Q622 38 583 94T486 233T373 399T277 552T237 639ZM553 637L566 648H504L508 637Q510 630 515 615V603L528 615Q529 616 539 625T553 637ZM170 46Q169 49 167 58T164 70V83L137 59L113 35H175Q175 38 170 46"],89:[683,1,722,16,704,"16 659T16 667T28 683H295Q306 676 306 666Q306 648 284 648Q258 648 255 641Q255 634 265 615T339 479Q418 339 421 339L455 394Q489 448 523 502L557 557Q560 566 560 582Q560 637 504 648Q489 648 486 655Q475 664 486 679L493 683H693Q704 675 704 667Q704 650 684 648Q672 645 653 623Q633 604 614 576T517 426L439 301V183Q442 62 444 59Q449 35 504 35Q521 35 528 30Q538 16 528 3L521 -1H195L188 3Q178 16 188 30Q195 35 213 35Q266 35 273 59Q274 61 277 163V261L75 621Q64 638 58 643T37 648Q28 648 22 653ZM219 637V648H101Q110 634 215 446L313 270V166Q310 59 306 48L301 35H415L410 48Q404 65 404 175V290L317 443Q230 601 226 612Q219 625 219 637ZM608 630L624 648H575Q584 632 588 623L595 610L608 630"],90:[683,1,667,29,635,"39 -1Q29 9 29 12Q29 23 60 77T219 337L410 648H364Q261 648 210 628Q168 612 142 588T109 545T97 509T88 490Q85 489 80 489Q72 489 61 503L70 588Q72 607 75 628T79 662T81 675Q84 677 88 681Q90 683 341 683H592Q604 673 604 666Q604 662 412 348L221 37Q221 35 301 35Q406 35 446 48Q504 68 543 111T597 212Q602 239 617 239Q624 239 629 234T635 223Q635 215 621 113T604 8L597 1Q595 -1 317 -1H39ZM148 637L166 648H112V632Q111 629 110 622T108 612Q108 608 110 608T116 612T129 623T148 637ZM552 646Q552 648 504 648Q452 648 450 643Q448 639 266 343T77 37Q77 35 128 35H179L366 339L552 646ZM572 35Q581 89 581 97L561 77Q542 59 526 48L508 37L539 35H572"],107:[683,1,556,17,534,"519 443Q519 426 497 426Q458 422 361 335Q328 308 315 295Q307 289 310 286T383 193T466 88Q507 35 517 35Q534 35 534 16Q534 5 524 -1H304L297 3Q288 19 297 28Q300 35 317 35Q320 36 324 36T330 37T333 39Q334 39 334 40Q334 47 304 86T244 162L215 199Q212 202 206 199Q201 195 201 137V121Q201 35 230 35Q238 35 243 29T248 15Q248 4 237 -1H28L21 3Q17 13 17 17Q17 24 22 29T35 35Q55 35 61 70Q63 78 63 341T61 612Q55 648 35 648Q27 648 22 654T17 668Q17 678 26 682Q27 683 28 683H108H147Q156 683 162 683T174 683T182 683T187 682T191 681T194 680T197 678T201 675V461L204 246L244 281Q254 291 272 307Q317 349 326 360T339 386Q340 390 340 398Q340 426 321 426Q314 426 309 431T304 445Q304 456 315 461H508Q519 448 519 443ZM166 359V648H126Q89 648 89 645Q89 644 89 644T90 643T91 640T93 634T95 626Q99 612 99 341T95 57Q94 53 93 49T91 43T90 39L89 37Q89 35 133 35Q176 35 176 37Q175 38 175 39Q175 42 170 57Q166 70 166 359ZM410 423Q412 425 407 426Q404 426 393 426Q373 426 373 423Q374 422 375 417T377 410Q377 399 379 399Q406 419 410 423ZM460 37Q460 41 368 152L281 263Q280 263 259 246L239 228Q298 157 355 79Q370 61 370 41V35H417Q460 35 460 37"]};MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/Main.js");
danut007ro/cdnjs
ajax/libs/mathjax/2.1.0/jax/output/SVG/fonts/TeX/AMS/Regular/Main.js
JavaScript
mit
23,905
/* Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang("specialchar","pt",{euro:"Símbolo do Euro",lsquo:"Aspa esquerda simples",rsquo:"Aspa direita simples",ldquo:"Aspa esquerda dupla",rdquo:"Aspa direita dupla",ndash:"Travessão Simples",mdash:"Travessão Longo",iexcl:"Ponto de exclamação invertido",cent:"Símbolo do Cêntimo",pound:"Símbolo da Libra",curren:"Símbolo de Moeda",yen:"Símbolo do Iene",brvbar:"Barra quebrada",sect:"Símbolo de Secção",uml:"Trema",copy:"Símbolo dos Direitos de Autor",ordf:"Indicador ordinal feminino", laquo:"Aspa esquerda ângulo duplo",not:"Não Símbolo",reg:"Símbolo de Registado",macr:"Mácron",deg:"Símbolo de Grau",sup2:"Expoente 2",sup3:"Expoente 3",acute:"Acento agudo",micro:"Símbolo de Micro",para:"Símbolo de Parágrafo",middot:"Ponto do Meio",cedil:"Cedilha",sup1:"Expoente 1",ordm:"Indicador ordinal masculino",raquo:"Aspas ângulo duplo pra Direita",frac14:"Fração vulgar 1/4",frac12:"Fração vulgar 1/2",frac34:"Fração vulgar 3/4",iquest:"Ponto de interrogação invertido",Agrave:"Letra maiúscula latina A com acento grave", Aacute:"Letra maiúscula latina A com acento agudo",Acirc:"Letra maiúscula latina A com circunflexo",Atilde:"Letra maiúscula latina A com til",Auml:"Letra maiúscula latina A com trema",Aring:"Letra maiúscula latina A com sinal diacrítico",AElig:"Letra maiúscula latina Æ",Ccedil:"Letra maiúscula latina C com cedilha",Egrave:"Letra maiúscula latina E com acento grave",Eacute:"Letra maiúscula latina E com acento agudo",Ecirc:"Letra maiúscula latina E com circunflexo",Euml:"Letra maiúscula latina E com trema", Igrave:"Letra maiúscula latina I com acento grave",Iacute:"Letra maiúscula latina I com acento agudo",Icirc:"Letra maiúscula latina I com cincunflexo",Iuml:"Letra maiúscula latina I com trema",ETH:"Letra maiúscula latina Eth (Ðð)",Ntilde:"Letra maiúscula latina N com til",Ograve:"Letra maiúscula latina O com acento grave",Oacute:"Letra maiúscula latina O com acento agudo",Ocirc:"Letra maiúscula latina I com circunflexo",Otilde:"Letra maiúscula latina O com til",Ouml:"Letra maiúscula latina O com trema", times:"Símbolo de multiplicação",Oslash:"Letra maiúscula O com barra",Ugrave:"Letra maiúscula latina U com acento grave",Uacute:"Letra maiúscula latina U com acento agudo",Ucirc:"Letra maiúscula latina U com circunflexo",Uuml:"Letra maiúscula latina E com trema",Yacute:"Letra maiúscula latina Y com acento agudo",THORN:"Letra maiúscula latina Rúnico",szlig:"Letra minúscula latina s forte",agrave:"Letra minúscula latina a com acento grave",aacute:"Letra minúscula latina a com acento agudo",acirc:"Letra minúscula latina a com circunflexo", atilde:"Letra minúscula latina a com til",auml:"Letra minúscula latina a com trema",aring:"Letra minúscula latina a com sinal diacrítico",aelig:"Letra minúscula latina æ",ccedil:"Letra minúscula latina c com cedilha",egrave:"Letra minúscula latina e com acento grave",eacute:"Letra minúscula latina e com acento agudo",ecirc:"Letra minúscula latina e com circunflexo",euml:"Letra minúscula latina e com trema",igrave:"Letra minúscula latina i com acento grave",iacute:"Letra minúscula latina i com acento agudo", icirc:"Letra minúscula latina i com circunflexo",iuml:"Letra pequena latina i com trema",eth:"Letra minúscula latina eth",ntilde:"Letra minúscula latina n com til",ograve:"Letra minúscula latina o com acento grave",oacute:"Letra minúscula latina o com acento agudo",ocirc:"Letra minúscula latina o com circunflexo",otilde:"Letra minúscula latina o com til",ouml:"Letra minúscula latina o com trema",divide:"Símbolo de divisão",oslash:"Letra minúscula latina o com barra",ugrave:"Letra minúscula latina u com acento grave", uacute:"Letra minúscula latina u com acento agudo",ucirc:"Letra minúscula latina u com circunflexo",uuml:"Letra minúscula latina u com trema",yacute:"Letra minúscula latina y com acento agudo",thorn:"Letra minúscula latina Rúnico",yuml:"Letra minúscula latina y com trema",OElig:"Ligadura maiúscula latina OE",oelig:"Ligadura minúscula latina oe",372:"Letra maiúscula latina W com circunflexo",374:"Letra maiúscula latina Y com circunflexo",373:"Letra minúscula latina w com circunflexo",375:"Letra minúscula latina y com circunflexo", sbquo:"Aspa Simples inferior-9",8219:"Aspa Simples superior invertida-9",bdquo:"Aspa duplas inferior-9",hellip:"Elipse Horizontal ",trade:"Símbolo de Marca Registada",9658:"Ponteiro preto direito",bull:"Marca",rarr:"Seta para a direita",rArr:"Seta dupla para a direita",hArr:"Seta dupla direita esquerda",diams:"Naipe diamante preto",asymp:"Quase igual a "});
duyphan2502/lumen-angular-demo
public/assets/core/third_party/ckeditor/plugins/specialchar/dialogs/lang/pt.js
JavaScript
mit
4,788
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ /** * 1. Set default font family to sans-serif. * 2. Prevent iOS and IE text size adjust after device orientation change, * without disabling user zoom. */ html { font-family: sans-serif; /* 1 */ -ms-text-size-adjust: 100%; /* 2 */ -webkit-text-size-adjust: 100%; /* 2 */ } /** * Remove default margin. */ body { margin: 0; } /* HTML5 display definitions ========================================================================== */ /** * Correct `block` display not defined for any HTML5 element in IE 8/9. * Correct `block` display not defined for `details` or `summary` in IE 10/11 * and Firefox. * Correct `block` display not defined for `main` in IE 11. */ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary { display: block; } /** * 1. Correct `inline-block` display not defined in IE 8/9. * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. */ audio, canvas, progress, video { display: inline-block; /* 1 */ vertical-align: baseline; /* 2 */ } /** * Prevent modern browsers from displaying `audio` without controls. * Remove excess height in iOS 5 devices. */ audio:not([controls]) { display: none; height: 0; } /** * Address `[hidden]` styling not present in IE 8/9/10. * Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22. */ [hidden], template { display: none; } /* Links ========================================================================== */ /** * Remove the gray background color from active links in IE 10. */ a { background-color: transparent; } /** * Improve readability of focused elements when they are also in an * active/hover state. */ a:active, a:hover { outline: 0; } /* Text-level semantics ========================================================================== */ /** * Address styling not present in IE 8/9/10/11, Safari, and Chrome. */ abbr[title] { border-bottom: 1px dotted; } /** * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. */ b, strong { font-weight: bold; } /** * Address styling not present in Safari and Chrome. */ dfn { font-style: italic; } /** * Address variable `h1` font-size and margin within `section` and `article` * contexts in Firefox 4+, Safari, and Chrome. */ h1 { font-size: 2em; margin: 0.67em 0; } /** * Address styling not present in IE 8/9. */ mark { background: #ff0; color: #000; } /** * Address inconsistent and variable font size in all browsers. */ small { font-size: 80%; } /** * Prevent `sub` and `sup` affecting `line-height` in all browsers. */ sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } sup { top: -0.5em; } sub { bottom: -0.25em; } /* Embedded content ========================================================================== */ /** * Remove border when inside `a` element in IE 8/9/10. */ img { border: 0; } /** * Correct overflow not hidden in IE 9/10/11. */ svg:not(:root) { overflow: hidden; } /* Grouping content ========================================================================== */ /** * Address margin not present in IE 8/9 and Safari. */ figure { margin: 1em 40px; } /** * Address differences between Firefox and other browsers. */ hr { box-sizing: content-box; height: 0; } /** * Contain overflow in all browsers. */ pre { overflow: auto; } /** * Address odd `em`-unit font size rendering in all browsers. */ code, kbd, pre, samp { font-family: monospace, monospace; font-size: 1em; } /* Forms ========================================================================== */ /** * Known limitation: by default, Chrome and Safari on OS X allow very limited * styling of `select`, unless a `border` property is set. */ /** * 1. Correct color not being inherited. * Known issue: affects color of disabled elements. * 2. Correct font properties not being inherited. * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. */ button, input, optgroup, select, textarea { color: inherit; /* 1 */ font: inherit; /* 2 */ margin: 0; /* 3 */ } /** * Address `overflow` set to `hidden` in IE 8/9/10/11. */ button { overflow: visible; } /** * Address inconsistent `text-transform` inheritance for `button` and `select`. * All other form control elements do not inherit `text-transform` values. * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. * Correct `select` style inheritance in Firefox. */ button, select { text-transform: none; } /** * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` * and `video` controls. * 2. Correct inability to style clickable `input` types in iOS. * 3. Improve usability and consistency of cursor style between image-type * `input` and others. */ button, html input[type="button"], input[type="reset"], input[type="submit"] { -webkit-appearance: button; /* 2 */ cursor: pointer; /* 3 */ } /** * Re-set default cursor for disabled elements. */ button[disabled], html input[disabled] { cursor: default; } /** * Remove inner padding and border in Firefox 4+. */ button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; } /** * Address Firefox 4+ setting `line-height` on `input` using `!important` in * the UA stylesheet. */ input { line-height: normal; } /** * It's recommended that you don't attempt to style these elements. * Firefox's implementation doesn't respect box-sizing, padding, or width. * * 1. Address box sizing set to `content-box` in IE 8/9/10. * 2. Remove excess padding in IE 8/9/10. */ input[type="checkbox"], input[type="radio"] { box-sizing: border-box; /* 1 */ padding: 0; /* 2 */ } /** * Fix the cursor style for Chrome's increment/decrement buttons. For certain * `font-size` values of the `input`, it causes the cursor style of the * decrement button to change from `default` to `text`. */ input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { height: auto; } /** * 1. Address `appearance` set to `searchfield` in Safari and Chrome. * 2. Address `box-sizing` set to `border-box` in Safari and Chrome. */ input[type="search"] { -webkit-appearance: textfield; /* 1 */ box-sizing: content-box; /* 2 */ } /** * Remove inner padding and search cancel button in Safari and Chrome on OS X. * Safari (but not Chrome) clips the cancel button when the search input has * padding (and `textfield` appearance). */ input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; } /** * Define consistent border, margin, and padding. */ fieldset { border: 1px solid #c0c0c0; margin: 0 2px; padding: 0.35em 0.625em 0.75em; } /** * 1. Correct `color` not being inherited in IE 8/9/10/11. * 2. Remove padding so people aren't caught out if they zero out fieldsets. */ legend { border: 0; /* 1 */ padding: 0; /* 2 */ } /** * Remove default vertical scrollbar in IE 8/9/10/11. */ textarea { overflow: auto; } /** * Don't inherit the `font-weight` (applied by a rule above). * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. */ optgroup { font-weight: bold; } /* Tables ========================================================================== */ /** * Remove most spacing between table cells. */ table { border-collapse: collapse; border-spacing: 0; } td, th { padding: 0; } /** * MUI Colors module */ /** * MUI Reboot */ * { box-sizing: border-box; } *:before, *:after { box-sizing: border-box; } html { font-size: 10px; -webkit-tap-highlight-color: transparent; } body { font-family: Arial, Verdana, Tahoma; font-size: 14px; font-weight: 400; line-height: 1.429; color: rgba(0, 0, 0, 0.87); background-color: #FFF; } input, button, select, textarea { font-family: inherit; font-size: inherit; line-height: inherit; } a { color: #2196F3; text-decoration: none; } a:hover, a:focus { color: #1976D2; text-decoration: underline; } a:focus { outline: thin dotted; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } p { margin: 0 0 10px; } ul, ol { margin-top: 0; margin-bottom: 10px; } figure { margin: 0; } img { vertical-align: middle; } hr { margin-top: 20px; margin-bottom: 20px; border: 0; height: 1px; background-color: rgba(0, 0, 0, 0.12); } legend { display: block; width: 100%; padding: 0; margin-bottom: 10px; font-size: 21px; color: rgba(0, 0, 0, 0.87); line-height: inherit; border: 0; } input[type="search"] { box-sizing: border-box; -webkit-appearance: none; } input[type="file"]:focus, input[type="radio"]:focus, input[type="checkbox"]:focus { outline: thin dotted; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } input[type="radio"]:disabled, input[type="checkbox"]:disabled { cursor: not-allowed; } strong { font-weight: 700; } abbr[title] { cursor: help; border-bottom: 1px dotted #2196F3; } h1, h2, h3 { margin-top: 20px; margin-bottom: 10px; } h4, h5, h6 { margin-top: 10px; margin-bottom: 10px; } /** * MUI Appbar */ .mui--appbar-height { height: 56px; } .mui--appbar-min-height, .mui-appbar { min-height: 56px; } .mui--appbar-line-height { line-height: 56px; } .mui--appbar-top { top: 56px; } @media (orientation: landscape) and (max-height: 480px) { .mui--appbar-height { height: 48px; } .mui--appbar-min-height, .mui-appbar { min-height: 48px; } .mui--appbar-line-height { line-height: 48px; } .mui--appbar-top { top: 48px; } } @media (min-width: 480px) { .mui--appbar-height { height: 64px; } .mui--appbar-min-height, .mui-appbar { min-height: 64px; } .mui--appbar-line-height { line-height: 64px; } .mui--appbar-top { top: 64px; } } .mui-appbar { background-color: #2196F3; color: #FFF; } /** * MUI Buttons */ .mui-btn { animation-duration: 0.0001s; animation-name: mui-node-inserted; font-weight: 500; font-size: 14px; line-height: 18px; text-transform: uppercase; color: rgba(0, 0, 0, 0.87); background-color: #FFF; transition: all 0.2s ease-in-out; display: inline-block; height: 36px; padding: 0 26px; margin-top: 6px; margin-bottom: 6px; border: none; border-radius: 2px; cursor: pointer; -ms-touch-action: manipulation; touch-action: manipulation; background-image: none; text-align: center; line-height: 36px; vertical-align: middle; white-space: nowrap; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; font-size: 14px; letter-spacing: 0.03em; position: relative; overflow: hidden; } .mui-btn:hover, .mui-btn:focus, .mui-btn:active { color: rgba(0, 0, 0, 0.87); background-color: white; } .mui-btn[disabled]:hover, .mui-btn[disabled]:focus, .mui-btn[disabled]:active { color: rgba(0, 0, 0, 0.87); background-color: #FFF; } .mui-btn.mui-btn--flat { color: rgba(0, 0, 0, 0.87); background-color: transparent; } .mui-btn.mui-btn--flat:hover, .mui-btn.mui-btn--flat:focus, .mui-btn.mui-btn--flat:active { color: rgba(0, 0, 0, 0.87); background-color: #f2f2f2; } .mui-btn.mui-btn--flat[disabled]:hover, .mui-btn.mui-btn--flat[disabled]:focus, .mui-btn.mui-btn--flat[disabled]:active { color: rgba(0, 0, 0, 0.87); background-color: transparent; } .mui-btn:hover, .mui-btn:focus, .mui-btn:active { outline: 0; text-decoration: none; color: rgba(0, 0, 0, 0.87); } .mui-btn:hover, .mui-btn:focus { box-shadow: 0 0px 2px rgba(0, 0, 0, 0.12), 0 2px 2px rgba(0, 0, 0, 0.2); } @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { .mui-btn:hover, .mui-btn:focus { box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.12), -1px 0px 2px rgba(0, 0, 0, 0.12), 0 0px 2px rgba(0, 0, 0, 0.12), 0 2px 2px rgba(0, 0, 0, 0.2); } } .mui-btn:active:hover { box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23); } @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { .mui-btn:active:hover { box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.12), -1px 0px 2px rgba(0, 0, 0, 0.12), 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23); } } .mui-btn:disabled, .mui-btn.mui--is-disabled { cursor: not-allowed; pointer-events: none; opacity: 0.60; box-shadow: none; } .mui-btn + .mui-btn { margin-left: 8px; } .mui-btn--flat { background-color: transparent; } .mui-btn--flat:hover, .mui-btn--flat:focus, .mui-btn--flat:active, .mui-btn--flat:active:hover { box-shadow: none; background-color: #f2f2f2; } .mui-btn--raised, .mui-btn--fab { box-shadow: 0 0px 2px rgba(0, 0, 0, 0.12), 0 2px 2px rgba(0, 0, 0, 0.2); } @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { .mui-btn--raised, .mui-btn--fab { box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.12), -1px 0px 2px rgba(0, 0, 0, 0.12), 0 0px 2px rgba(0, 0, 0, 0.12), 0 2px 2px rgba(0, 0, 0, 0.2); } } .mui-btn--raised:active, .mui-btn--fab:active { box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23); } @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { .mui-btn--raised:active, .mui-btn--fab:active { box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.12), -1px 0px 2px rgba(0, 0, 0, 0.12), 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23); } } .mui-btn--fab { position: relative; padding: 0; width: 55px; height: 55px; line-height: 55px; border-radius: 50%; z-index: 1; } .mui-btn--primary { color: #FFF; background-color: #2196F3; } .mui-btn--primary:hover, .mui-btn--primary:focus, .mui-btn--primary:active { color: #FFF; background-color: #39a1f4; } .mui-btn--primary[disabled]:hover, .mui-btn--primary[disabled]:focus, .mui-btn--primary[disabled]:active { color: #FFF; background-color: #2196F3; } .mui-btn--primary.mui-btn--flat { color: #2196F3; background-color: transparent; } .mui-btn--primary.mui-btn--flat:hover, .mui-btn--primary.mui-btn--flat:focus, .mui-btn--primary.mui-btn--flat:active { color: #2196F3; background-color: #f2f2f2; } .mui-btn--primary.mui-btn--flat[disabled]:hover, .mui-btn--primary.mui-btn--flat[disabled]:focus, .mui-btn--primary.mui-btn--flat[disabled]:active { color: #2196F3; background-color: transparent; } .mui-btn--dark { color: #FFF; background-color: #424242; } .mui-btn--dark:hover, .mui-btn--dark:focus, .mui-btn--dark:active { color: #FFF; background-color: #4f4f4f; } .mui-btn--dark[disabled]:hover, .mui-btn--dark[disabled]:focus, .mui-btn--dark[disabled]:active { color: #FFF; background-color: #424242; } .mui-btn--dark.mui-btn--flat { color: #424242; background-color: transparent; } .mui-btn--dark.mui-btn--flat:hover, .mui-btn--dark.mui-btn--flat:focus, .mui-btn--dark.mui-btn--flat:active { color: #424242; background-color: #f2f2f2; } .mui-btn--dark.mui-btn--flat[disabled]:hover, .mui-btn--dark.mui-btn--flat[disabled]:focus, .mui-btn--dark.mui-btn--flat[disabled]:active { color: #424242; background-color: transparent; } .mui-btn--danger { color: #FFF; background-color: #F44336; } .mui-btn--danger:hover, .mui-btn--danger:focus, .mui-btn--danger:active { color: #FFF; background-color: #f55a4e; } .mui-btn--danger[disabled]:hover, .mui-btn--danger[disabled]:focus, .mui-btn--danger[disabled]:active { color: #FFF; background-color: #F44336; } .mui-btn--danger.mui-btn--flat { color: #F44336; background-color: transparent; } .mui-btn--danger.mui-btn--flat:hover, .mui-btn--danger.mui-btn--flat:focus, .mui-btn--danger.mui-btn--flat:active { color: #F44336; background-color: #f2f2f2; } .mui-btn--danger.mui-btn--flat[disabled]:hover, .mui-btn--danger.mui-btn--flat[disabled]:focus, .mui-btn--danger.mui-btn--flat[disabled]:active { color: #F44336; background-color: transparent; } .mui-btn--accent { color: #FFF; background-color: #FF4081; } .mui-btn--accent:hover, .mui-btn--accent:focus, .mui-btn--accent:active { color: #FFF; background-color: #ff5a92; } .mui-btn--accent[disabled]:hover, .mui-btn--accent[disabled]:focus, .mui-btn--accent[disabled]:active { color: #FFF; background-color: #FF4081; } .mui-btn--accent.mui-btn--flat { color: #FF4081; background-color: transparent; } .mui-btn--accent.mui-btn--flat:hover, .mui-btn--accent.mui-btn--flat:focus, .mui-btn--accent.mui-btn--flat:active { color: #FF4081; background-color: #f2f2f2; } .mui-btn--accent.mui-btn--flat[disabled]:hover, .mui-btn--accent.mui-btn--flat[disabled]:focus, .mui-btn--accent.mui-btn--flat[disabled]:active { color: #FF4081; background-color: transparent; } .mui-btn--small { height: 30.6px; line-height: 30.6px; padding: 0 16px; font-size: 13px; } .mui-btn--large { height: 54px; line-height: 54px; padding: 0 26px; font-size: 14px; } .mui-btn--fab.mui-btn--small { width: 44px; height: 44px; line-height: 44px; } .mui-btn--fab.mui-btn--large { width: 75px; height: 75px; line-height: 75px; } /** * MUI Checkboxe and Radio Components */ .mui-radio, .mui-checkbox { position: relative; display: block; margin-top: 10px; margin-bottom: 10px; } .mui-radio > label, .mui-checkbox > label { min-height: 20px; padding-left: 20px; margin-bottom: 0; font-weight: normal; cursor: pointer; } .mui-radio > label > input[type="radio"], .mui-radio--inline > label > input[type="radio"], .mui-checkbox > label > input[type="checkbox"], .mui-checkbox--inline > label > input[type="checkbox"] { position: absolute; margin-left: -20px; margin-top: 4px; } .mui-radio + .mui-radio, .mui-checkbox + .mui-checkbox { margin-top: -5px; } .mui-radio--inline, .mui-checkbox--inline { display: inline-block; padding-left: 20px; margin-bottom: 0; vertical-align: middle; font-weight: normal; cursor: pointer; } .mui-radio--inline > input[type="radio"], .mui-radio--inline > input[type="checkbox"], .mui-radio--inline > label > input[type="radio"], .mui-radio--inline > label > input[type="checkbox"], .mui-checkbox--inline > input[type="radio"], .mui-checkbox--inline > input[type="checkbox"], .mui-checkbox--inline > label > input[type="radio"], .mui-checkbox--inline > label > input[type="checkbox"] { margin: 4px 0 0; line-height: normal; } .mui-radio--inline + .mui-radio--inline, .mui-checkbox--inline + .mui-checkbox--inline { margin-top: 0; margin-left: 10px; } /** * MUI Container module */ .mui-container { margin-right: auto; margin-left: auto; padding-left: 15px; padding-right: 15px; } .mui-container:before, .mui-container:after { content: " "; display: table; } .mui-container:after { clear: both; } @media (min-width: 544px) { .mui-container { max-width: 570px; } } @media (min-width: 768px) { .mui-container { max-width: 740px; } } @media (min-width: 992px) { .mui-container { max-width: 960px; } } @media (min-width: 1200px) { .mui-container { max-width: 1170px; } } .mui-container-fluid { margin-right: auto; margin-left: auto; padding-left: 15px; padding-right: 15px; } .mui-container-fluid:before, .mui-container-fluid:after { content: " "; display: table; } .mui-container-fluid:after { clear: both; } /** * MUI Divider Component and CSS Helpers */ .mui-divider { display: block; height: 1px; background-color: rgba(0, 0, 0, 0.12); } .mui--divider-top { border-top: 1px solid rgba(0, 0, 0, 0.12); } .mui--divider-bottom { border-bottom: 1px solid rgba(0, 0, 0, 0.12); } .mui--divider-left { border-left: 1px solid rgba(0, 0, 0, 0.12); } .mui--divider-right { border-right: 1px solid rgba(0, 0, 0, 0.12); } /** * MUI Dropdown module */ .mui-dropdown { display: inline-block; position: relative; } [data-mui-toggle="dropdown"] { animation-duration: 0.0001s; animation-name: mui-node-inserted; outline: 0; } .mui-dropdown__menu { position: absolute; top: 100%; left: 0; display: none; min-width: 160px; padding: 5px 0; margin: 2px 0 0; list-style: none; font-size: 14px; text-align: left; background-color: #FFF; border-radius: 2px; z-index: 1; background-clip: padding-box; } .mui-dropdown__menu.mui--is-open { display: block; } .mui-dropdown__menu > li > a { display: block; padding: 3px 20px; clear: both; font-weight: normal; line-height: 1.429; color: rgba(0, 0, 0, 0.87); white-space: nowrap; } .mui-dropdown__menu > li > a:hover, .mui-dropdown__menu > li > a:focus { text-decoration: none; color: rgba(0, 0, 0, 0.87); background-color: #EEEEEE; } .mui-dropdown__menu > .mui--is-disabled > a, .mui-dropdown__menu > .mui--is-disabled > a:hover, .mui-dropdown__menu > .mui--is-disabled > a:focus { color: #EEEEEE; } .mui-dropdown__menu > .mui--is-disabled > a:hover, .mui-dropdown__menu > .mui--is-disabled > a:focus { text-decoration: none; background-color: transparent; background-image: none; cursor: not-allowed; } .mui-dropdown__menu--right { left: auto; right: 0; } /** * MUI Form Component */ @media (min-width: 544px) { .mui-form--inline > .mui-textfield { display: inline-block; margin-bottom: 0; } .mui-form--inline > .mui-radio, .mui-form--inline > .mui-checkbox { display: inline-block; margin-top: 0; margin-bottom: 0; vertical-align: middle; } .mui-form--inline > .mui-radio > label, .mui-form--inline > .mui-checkbox > label { padding-left: 0; } .mui-form--inline > .mui-radio > label > input[type="radio"], .mui-form--inline > .mui-checkbox > label > input[type="checkbox"] { position: relative; margin-left: 0; } .mui-form--inline > .mui-select { display: inline-block; } .mui-form--inline > .mui-btn { margin-bottom: 0; margin-top: 0; vertical-align: bottom; } } /** * MUI Grid module */ .mui-row { margin-left: -15px; margin-right: -15px; } .mui-row:before, .mui-row:after { content: " "; display: table; } .mui-row:after { clear: both; } .mui-col-xs-1, .mui-col-sm-1, .mui-col-md-1, .mui-col-lg-1, .mui-col-xs-2, .mui-col-sm-2, .mui-col-md-2, .mui-col-lg-2, .mui-col-xs-3, .mui-col-sm-3, .mui-col-md-3, .mui-col-lg-3, .mui-col-xs-4, .mui-col-sm-4, .mui-col-md-4, .mui-col-lg-4, .mui-col-xs-5, .mui-col-sm-5, .mui-col-md-5, .mui-col-lg-5, .mui-col-xs-6, .mui-col-sm-6, .mui-col-md-6, .mui-col-lg-6, .mui-col-xs-7, .mui-col-sm-7, .mui-col-md-7, .mui-col-lg-7, .mui-col-xs-8, .mui-col-sm-8, .mui-col-md-8, .mui-col-lg-8, .mui-col-xs-9, .mui-col-sm-9, .mui-col-md-9, .mui-col-lg-9, .mui-col-xs-10, .mui-col-sm-10, .mui-col-md-10, .mui-col-lg-10, .mui-col-xs-11, .mui-col-sm-11, .mui-col-md-11, .mui-col-lg-11, .mui-col-xs-12, .mui-col-sm-12, .mui-col-md-12, .mui-col-lg-12 { min-height: 1px; padding-left: 15px; padding-right: 15px; } .mui-col-xs-1, .mui-col-xs-2, .mui-col-xs-3, .mui-col-xs-4, .mui-col-xs-5, .mui-col-xs-6, .mui-col-xs-7, .mui-col-xs-8, .mui-col-xs-9, .mui-col-xs-10, .mui-col-xs-11, .mui-col-xs-12 { float: left; } .mui-col-xs-1 { width: 8.33333%; } .mui-col-xs-2 { width: 16.66667%; } .mui-col-xs-3 { width: 25%; } .mui-col-xs-4 { width: 33.33333%; } .mui-col-xs-5 { width: 41.66667%; } .mui-col-xs-6 { width: 50%; } .mui-col-xs-7 { width: 58.33333%; } .mui-col-xs-8 { width: 66.66667%; } .mui-col-xs-9 { width: 75%; } .mui-col-xs-10 { width: 83.33333%; } .mui-col-xs-11 { width: 91.66667%; } .mui-col-xs-12 { width: 100%; } .mui-col-xs-offset-0 { margin-left: 0%; } .mui-col-xs-offset-1 { margin-left: 8.33333%; } .mui-col-xs-offset-2 { margin-left: 16.66667%; } .mui-col-xs-offset-3 { margin-left: 25%; } .mui-col-xs-offset-4 { margin-left: 33.33333%; } .mui-col-xs-offset-5 { margin-left: 41.66667%; } .mui-col-xs-offset-6 { margin-left: 50%; } .mui-col-xs-offset-7 { margin-left: 58.33333%; } .mui-col-xs-offset-8 { margin-left: 66.66667%; } .mui-col-xs-offset-9 { margin-left: 75%; } .mui-col-xs-offset-10 { margin-left: 83.33333%; } .mui-col-xs-offset-11 { margin-left: 91.66667%; } .mui-col-xs-offset-12 { margin-left: 100%; } @media (min-width: 544px) { .mui-col-sm-1, .mui-col-sm-2, .mui-col-sm-3, .mui-col-sm-4, .mui-col-sm-5, .mui-col-sm-6, .mui-col-sm-7, .mui-col-sm-8, .mui-col-sm-9, .mui-col-sm-10, .mui-col-sm-11, .mui-col-sm-12 { float: left; } .mui-col-sm-1 { width: 8.33333%; } .mui-col-sm-2 { width: 16.66667%; } .mui-col-sm-3 { width: 25%; } .mui-col-sm-4 { width: 33.33333%; } .mui-col-sm-5 { width: 41.66667%; } .mui-col-sm-6 { width: 50%; } .mui-col-sm-7 { width: 58.33333%; } .mui-col-sm-8 { width: 66.66667%; } .mui-col-sm-9 { width: 75%; } .mui-col-sm-10 { width: 83.33333%; } .mui-col-sm-11 { width: 91.66667%; } .mui-col-sm-12 { width: 100%; } .mui-col-sm-offset-0 { margin-left: 0%; } .mui-col-sm-offset-1 { margin-left: 8.33333%; } .mui-col-sm-offset-2 { margin-left: 16.66667%; } .mui-col-sm-offset-3 { margin-left: 25%; } .mui-col-sm-offset-4 { margin-left: 33.33333%; } .mui-col-sm-offset-5 { margin-left: 41.66667%; } .mui-col-sm-offset-6 { margin-left: 50%; } .mui-col-sm-offset-7 { margin-left: 58.33333%; } .mui-col-sm-offset-8 { margin-left: 66.66667%; } .mui-col-sm-offset-9 { margin-left: 75%; } .mui-col-sm-offset-10 { margin-left: 83.33333%; } .mui-col-sm-offset-11 { margin-left: 91.66667%; } .mui-col-sm-offset-12 { margin-left: 100%; } } @media (min-width: 768px) { .mui-col-md-1, .mui-col-md-2, .mui-col-md-3, .mui-col-md-4, .mui-col-md-5, .mui-col-md-6, .mui-col-md-7, .mui-col-md-8, .mui-col-md-9, .mui-col-md-10, .mui-col-md-11, .mui-col-md-12 { float: left; } .mui-col-md-1 { width: 8.33333%; } .mui-col-md-2 { width: 16.66667%; } .mui-col-md-3 { width: 25%; } .mui-col-md-4 { width: 33.33333%; } .mui-col-md-5 { width: 41.66667%; } .mui-col-md-6 { width: 50%; } .mui-col-md-7 { width: 58.33333%; } .mui-col-md-8 { width: 66.66667%; } .mui-col-md-9 { width: 75%; } .mui-col-md-10 { width: 83.33333%; } .mui-col-md-11 { width: 91.66667%; } .mui-col-md-12 { width: 100%; } .mui-col-md-offset-0 { margin-left: 0%; } .mui-col-md-offset-1 { margin-left: 8.33333%; } .mui-col-md-offset-2 { margin-left: 16.66667%; } .mui-col-md-offset-3 { margin-left: 25%; } .mui-col-md-offset-4 { margin-left: 33.33333%; } .mui-col-md-offset-5 { margin-left: 41.66667%; } .mui-col-md-offset-6 { margin-left: 50%; } .mui-col-md-offset-7 { margin-left: 58.33333%; } .mui-col-md-offset-8 { margin-left: 66.66667%; } .mui-col-md-offset-9 { margin-left: 75%; } .mui-col-md-offset-10 { margin-left: 83.33333%; } .mui-col-md-offset-11 { margin-left: 91.66667%; } .mui-col-md-offset-12 { margin-left: 100%; } } @media (min-width: 992px) { .mui-col-lg-1, .mui-col-lg-2, .mui-col-lg-3, .mui-col-lg-4, .mui-col-lg-5, .mui-col-lg-6, .mui-col-lg-7, .mui-col-lg-8, .mui-col-lg-9, .mui-col-lg-10, .mui-col-lg-11, .mui-col-lg-12 { float: left; } .mui-col-lg-1 { width: 8.33333%; } .mui-col-lg-2 { width: 16.66667%; } .mui-col-lg-3 { width: 25%; } .mui-col-lg-4 { width: 33.33333%; } .mui-col-lg-5 { width: 41.66667%; } .mui-col-lg-6 { width: 50%; } .mui-col-lg-7 { width: 58.33333%; } .mui-col-lg-8 { width: 66.66667%; } .mui-col-lg-9 { width: 75%; } .mui-col-lg-10 { width: 83.33333%; } .mui-col-lg-11 { width: 91.66667%; } .mui-col-lg-12 { width: 100%; } .mui-col-lg-offset-0 { margin-left: 0%; } .mui-col-lg-offset-1 { margin-left: 8.33333%; } .mui-col-lg-offset-2 { margin-left: 16.66667%; } .mui-col-lg-offset-3 { margin-left: 25%; } .mui-col-lg-offset-4 { margin-left: 33.33333%; } .mui-col-lg-offset-5 { margin-left: 41.66667%; } .mui-col-lg-offset-6 { margin-left: 50%; } .mui-col-lg-offset-7 { margin-left: 58.33333%; } .mui-col-lg-offset-8 { margin-left: 66.66667%; } .mui-col-lg-offset-9 { margin-left: 75%; } .mui-col-lg-offset-10 { margin-left: 83.33333%; } .mui-col-lg-offset-11 { margin-left: 91.66667%; } .mui-col-lg-offset-12 { margin-left: 100%; } } @media (min-width: 1200px) { .mui-col-xl-1, .mui-col-xl-2, .mui-col-xl-3, .mui-col-xl-4, .mui-col-xl-5, .mui-col-xl-6, .mui-col-xl-7, .mui-col-xl-8, .mui-col-xl-9, .mui-col-xl-10, .mui-col-xl-11, .mui-col-xl-12 { float: left; } .mui-col-xl-1 { width: 8.33333%; } .mui-col-xl-2 { width: 16.66667%; } .mui-col-xl-3 { width: 25%; } .mui-col-xl-4 { width: 33.33333%; } .mui-col-xl-5 { width: 41.66667%; } .mui-col-xl-6 { width: 50%; } .mui-col-xl-7 { width: 58.33333%; } .mui-col-xl-8 { width: 66.66667%; } .mui-col-xl-9 { width: 75%; } .mui-col-xl-10 { width: 83.33333%; } .mui-col-xl-11 { width: 91.66667%; } .mui-col-xl-12 { width: 100%; } .mui-col-xl-offset-0 { margin-left: 0%; } .mui-col-xl-offset-1 { margin-left: 8.33333%; } .mui-col-xl-offset-2 { margin-left: 16.66667%; } .mui-col-xl-offset-3 { margin-left: 25%; } .mui-col-xl-offset-4 { margin-left: 33.33333%; } .mui-col-xl-offset-5 { margin-left: 41.66667%; } .mui-col-xl-offset-6 { margin-left: 50%; } .mui-col-xl-offset-7 { margin-left: 58.33333%; } .mui-col-xl-offset-8 { margin-left: 66.66667%; } .mui-col-xl-offset-9 { margin-left: 75%; } .mui-col-xl-offset-10 { margin-left: 83.33333%; } .mui-col-xl-offset-11 { margin-left: 91.66667%; } .mui-col-xl-offset-12 { margin-left: 100%; } } /** * MUI Panel module */ .mui-panel { padding: 15px; margin-bottom: 20px; border-radius: 0; background-color: #FFF; box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.16), 0 0px 2px 0 rgba(0, 0, 0, 0.12); } .mui-panel:before, .mui-panel:after { content: " "; display: table; } .mui-panel:after { clear: both; } @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { .mui-panel { box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, 0.12), -1px 0px 2px 0 rgba(0, 0, 0, 0.12), 0 2px 2px 0 rgba(0, 0, 0, 0.16), 0 0px 2px 0 rgba(0, 0, 0, 0.12); } } /** * MUI Select Component */ .mui-select { display: block; padding-top: 15px; margin-bottom: 20px; position: relative; } .mui-select:focus { outline: 0; } .mui-select:focus > select { height: 33px; margin-bottom: -1px; border-color: #2196F3; border-width: 2px; } .mui-select > select { animation-duration: 0.0001s; animation-name: mui-node-inserted; display: block; height: 32px; width: 100%; appearance: none; -webkit-appearance: none; -moz-appearance: none; outline: none; border: none; border-bottom: 1px solid rgba(0, 0, 0, 0.26); border-radius: 0px; box-shadow: none; background-color: transparent; background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNiIgd2lkdGg9IjEwIj48cG9seWdvbiBwb2ludHM9IjAsMCAxMCwwIDUsNiIgc3R5bGU9ImZpbGw6cmdiYSgwLDAsMCwuMjQpOyIvPjwvc3ZnPg=="); background-repeat: no-repeat; background-position: right center; cursor: pointer; color: rgba(0, 0, 0, 0.87); font-size: 16px; padding: 0 25px 0 0; } .mui-select > select::-ms-expand { display: none; } .mui-select > select:focus { outline: 0; height: 33px; margin-bottom: -1px; border-color: #2196F3; border-width: 2px; } .mui-select > select:disabled { color: rgba(0, 0, 0, 0.38); cursor: not-allowed; background-color: transparent; opacity: 1; } .mui-select > label { position: absolute; top: 0; display: block; width: 100%; color: rgba(0, 0, 0, 0.54); font-size: 12px; font-weight: 400; line-height: 15px; overflow-x: hidden; text-overflow: ellipsis; white-space: nowrap; } .mui-select:focus > label, .mui-select > select:focus ~ label { color: #2196F3; } .mui-select__menu { position: absolute; z-index: 2; min-width: 100%; overflow-y: auto; padding: 8px 0; background-color: #FFF; font-size: 16px; } @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { .mui-select__menu { border-left: 1px solid rgba(0, 0, 0, 0.12); border-top: 1px solid rgba(0, 0, 0, 0.12); } } .mui-select__menu > div { padding: 0 22px; height: 42px; line-height: 42px; cursor: pointer; white-space: nowrap; } .mui-select__menu > div:hover { background-color: #E0E0E0; } .mui-select__menu > div.mui--is-selected { background-color: #EEEEEE; } /** * MUI Table Component */ th { text-align: left; } .mui-table { width: 100%; max-width: 100%; margin-bottom: 20px; } .mui-table > thead > tr > th, .mui-table > thead > tr > td, .mui-table > tbody > tr > th, .mui-table > tbody > tr > td, .mui-table > tfoot > tr > th, .mui-table > tfoot > tr > td { padding: 10px; line-height: 1.429; } .mui-table > thead > tr > th { border-bottom: 2px solid rgba(0, 0, 0, 0.12); font-weight: 700; } .mui-table > tbody + tbody { border-top: 2px solid rgba(0, 0, 0, 0.12); } .mui-table.mui-table--bordered > tbody > tr > td { border-bottom: 1px solid rgba(0, 0, 0, 0.12); } /** * MUI Tabs module */ .mui-tabs__bar { list-style: none; padding-left: 0; margin-bottom: 0; background-color: transparent; white-space: nowrap; overflow-x: auto; } .mui-tabs__bar > li { display: inline-block; } .mui-tabs__bar > li > a { display: block; white-space: nowrap; text-transform: uppercase; font-weight: 500; font-size: 14px; color: rgba(0, 0, 0, 0.87); cursor: default; height: 48px; line-height: 48px; padding-left: 24px; padding-right: 24px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .mui-tabs__bar > li > a:hover { text-decoration: none; } .mui-tabs__bar > li.mui--is-active { border-bottom: 2px solid #2196F3; } .mui-tabs__bar > li.mui--is-active > a { color: #2196F3; } .mui-tabs__bar.mui-tabs__bar--justified { display: table; width: 100%; table-layout: fixed; } .mui-tabs__bar.mui-tabs__bar--justified > li { display: table-cell; } .mui-tabs__bar.mui-tabs__bar--justified > li > a { text-align: center; padding-left: 0px; padding-right: 0px; } .mui-tabs__pane { display: none; } .mui-tabs__pane.mui--is-active { display: block; } [data-mui-toggle="tab"] { animation-duration: 0.0001s; animation-name: mui-node-inserted; } /** * MUI Textfield Component */ .mui-textfield { display: block; padding-top: 15px; margin-bottom: 20px; position: relative; } .mui-textfield > label { position: absolute; top: 0; display: block; width: 100%; color: rgba(0, 0, 0, 0.54); font-size: 12px; font-weight: 400; line-height: 15px; overflow-x: hidden; text-overflow: ellipsis; white-space: nowrap; } .mui-textfield > textarea { padding-top: 5px; } .mui-textfield > input, .mui-textfield > textarea { display: block; } .mui-textfield > input:focus ~ label, .mui-textfield > textarea:focus ~ label { color: #2196F3; } .mui-textfield--float-label > label { position: absolute; transform: translate(0px, 15px); font-size: 16px; line-height: 32px; color: rgba(0, 0, 0, 0.26); text-overflow: clip; cursor: text; pointer-events: none; } .mui-textfield--float-label > input:focus ~ label, .mui-textfield--float-label > textarea:focus ~ label { transform: translate(0px, 0px); font-size: 12px; line-height: 15px; text-overflow: ellipsis; } .mui-textfield--float-label > input:not(:focus).mui--is-not-empty ~ label, .mui-textfield--float-label > input:not(:focus)[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty) ~ label, .mui-textfield--float-label > input:not(:focus):not(:empty):not(.mui--is-empty):not(.mui--is-not-empty) ~ label, .mui-textfield--float-label > textarea:not(:focus).mui--is-not-empty ~ label, .mui-textfield--float-label > textarea:not(:focus)[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty) ~ label, .mui-textfield--float-label > textarea:not(:focus):not(:empty):not(.mui--is-empty):not(.mui--is-not-empty) ~ label { color: rgba(0, 0, 0, 0.54); font-size: 12px; line-height: 15px; transform: translate(0px, 0px); text-overflow: ellipsis; } .mui-textfield--wrap-label { display: table; width: 100%; padding-top: 0px; } .mui-textfield--wrap-label:not(.mui-textfield--float-label) > label { display: table-header-group; position: static; white-space: normal; overflow-x: visible; } .mui-textfield > input, .mui-textfield > textarea { animation-duration: 0.0001s; animation-name: mui-node-inserted; display: block; background-color: transparent; color: rgba(0, 0, 0, 0.87); border: none; border-bottom: 1px solid rgba(0, 0, 0, 0.26); outline: none; width: 100%; font-size: 16px; padding: 0; box-shadow: none; border-radius: 0px; background-image: none; } .mui-textfield > input:focus, .mui-textfield > textarea:focus { border-color: #2196F3; border-width: 2px; } .mui-textfield > input:disabled, .mui-textfield > input:-moz-read-only, .mui-textfield > textarea:disabled, .mui-textfield > textarea:-moz-read-only { cursor: not-allowed; background-color: transparent; opacity: 1; } .mui-textfield > input:disabled, .mui-textfield > input:read-only, .mui-textfield > textarea:disabled, .mui-textfield > textarea:read-only { cursor: not-allowed; background-color: transparent; opacity: 1; } .mui-textfield > input::-webkit-input-placeholder, .mui-textfield > textarea::-webkit-input-placeholder { color: rgba(0, 0, 0, 0.26); opacity: 1; } .mui-textfield > input::-moz-placeholder, .mui-textfield > textarea::-moz-placeholder { color: rgba(0, 0, 0, 0.26); opacity: 1; } .mui-textfield > input:-ms-input-placeholder, .mui-textfield > textarea:-ms-input-placeholder { color: rgba(0, 0, 0, 0.26); opacity: 1; } .mui-textfield > input::placeholder, .mui-textfield > textarea::placeholder { color: rgba(0, 0, 0, 0.26); opacity: 1; } .mui-textfield > input { height: 32px; } .mui-textfield > input:focus { height: 33px; margin-bottom: -1px; } .mui-textfield > textarea { min-height: 64px; } .mui-textfield > textarea[rows]:not([rows="2"]):focus { margin-bottom: -1px; } .mui-textfield > input:focus { height: 33px; margin-bottom: -1px; } .mui-textfield > input:invalid:not(:focus):not(:required), .mui-textfield > input:invalid:not(:focus):required.mui--is-not-empty, .mui-textfield > input:invalid:not(:focus):required.mui--is-empty.mui--is-dirty, .mui-textfield > input:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty), .mui-textfield > input:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty), .mui-textfield > textarea:invalid:not(:focus):not(:required), .mui-textfield > textarea:invalid:not(:focus):required.mui--is-not-empty, .mui-textfield > textarea:invalid:not(:focus):required.mui--is-empty.mui--is-dirty, .mui-textfield > textarea:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty), .mui-textfield > textarea:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty), .mui-textfield > input:not(:focus).mui--is-invalid:not(:required), .mui-textfield > input:not(:focus).mui--is-invalid:required.mui--is-not-empty, .mui-textfield > input:not(:focus).mui--is-invalid:required.mui--is-empty.mui--is-dirty, .mui-textfield > input:not(:focus).mui--is-invalid:required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty), .mui-textfield > input:not(:focus).mui--is-invalid:required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty), .mui-textfield > textarea:not(:focus).mui--is-invalid:not(:required), .mui-textfield > textarea:not(:focus).mui--is-invalid:required.mui--is-not-empty, .mui-textfield > textarea:not(:focus).mui--is-invalid:required.mui--is-empty.mui--is-dirty, .mui-textfield > textarea:not(:focus).mui--is-invalid:required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty), .mui-textfield > textarea:not(:focus).mui--is-invalid:required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty) { border-color: #F44336; border-width: 2px; } .mui-textfield > input:invalid:not(:focus):not(:required), .mui-textfield > input:invalid:not(:focus):required.mui--is-not-empty, .mui-textfield > input:invalid:not(:focus):required.mui--is-empty.mui--is-dirty, .mui-textfield > input:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty), .mui-textfield > input:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty), .mui-textfield > input:not(:focus).mui--is-invalid:not(:required), .mui-textfield > input:not(:focus).mui--is-invalid:required.mui--is-not-empty, .mui-textfield > input:not(:focus).mui--is-invalid:required.mui--is-empty.mui--is-dirty, .mui-textfield > input:not(:focus).mui--is-invalid:required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty), .mui-textfield > input:not(:focus).mui--is-invalid:required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty) { height: 33px; margin-bottom: -1px; } .mui-textfield > input:invalid:not(:focus):not(:required) ~ label, .mui-textfield > input:invalid:not(:focus):required.mui--is-not-empty ~ label, .mui-textfield > input:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty) ~ label, .mui-textfield > input:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty) ~ label, .mui-textfield > textarea:invalid:not(:focus):not(:required) ~ label, .mui-textfield > textarea:invalid:not(:focus):required.mui--is-not-empty ~ label, .mui-textfield > textarea:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty) ~ label, .mui-textfield > textarea:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty) ~ label, .mui-textfield > input:not(:focus).mui--is-invalid:not(:required) ~ label, .mui-textfield > input:not(:focus).mui--is-invalid:required.mui--is-not-empty ~ label, .mui-textfield > input:not(:focus).mui--is-invalid:required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty) ~ label, .mui-textfield > input:not(:focus).mui--is-invalid:required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty) ~ label, .mui-textfield > textarea:not(:focus).mui--is-invalid:not(:required) ~ label, .mui-textfield > textarea:not(:focus).mui--is-invalid:required.mui--is-not-empty ~ label, .mui-textfield > textarea:not(:focus).mui--is-invalid:required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty) ~ label, .mui-textfield > textarea:not(:focus).mui--is-invalid:required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty) ~ label { color: #F44336; } .mui-textfield:not(.mui-textfield--float-label) > input:invalid:not(:focus):required.mui--is-empty.mui--is-dirty ~ label, .mui-textfield:not(.mui-textfield--float-label) > textarea:invalid:not(:focus):required.mui--is-empty.mui--is-dirty ~ label, .mui-textfield:not(.mui-textfield--float-label) > input:not(:focus).mui--is-invalid:required.mui--is-empty.mui--is-dirty ~ label, .mui-textfield:not(.mui-textfield--float-label) > textarea:not(:focus).mui--is-invalid:required.mui--is-empty.mui--is-dirty ~ label { color: #F44336; } /** * MUI Helpers module */ @keyframes mui-node-inserted { from { opacity: 0.99; } to { opacity: 1; } } .mui--no-transition { transition: none !important; } .mui--no-user-select { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .mui-caret { display: inline-block; width: 0; height: 0; margin-left: 2px; vertical-align: middle; border-top: 4px solid; border-right: 4px solid transparent; border-left: 4px solid transparent; } .mui--text-left { text-align: left !important; } .mui--text-right { text-align: right !important; } .mui--text-center { text-align: center !important; } .mui--text-justify { text-align: justify !important; } .mui--text-nowrap { white-space: nowrap !important; } .mui--align-baseline { vertical-align: baseline !important; } .mui--align-top { vertical-align: top !important; } .mui--align-middle { vertical-align: middle !important; } .mui--align-bottom { vertical-align: bottom !important; } .mui--text-dark { color: rgba(0, 0, 0, 0.87); } .mui--text-dark-secondary { color: rgba(0, 0, 0, 0.54); } .mui--text-dark-hint { color: rgba(0, 0, 0, 0.38); } .mui--text-light { color: #FFF; } .mui--text-light-secondary { color: rgba(255, 255, 255, 0.7); } .mui--text-light-hint { color: rgba(255, 255, 255, 0.3); } .mui--text-accent { color: rgba(255, 64, 129, 0.87); } .mui--text-accent-secondary { color: rgba(255, 64, 129, 0.54); } .mui--text-accent-hint { color: rgba(255, 64, 129, 0.38); } .mui--text-black { color: #000; } .mui--text-white { color: #FFF; } .mui--text-danger { color: #F44336; } .mui-list--unstyled { padding-left: 0; list-style: none; } .mui-list--inline { padding-left: 0; list-style: none; margin-left: -5px; } .mui-list--inline > li { display: inline-block; padding-left: 5px; padding-right: 5px; } .mui--z1, .mui-dropdown__menu, .mui-select__menu { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); } .mui--z2 { box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); } .mui--z3 { box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23); } .mui--z4 { box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22); } .mui--z5 { box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.22); } .mui--clearfix:before, .mui--clearfix:after { content: " "; display: table; } .mui--clearfix:after { clear: both; } .mui--pull-right { float: right !important; } .mui--pull-left { float: left !important; } .mui--hide { display: none !important; } .mui--show { display: block !important; } .mui--invisible { visibility: hidden; } .mui--overflow-hidden { overflow: hidden !important; } .mui--overflow-hidden-x { overflow-x: hidden !important; } .mui--overflow-hidden-y { overflow-y: hidden !important; } .mui--visible-xs-block, .mui--visible-xs-inline, .mui--visible-xs-inline-block, .mui--visible-sm-block, .mui--visible-sm-inline, .mui--visible-sm-inline-block, .mui--visible-md-block, .mui--visible-md-inline, .mui--visible-md-inline-block, .mui--visible-lg-block, .mui--visible-lg-inline, .mui--visible-lg-inline-block, .mui--visible-xl-block, .mui--visible-xl-inline, .mui--visible-xl-inline-block { display: none !important; } @media (max-width: 543px) { .mui-visible-xs { display: block !important; } table.mui-visible-xs { display: table; } tr.mui-visible-xs { display: table-row !important; } th.mui-visible-xs, td.mui-visible-xs { display: table-cell !important; } .mui--visible-xs-block { display: block !important; } .mui--visible-xs-inline { display: inline !important; } .mui--visible-xs-inline-block { display: inline-block !important; } } @media (min-width: 544px) and (max-width: 767px) { .mui-visible-sm { display: block !important; } table.mui-visible-sm { display: table; } tr.mui-visible-sm { display: table-row !important; } th.mui-visible-sm, td.mui-visible-sm { display: table-cell !important; } .mui--visible-sm-block { display: block !important; } .mui--visible-sm-inline { display: inline !important; } .mui--visible-sm-inline-block { display: inline-block !important; } } @media (min-width: 768px) and (max-width: 991px) { .mui-visible-md { display: block !important; } table.mui-visible-md { display: table; } tr.mui-visible-md { display: table-row !important; } th.mui-visible-md, td.mui-visible-md { display: table-cell !important; } .mui--visible-md-block { display: block !important; } .mui--visible-md-inline { display: inline !important; } .mui--visible-md-inline-block { display: inline-block !important; } } @media (min-width: 992px) and (max-width: 1199px) { .mui-visible-lg { display: block !important; } table.mui-visible-lg { display: table; } tr.mui-visible-lg { display: table-row !important; } th.mui-visible-lg, td.mui-visible-lg { display: table-cell !important; } .mui--visible-lg-block { display: block !important; } .mui--visible-lg-inline { display: inline !important; } .mui--visible-lg-inline-block { display: inline-block !important; } } @media (min-width: 1200px) { .mui-visible-xl { display: block !important; } table.mui-visible-xl { display: table; } tr.mui-visible-xl { display: table-row !important; } th.mui-visible-xl, td.mui-visible-xl { display: table-cell !important; } .mui--visible-xl-block { display: block !important; } .mui--visible-xl-inline { display: inline !important; } .mui--visible-xl-inline-block { display: inline-block !important; } } @media (max-width: 543px) { .mui--hidden-xs { display: none !important; } } @media (min-width: 544px) and (max-width: 767px) { .mui--hidden-sm { display: none !important; } } @media (min-width: 768px) and (max-width: 991px) { .mui--hidden-md { display: none !important; } } @media (min-width: 992px) and (max-width: 1199px) { .mui--hidden-lg { display: none !important; } } @media (min-width: 1200px) { .mui--hidden-xl { display: none !important; } } body.mui-body--scroll-lock { overflow: hidden !important; } /** * MUI Overlay module */ #mui-overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 99999999; background-color: rgba(0, 0, 0, 0.2); overflow: auto; } /** * MUI Ripple module */ .mui-ripple-effect { position: absolute; border-radius: 50%; pointer-events: none; opacity: 0.4; transform: scale(0.0001); } .mui-ripple-effect.mui--animate-in { opacity: 0; transform: scale(1); transition: transform 0.3s cubic-bezier(0, 0, 0.2, 1), opacity 0.6s cubic-bezier(0, 0, 0.2, 1); } .mui-ripple-effect.mui--active { opacity: 0.3; } .mui-ripple-effect.mui--animate-out { opacity: 0; transition: opacity 0.6s cubic-bezier(0, 0, 0.2, 1); } .mui-btn > .mui-ripple-effect { background-color: #a6a6a6; } .mui-btn--primary > .mui-ripple-effect { background-color: #FFF; } .mui-btn--dark > .mui-ripple-effect { background-color: #FFF; } .mui-btn--danger > .mui-ripple-effect { background-color: #FFF; } .mui-btn--accent > .mui-ripple-effect { background-color: #FFF; } .mui-btn--flat > .mui-ripple-effect { background-color: #a6a6a6; } /** * MUI Typography module */ .mui--text-display4 { font-weight: 300; font-size: 112px; line-height: 112px; } .mui--text-display3 { font-weight: 400; font-size: 56px; line-height: 56px; } .mui--text-display2 { font-weight: 400; font-size: 45px; line-height: 48px; } .mui--text-display1, h1 { font-weight: 400; font-size: 34px; line-height: 40px; } .mui--text-headline, h2 { font-weight: 400; font-size: 24px; line-height: 32px; } .mui--text-title, h3 { font-weight: 400; font-size: 20px; line-height: 28px; } .mui--text-subhead, h4 { font-weight: 400; font-size: 16px; line-height: 24px; } .mui--text-body2, h5 { font-weight: 500; font-size: 14px; line-height: 24px; } .mui--text-body1 { font-weight: 400; font-size: 14px; line-height: 20px; } .mui--text-caption { font-weight: 400; font-size: 12px; line-height: 16px; } .mui--text-menu { font-weight: 500; font-size: 13px; line-height: 17px; } .mui--text-button { font-weight: 500; font-size: 14px; line-height: 18px; text-transform: uppercase; }
seogi1004/cdnjs
ajax/libs/muicss/0.6.5/css/mui.css
CSS
mit
52,684
(function(e){e.on("AddEditor",function(e){e.editor.settings.inline_styles=!1}),e.PluginManager.add("legacyoutput",function(t){t.on("init",function(){var n="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",r=e.explode(t.settings.font_size_style_values),i=t.schema;t.formatter.register({alignleft:{selector:n,attributes:{align:"left"}},aligncenter:{selector:n,attributes:{align:"center"}},alignright:{selector:n,attributes:{align:"right"}},alignjustify:{selector:n,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:!0}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:!0}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(t){return e.inArray(r,t.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}}),e.each("b,i,u,strike".split(","),function(e){i.addValidElements(e+"[*]")}),i.getElementRule("font")||i.addValidElements("font[face|size|color|style]"),e.each(n.split(","),function(e){var t=i.getElementRule(e);t&&(t.attributes.align||(t.attributes.align={},t.attributesOrder.push("align")))})})})})(tinymce);
RunOpenCode/diem-extended
dmCorePlugin/web/lib/tinymce/plugins/legacyoutput/plugin.js
JavaScript
mit
1,480
/* * The MIT License * * Copyright (c) 2010, CloudBees, Inc. * * 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 hudson.util.jna; import com.sun.jna.Native; import com.sun.jna.win32.StdCallLibrary; /** * @author Kohsuke Kawaguchi */ public interface Shell32 extends StdCallLibrary { Shell32 INSTANCE = (Shell32) Native.loadLibrary("shell32", Shell32.class); /** * @return true if successful. Otherwise false. */ boolean ShellExecuteEx(SHELLEXECUTEINFO lpExecInfo); }
luoqii/jenkins
core/src/main/java/hudson/util/jna/Shell32.java
Java
mit
1,532
/* Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add("hiddenfield",function(d){return{title:d.lang.forms.hidden.title,hiddenField:null,minWidth:350,minHeight:110,onShow:function(){delete this.hiddenField;var a=this.getParentEditor(),b=a.getSelection(),c=b.getSelectedElement();c&&(c.data("cke-real-element-type")&&"hiddenfield"==c.data("cke-real-element-type"))&&(this.hiddenField=c,c=a.restoreRealElement(this.hiddenField),this.setupContent(c),b.selectElement(this.hiddenField))},onOk:function(){var a=this.getValueOf("info","_cke_saved_name"); this.getValueOf("info","value");var b=this.getParentEditor(),a=CKEDITOR.env.ie&&!(8<=CKEDITOR.document.$.documentMode)?b.document.createElement('<input name="'+CKEDITOR.tools.htmlEncode(a)+'">'):b.document.createElement("input");a.setAttribute("type","hidden");this.commitContent(a);a=b.createFakeElement(a,"cke_hidden","hiddenfield");this.hiddenField?(a.replace(this.hiddenField),b.getSelection().selectElement(a)):b.insertElement(a);return!0},contents:[{id:"info",label:d.lang.forms.hidden.title,title:d.lang.forms.hidden.title, elements:[{id:"_cke_saved_name",type:"text",label:d.lang.forms.hidden.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){this.getValue()?a.setAttribute("name",this.getValue()):a.removeAttribute("name")}},{id:"value",type:"text",label:d.lang.forms.hidden.value,"default":"",accessKey:"V",setup:function(a){this.setValue(a.getAttribute("value")||"")},commit:function(a){this.getValue()?a.setAttribute("value",this.getValue()): a.removeAttribute("value")}}]}]}});
barisaydinoglu/jsdelivr
files/ckeditor/4.1.2/plugins/forms/dialogs/hiddenfield.js
JavaScript
mit
1,741
!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={};e.generate=function(e){function f(a,b){if(!(a in e))throw Error(b)}function g(a,b){var c,d,f,g=e;for(c=0;c<a.length;c++){if("object"==typeof g&&!(a[c]in g))return b;if(d=c===a.length-1,f=g[a[c]],!d&&"object"!=typeof f||d&&"object"!=typeof b&&"object"==typeof f)return b;g=f}return g}function h(a){return"url("+document.URL.split("#")[0]+"#"+a+")"}function i(){Ph.attr("transform",Ah.main),Ph.select("."+Ie.axisX).attr("transform",Ah.x),Ph.select("."+Ie.axisY).attr("transform",Ah.y),Ph.select("."+Ie.axisY2).attr("transform",Ah.y2),Ph.select("."+Ie.chartArcs).attr("transform",Ah.arc)}function j(){Zf&&(Qh.attr("transform",Ah.context),Qh.select("."+Ie.axisX).attr("transform",Ah.subx))}function k(a){var b=a!==!1?250:0;ag&&Rh.transition().duration(b).attr("transform",Ah.legend)}function l(a){i(a),j(a),k(a)}function m(){_e=p(),af=q(),bf=O(),cf=N(),Ue={top:eg?u("y2"):Hh,right:s(),bottom:u(eg?"y":"x")+(eg?0:$f)+(Bh?0:bf),left:(eg?$f+Gh:0)+r()},Xe=_e-Ue.left-Ue.right,Ze=af-Ue.top-Ue.bottom,0>Xe&&(Xe=0),0>Ze&&(Ze=0),Ve={top:eg?Ue.top:af-$f-(Bh?0:bf),right:0/0,bottom:20+(Bh?0:bf),left:eg?Fh:Ue.left},Ye=eg?Ue.left-Fh-Gh:Xe,$e=eg?Ze:af-Ve.top-Ve.bottom,0>Ye&&(Ye=0),0>$e&&($e=0),We={top:Bh?0:af-bf,right:0/0,bottom:0,left:Bh?_e-cf:0},n(),Bh&&vd(De.data.targets)&&(We.left=Xe/2+ef)}function n(){ef=Ze/2,df=.95*ef,ff=ud(De.data.targets)?.6*df:0}function o(){var a=eg?Ie.axisX:Ie.axisY,b=Ce.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ce.select(Je).node().getBoundingClientRect(),e=c.right-d.left-r();return e>0?e:0}function p(){return Ke?Ke:v()}function q(){var a=Le?Le:w();return a>0?a:320}function r(){return vd(De.data.targets)?0:Me?Me:eg||!pg||ug?1:t("y")}function s(){var a=1;return vd(De.data.targets)?0:Ne?Ne:Bh?cf+(yg&&!eg?t("y2"):a):yg?Dg||eg?a:t("y2"):a}function t(a){var b=db(a);return b.isInner?20+wb(a):40+wb(a)}function u(a){return"y"!==a||pg?"y2"!==a||yg?(db(a).isInner?30:40)+("y2"===a?-10:0):Hh:ag&&!Bh?10:1}function v(){return+Ce.select(Je).style("width").replace("px","")}function w(){return+Ce.select(Je).style("height").replace("px","")}function x(a){return a?-5:-(Ue.left-1)}function y(a){return a?-20:-1}function z(){return x(!eg)}function A(){return y(!eg)}function B(){return x(eg)}function C(){return y(eg)}function D(a){return a?Xe+2+4:Ue.left+20}function E(a){return a?80:Ze+2}function F(){return D(!eg)}function G(){return E(!eg)}function H(){return D(eg)}function I(){return E(eg)}function J(){var a=eg?Ze:Xe,b=mc(),c=Rb()*(rd(De.data.targets)?(b-(ph?.25:1))/b:.98);return b>1?a*c/(b-1):a}function K(a){Ch=a}function L(a){Dh=a}function M(a){Eh=a}function N(){return ag?Bh?Dh*(Ch+1):_e:0}function O(){return ag?Bh?af:Eh*(Ch+1):0}function P(){var a,b,c=!tf;lf=eg?1:0,mf=eg?Ze:Xe,nf=eg?0:Ze,of=eg?Xe:1,pf=lf,qf=mf,rf=eg?0:$e,sf=eg?Ye:1,tf=R(lf,mf,c?void 0:tf.domain(),function(){return zf.tickOffset()}),uf=S(nf,of),vf=S(nf,of),wf=R(lf,mf,Uh,function(a){return a%1?0:Cf.tickOffset()}),xf=S(rf,sf),yf=S(rf,sf),a=Y(),b=Z(),zf=V(tf,wh,a,b),Cf=V(wf,zh,a,b),Af=W(uf,xh,vg,xg),Bf=W(vf,yh,Eg,Gg),c||(Ih.scale(wf),Oe&&Mh.scale(tf)),Q()}function Q(){gf=zb(),hf=Ab(),jf=Ab(.98)}function R(a,b,e,f){var g=(oh?Ce.time.scale():Ce.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ph){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function S(a,b){return Ce.scale.linear().range([a,b])}function T(a){return"y2"===X(a)?vf:uf}function U(a){return"y2"===X(a)?yf:xf}function V(a,b,c,d){var e=(ph?xb():Ce.svg.axis()).scale(a).orient(b);return e.tickFormat(c).ticks(d),ph?e.tickCentered(hg):e.tickOffset=function(){var a=eg?Ze:Xe;return a*Rb()/mc()/2},ph&&e.categories(gg),e}function W(a,b,c,d){return Ce.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function X(a){return a in Jf?Jf[a]:"y"}function Y(){var a=oh?vh:ph?vc:null;return ig&&("function"==typeof ig?a=ig:oh&&(a=function(a){return Ce.time.format(ig)(a)})),a}function Z(){var a=mc();return jg&&a>kg?kg:a}function $(a){return"string"==typeof a?a:a?a.text:null}function _(a,b){var c=a&&"object"==typeof a&&a.position?a.position:b;return{isInner:c.indexOf("inner")>=0,isOuter:c.indexOf("outer")>=0,isLeft:c.indexOf("left")>=0,isCenter:c.indexOf("center")>=0,isRight:c.indexOf("right")>=0,isTop:c.indexOf("top")>=0,isMiddle:c.indexOf("middle")>=0,isBottom:c.indexOf("bottom")>=0}}function ab(){return _(og,eg?"inner-top":"inner-right")}function bb(){return _(tg,eg?"inner-right":"inner-top")}function cb(){return _(Cg,eg?"inner-right":"inner-top")}function db(a){return"y2"===a?cb():"y"===a?bb():ab()}function eb(){return $(og)}function fb(){return $(tg)}function gb(){return $(Cg)}function hb(a,b){return a?b.isLeft?0:b.isCenter?Xe/2:Xe:b.isBottom?-Ze:b.isMiddle?-Ze/2:0}function ib(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function jb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function kb(){return hb(!eg,ab())}function lb(){return hb(eg,bb())}function mb(){return hb(eg,cb())}function nb(){return ib(!eg,ab())}function ob(){return ib(eg,bb())}function pb(){return ib(eg,cb())}function qb(){var a=ab();return eg?a.isInner?"1.2em":-30-wb("x"):a.isInner?"-0.5em":"3em"}function rb(){var a=bb();return eg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-wb("y")}function sb(){var a=cb();return eg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+wb("y2")}function tb(){return jb(!eg,ab())}function ub(){return jb(eg,bb())}function vb(){return jb(eg,cb())}function wb(a){var b=0,c="x"===a?Ie.axisX:"y"===a?Ie.axisY:Ie.axisY2;return Ce.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();b<a.width&&(b=a.width)}),b}function xb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c<a[1];c++)b.push(c);return b.length>0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a<s.length?s[a]:a}function g(a){var b=f(a);return q?q(b):b}function h(f){f.each(function(){var f,h,o=Ce.select(this),q=d(i.domain()),r=o.selectAll(".tick.major").data(q,String),s=r.enter().insert("g","path").attr("class","tick major").style("opacity",1e-6),t=Ce.transition(r.exit()).style("opacity",1e-6).remove(),u=Ce.transition(r).style("opacity",1),v=i.rangeExtent?i.rangeExtent():c(i.range()),w=o.selectAll(".domain").data([0]);w.enter().append("path").attr("class","domain");var x=Ce.transition(w),y=i.copy(),z=this.__chart__||y;this.__chart__=y,s.append("line"),s.append("text");var A=s.select("line"),B=u.select("line"),C=r.select("text"),D=s.select("text"),E=u.select("text");switch(p=(y(1)-y(0))/2,h=n?0:p,j){case"bottom":f=a,A.attr("y2",k),D.attr("y",Math.max(k,0)+m),B.attr("x1",h).attr("x2",h).attr("y2",k),E.attr("x",0).attr("y",Math.max(k,0)+m),C.attr("dy",".71em").style("text-anchor","middle"),C.text(function(a){return e(q,a)?g(a):""}),x.attr("d","M"+v[0]+","+l+"V0H"+v[1]+"V"+l);break;case"left":f=b,A.attr("x2",-k),D.attr("x",-(Math.max(k,0)+m)),B.attr("x2",-k).attr("y2",0),E.attr("x",-(Math.max(k,0)+m)).attr("y",p),C.attr("dy",".32em").style("text-anchor","end"),C.text(function(a){return e(q,a)?g(a):""}),x.attr("d","M"+-l+","+v[0]+"H0V"+v[1]+"H"+-l)}if(i.ticks)s.call(f,z),u.call(f,y),t.call(f,y);else{var F=y.rangeBand()/2,G=function(a){return y(a)+F};s.call(f,G),u.call(f,G)}})}var i=Ce.scale.linear(),j="bottom",k=6,l=6,m=3,n=!1,o=10,p=0,q=null,r=!0,s=[];return h.scale=function(a){return arguments.length?(i=a,h):i},h.orient=function(a){return arguments.length?(j=a in{top:1,right:1,bottom:1,left:1}?a+"":"bottom",h):j},h.categories=function(a){return arguments.length?(s=a,h):s},h.tickCentered=function(a){return arguments.length?(n=a,h):n},h.tickFormat=function(a){return arguments.length?(q=a,h):q},h.tickOffset=function(){return p},h.ticks=function(a){return arguments.length?(o=a,h):o},h.tickCulling=function(a){return arguments.length?(r=a,h):r},h}function yb(a){var b=!1;return kf(De.data.targets).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function zb(){var a=Ce.svg.arc().outerRadius(df).innerRadius(ff),b=function(b,c){var d;return c?a(b):(d=yb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Ab(a){var b=Ce.svg.arc().outerRadius(ef*(a?a:1)).innerRadius(ff);return function(a){var c=yb(a);return c?b(c):"M 0 0"}}function Bb(a,b){return Cd(a.data)?gf(a,b):"M 0 0"}function Cb(a){var b,c,d,e,f=yb(a),g="";return f&&(b=gf.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*df*.8+","+d/e*df*.8+")"),g}function Db(a){return(a.endAngle-a.startAngle)/(2*Math.PI)}function Eb(a){return fc({id:a.data.id,value:a.value,ratio:Db(a)})}function Fb(a){var b,c;return Ib()?(b=Db(a),c=Jb(),c?c(a.value,b):Xc(a.v,b)):""}function Gb(a,b){var c=Nh.selectAll("."+Ie.chartArc+Lc(a)),d=Nh.selectAll("."+Ie.arc).filter(function(b){return b.data.id!==a});c.selectAll("path").transition().duration(50).attr("d",hf).transition().duration(100).attr("d",jf).each(function(a){Bd(a.data)}),b||d.style("opacity",.3)}function Hb(a){var b=Nh.selectAll("."+Ie.chartArc+Lc(a));b.selectAll("path").transition().duration(50).attr("d",gf),Nh.selectAll("."+Ie.arc).style("opacity",1)}function Ib(){return ud(De.data.targets)?$g:Vg}function Jb(){return ud(De.data.targets)?_g:Wg}function Kb(){return ud(De.data.targets)?ah:""}function Lb(){var a=ud(De.data.targets)?bh:Xg;return"function"==typeof a?a:function(){}}function Mb(){var a=ud(De.data.targets)?ch:Yg;return"function"==typeof a?a:function(){}}function Nb(){var a=ud(De.data.targets)?dh:Zg;return"function"==typeof a?a:function(){}}function Ob(a){var b,c,d,e,f,g=rc(a);if(If.length>0)for(f=tc(a),b=0;b<If.length;b++)for(d=If[b][0],f&&g[d]&&g[d].forEach(function(a,b){g[d][b]=0>a?a:0}),c=1;c<If[b].length;c++)e=If[b][c],g[e]&&g[e].forEach(function(a,b){X(e)!==X(d)||!g[d]||f&&+a>0||(g[d][b]+=+a)});return Ce.min(Object.keys(g).map(function(a){return Ce.min(g[a])}))}function Pb(a){var b,c,d,e,f,g=rc(a);if(If.length>0)for(f=uc(a),b=0;b<If.length;b++)for(d=If[b][0],f&&g[d]&&g[d].forEach(function(a,b){g[d][b]=a>0?a:0}),c=1;c<If[b].length;c++)e=If[b][c],g[e]&&g[e].forEach(function(a,b){X(e)!==X(d)||!g[d]||f&&0>+a||(g[d][b]+=+a)});return Ce.max(Object.keys(g).map(function(a){return Ce.max(g[a])}))}function Qb(a){var c,d,e,f,g,h,i,j,k=qc(function(b){return X(b.id)===a}),l="y2"===a?Ag:rg,m="y2"===a?zg:qg,n=b(l)?l:Ob(k),o=b(m)?m:Pb(k),p="y2"===a?Bg:sg,q=Qc()&&eg;return n===o&&(0>n?o=0:n=0),c=Math.abs(o-n),d=e=f=q?0:.1*c,p&&(g=Math.max(Math.abs(n),Math.abs(o)),o=g-p,n=p-g),"y"===a&&wg&&(e=b(wg.top)?wg.top:d,f=b(wg.bottom)?wg.bottom:d),"y2"===a&&Fg&&(e=b(Fg.top)?Fg.top:d,f=b(Fg.bottom)?Fg.bottom:d),q&&(h=Rc(n,o),i=Wb(uf.range()),j=[h[0]/i,h[1]/i],e+=c*(j[1]/(1-j[0]-j[1])),f+=c*(j[0]/(1-j[0]-j[1]))),rd(k)&&!tc(k)&&(f=n),[n-f,o+e]}function Rb(a){var b=Wb(Uh),c=Wb(tf.domain());return a||0===c?1:b/c}function Sb(a){return mg?mg:Ce.min(a,function(a){return Ce.min(a.values,function(a){return a.x})})}function Tb(a){return lg?lg:Ce.max(a,function(a){return Ce.max(a.values,function(a){return a.x})})}function Ub(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ph?d=0:rd(a)?(c=mc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Vb(a){var b=[Sb(a),Tb(a)],c=b[0],d=b[1],e=Ub(a,b),f=oh?new Date(c.getTime()-e):c-e,g=oh?new Date(d.getTime()+e):d+e;return[f,g]}function Wb(a){return a[1]-a[0]}function Xb(a){for(var b=0;b<a.length;b++)if(!(a[b]in Ee))return!1;return!0}function Yb(a,b){Ee[a]=jc(b)}function Zb(a){for(var b=[],c=0;c<a.length;c++)a[c]in Ee&&b.push(jc(Ee[a[c]]));return b}function $b(a){return"start"in a?tf(oh?Hd(a.start):a.start):0}function _b(a){var b=$b(a),c="end"in a?tf(oh?Hd(a.end):a.end):Xe,d=c-b;return 0>d?0:d}function ac(a){return Df&&a===Df||Ld(Ef)&&Md(Ef,a)}function bc(a){return!ac(a)}function cc(a){return Df?Df:Ld(Ef)?Ef[a]:null}function dc(a,b){return a in De.data.x&&De.data.x[a]&&De.data.x[a][b]?De.data.x[a][b]:b}function ec(a){Object.keys(a).forEach(function(b){Ef[b]=a[b]})}function fc(a){var b;return a&&(b=Hf[a.id],a.name=b?b:a.id),a}function gc(a){var b,c,d=a[0],e={},f=[];for(b=1;b<a.length;b++){for(e={},c=0;c<a[b].length;c++)e[d[c]]=a[b][c];f.push(e)}return f}function hc(a){var b,d,e,f=[];for(b=0;b<a.length;b++)for(e=a[b][0],d=1;d<a[b].length;d++)c(f[d-1])&&(f[d-1]={}),f[d-1][e]=a[b][d];return f}function ic(a){var b,c=Ce.keys(a[0]).filter(bc),d=Ce.keys(a[0]).filter(ac);if(oh&&0===d.length)throw new Error('data.x or data.xs must be specified when axis.x.type == "timeseries"');return qh&&c.forEach(function(b){var c=cc(b);De.data.x[b]=d.indexOf(c)>=0?a.map(function(a){return a[c]}):De.data.x[Object.keys(De.data.x)[0]]}),b=c.map(function(b,c){var d=Gf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f,g=cc(b);return oh?f=a[g]instanceof Date?a[g]:Hd(a[g]):qh&&!ph?f=a[g]?+a[g]:dc(b,e):qh&&ph?(f=e,0===c&&a[g]&&(0===e&&(gg=[]),gg.push(a[g]))):f=e,a.x=f,{x:f,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}})}}),b.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Kf&&pd(oc(b).filter(function(a){return!(a in Lf)}),Kf),b.forEach(function(a){Yb(a.id_org,a)}),b}function jc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function kc(a){return a>0&&De.data.targets[0].values[a-1]?De.data.targets[0].values[a-1].x:void 0}function lc(a){return a<mc()-1?De.data.targets[0].values[a+1].x:void 0}function mc(){return Ce.max(De.data.targets,function(a){return a.values.length})}function nc(){var a,b=De.data.targets.length,c=0;return b>1?De.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?De.data.targets[0]:null,a}function oc(a){return a=c(a)?De.data.targets:a,a.map(function(a){return a.id})}function pc(a){var b,c=oc();for(b=0;b<c.length;b++)if(c[b]===a)return!0;return!1}function qc(a){return d(a)?De.data.targets.filter(a):De.data.targets}function rc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function sc(a,b){var c,d,e,f=Object.keys(a);for(c=0;c<f.length;c++)for(e=a[f[c]].values,d=0;d<e.length;d++)if(b(e[d].value))return!0;return!1}function tc(a){return sc(a,function(a){return 0>a})}function uc(a){return sc(a,function(a){return a>0})}function vc(a){return a<gg.length?gg[a]:a}function wc(a,b){return" "+a+" "+a+Kc(b)}function xc(a){return wc(Ie.text,a.id)}function yc(a){return wc(Ie.texts,a.id)}function zc(a,b){return wc(Ie.shape,b)}function Ac(a){return wc(Ie.shapes,a.id)}function Bc(a){return Ac(a)+wc(Ie.line,a.id)}function Cc(a,b){return zc(a,b)+wc(Ie.circle,b)}function Dc(a){return Ac(a)+wc(Ie.circles,a.id)}function Ec(a,b){return zc(a,b)+wc(Ie.bar,b)}function Fc(a){return Ac(a)+wc(Ie.bars,a.id)}function Gc(a){return Ac(a.data)+wc(Ie.arc,a.data.id)}function Hc(a){return Ac(a)+wc(Ie.area,a.id)}function Ic(a,b){return wc(Ie.region,b)+" "+("class"in a?a.class:"")}function Jc(a,b){return wc(Ie.eventRect,b)}function Kc(a){return a||0===a?"-"+(a.replace?a.replace(/([^a-zA-Z0-9-_])/g,"-"):a):""}function Lc(a){return"."+Ie.target+Kc(a)}function Mc(a){return Wh[a.id]?1:0}function Nc(a){var b=Pc(a);return Mc(a)*b}function Oc(a){return b(a.value)?zd(a)?.5:1:0}function Pc(a){return Qc(a)?1:0}function Qc(a){var b=a?a.id:null;return"boolean"==typeof Mf&&Mf?!0:"boolean"===Mf[b]&&Mf[b]?!0:Mf[b]&&Mf[b].show?!0:!1}function Rc(a,b){var c=[],d=1.3;return Ce.select("svg").selectAll(".dummy").data([a,b]).enter().append("text").text(function(a){return a}).each(function(a,b){var e=this.getBBox();c[b]=e.width*d}).remove(),c}function Sc(a){return a?tf(a.x):null}function Tc(a){return tf(oh?Hd(a.value):a.value)}function Uc(a){return uf(a.value)}function Vc(a){return wf(a.x)}function Wc(a){var b=vg?vg:function(a){return+a};return b(a)}function Xc(a,b){return(100*b).toFixed(1)+"%"}function Yc(a,b){var c,d=a[b].x,e=[];for(c=b-1;c>=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c<a.length&&d===a[c].x;c++)e.push(a[c]);return e}function Zc(a,b,c,d){var e,f=c?c:0,g=d?d:a.length-1,h=Math.floor((g-f)/2)+f,i=a[h],j=tf(i.x)-b[0];return j>0?g=h:f=h,g-f===1?(e=[],a[f].x&&(e=e.concat(Yc(a,f))),a[g].x&&(e=e.concat(Yc(a,g))),_c(e,b)):Zc(a,b,f,g)}function $c(a,b){var c;return c=a.map(function(a){return Zc(a.values,b)}),_c(c,b)}function _c(a,b){var c,d;return a.forEach(function(a){var e=Nd(a,b);(c>e||!c)&&(c=e,d=a)}),d}function ad(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function bd(){return Nf&&"desc"===Nf.toLowerCase()}function cd(){return Nf&&"asc"===Nf.toLowerCase()}function dd(a){var b=cd(),c=bd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Nf&&a.sort(Nf),a}function ed(a,c){var d,e,f,g,h,i,j,k=vd(De.data.targets),l=k?Xc:Wc,m=a.filter(function(a){return a&&b(a.value)});fh&&0!==m.length&&(Sh.html(ih(a,Y(),l,uh)).style("display","block"),d=Sh.property("offsetWidth"),e=Sh.property("offsetHeight"),k?(g=Xe/2+c[0],i=Ze/2+c[1]+20):(eg?(f=o(),g=f+c[0]+100,h=g+d,j=p()-s(),i=tf(m[0].x)+20):(f=o(),g=f+r()+tf(m[0].x)+20,h=g+d,j=f+p()-s(),i=c[1]+15),h>j&&(g-=d+60),i+e>q()&&(i-=e+30)),Sh.style("top",i+"px").style("left",g+"px"))}function fd(){Sh.style("display","none")}function gd(a){var c=a.filter(function(a){return a&&b(a.value)});fh&&(sd(De.data.targets)||vd(De.data.targets)||Ph.selectAll("line."+Ie.xgridFocus).style("visibility","visible").data([c[0]]).attr(eg?"y1":"x1",Sc).attr(eg?"y2":"x2",Sc))}function hd(){Ph.select("line."+Ie.xgridFocus).style("visibility","hidden")}function id(a){return a.x||0===a.x?tf(a.x):null}function jd(a){return T(a.id)(a.value)}function kd(){var a,b,d={},e=0;return qc(yd).forEach(function(f){for(a=0;a<If.length;a++)if(!(If[a].indexOf(f.id)<0))for(b=0;b<If[a].length;b++)if(If[a][b]in d){d[f.id]=d[If[a][b]];break}c(d[f.id])&&(d[f.id]=e++)}),d.__max__=e-1,d}function ld(a,b,c,d){var e=d?wf:tf;return function(d){var f=d.id in c?c[d.id]:0;return d.x||0===d.x?e(d.x)-a*(b/2-f):0}}function md(a){return function(b){var c=a?U(b.id):T(b.id);return c(b.value)}}function nd(a,b){var c=dd(qc(yd)),d=c.map(function(a){return a.id});return function(e,f){var g=b?U(e.id):T(e.id),h=g(0),i=h;return c.forEach(function(b){b.id!==e.id&&a[b.id]===a[e.id]&&d.indexOf(b.id)<d.indexOf(e.id)&&b.values[f].value*e.value>0&&(i+=g(b.values[f].value)-h)}),i}}function od(a,b){return Tg?Tg:b?2*a.tickOffset()*Ug/b:0}function pd(a,b){var d=c(a)?oc():a;"string"==typeof d&&(d=[d]);for(var e=0;e<d.length;e++)Wh[d[e]]=b===Lf[d[e]],Lf[d[e]]=b}function qd(a,b){var c=!1;return a.forEach(function(a){Lf[a.id]===b&&(c=!0),a.id in Lf||"line"!==b||(c=!0)}),c}function rd(a){return qd(a,"bar")}function sd(a){return qd(a,"scatter")}function td(a){return qd(a,"pie")}function ud(a){return qd(a,"donut")}function vd(a){return td(a)||ud(a)}function wd(a){var b="string"==typeof a?a:a.id;return!(b in Lf)||"line"===Lf[b]||"spline"===Lf[b]||"area"===Lf[b]||"area-spline"===Lf[b]}function xd(a){var b="string"==typeof a?a:a.id;return"spline"===Lf[b]||"area-spline"===Lf[b]}function yd(a){var b="string"==typeof a?a:a.id;return"bar"===Lf[b]}function zd(a){var b="string"==typeof a?a:a.id;return"scatter"===Lf[b]}function Ad(a){var b="string"==typeof a?a:a.id;return"pie"===Lf[b]}function Bd(a){var b="string"==typeof a?a:a.id;return"donut"===Lf[b]}function Cd(a){return Ad(a)||Bd(a)}function Dd(a){return yd(a)?a.values:[]}function Ed(a){return wd(a)||zd(a)?a.values:[]}function Fd(a){return yd(a)||wd(a)?a.values:[]}function Gd(a,b){var c=[],d=a,e=Ld(b)?b:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];return function(b){return b in d?a[b]:(-1===c.indexOf(b)&&c.push(b),e[c.indexOf(b)%e.length])}}function Hd(a){var b;if(!a)throw Error(a+" can not be parsed as d3.time with format "+Ff+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");if(b=Ff?Ce.time.format(Ff).parse(a):new Date(a),!b)throw Error("Failed to parse '"+a+"' with format "+Ff);return b}function Id(a,b){var c=Ce.mouse(a),d=Ce.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))<b}function Jd(a){var b=Ce.mouse(a),c=a.getBBox(),d=c.x,e=c.y,f=c.width,g=c.height,h=2,i=d-h,j=d+f+h,k=e+g+h,l=e-h;return i<b[0]&&b[0]<j&&l<b[1]&&b[1]<k}function Kd(a,b){var c;for(c=0;c<b.length;c++)if(b[c].start<a&&a<=b[c].end)return!0;return!1}function Ld(a){return Object.keys(a).length>0}function Md(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Nd(a,b){return Math.pow(tf(a.x)-b[0],2)+Math.pow(uf(a.value)-b[1],2)}function Od(a,b,c){Vf(b,a.node()),Ph.select("."+Ie.selectedCircles+Kc(b.id)).selectAll("."+Ie.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return wc(Ie.selectedCircle,c)}).attr("cx",eg?jd:id).attr("cy",eg?id:jd).attr("stroke",function(){return uh(b.id)}).attr("r",1.4*Sg).transition().duration(100).attr("r",Sg)}function Pd(a,b,c){Wf(b,a.node()),Ph.select("."+Ie.selectedCircles+Kc(b.id)).selectAll("."+Ie.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Qd(a,b,c,d){a?Od(b,c,d):Pd(b,c,d)}function Rd(a,b){Vf(b,a.node()),a.transition().duration(100).style("fill",function(){return Ce.rgb(uh(b.id)).darker(1)})}function Sd(a,b){Wf(b,a.node()),a.transition().duration(100).style("fill",function(){return uh(b.id)})}function Td(a,b,c,d){a?Rd(b,c,d):Sd(b,c,d)}function Ud(a){return a.filter(function(a){return b(a.value)})}function Vd(a,c){return(c?Ph.selectAll("."+Ie.circles+Kc(c)):Ph).selectAll("."+Ie.circle+(b(a)?"-"+a:""))}function Wd(a,b){Vd(a,b).classed(Fe,!0).attr("r",Rg)}function Xd(a){Vd(a).filter(function(){return Ce.select(this).classed(Fe)}).classed(Fe,!1).attr("r",Og)}function Yd(a){return Ph.selectAll("."+Ie.bar+(b(a)?"-"+a:""))}function Zd(a){Yd(a).classed(Fe,!0)}function $d(a){Yd(a).classed(Fe,!1)}function _d(a,b){var c=de(a,b);return function(a,b){var d=c(a,b),e=eg?1:0,f=eg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function ae(a,b){var c=de(a,!1),d=b?be:ce;return function(a,b){return d(c(a,b),a,this)}}function be(a,b){var c;return eg?(c=yd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ce(a,b,c){var d=c.getBBox();return eg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:yd(b)?-3:-6)}function de(a,b){var c=a.__max__+1,d=od(zf,c),e=ld(d,c,a,!!b),f=md(!!b),g=nd(a,!!b),h=b?U:T;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return eg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function ee(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g<f.length;g++)t[g]={},t[g].start=c(f[g].start)?a[0].x:oh?Hd(f[g].start):f[g].start,t[g].end=c(f[g].end)?a[a.length-1].x:oh?Hd(f[g].end):f[g].end;for(p=eg?function(a){return e(a.value)}:function(a){return b(a.x)},q=eg?function(a){return b(a.x)}:function(a){return e(a.value)},i=oh?function(a,c,d,f){var g=a.x.getTime(),h=c.x-a.x,i=new Date(g+h*d),j=new Date(g+h*(d+f));return"M"+b(i)+" "+e(k(d))+" "+b(j)+" "+e(k(d+f))}:function(a,c,d,f){return"M"+b(j(d))+" "+e(k(d))+" "+b(j(d+f))+" "+e(k(d+f))},g=0;g<a.length;g++){if(c(t)||!Kd(a[g].x,t))s+=" "+p(a[g])+" "+q(a[g]);else{j=R(a[g-1].x,a[g].x),k=S(a[g-1].value,a[g].value),l=b(a[g].x)-b(a[g-1].x),m=e(a[g].value)-e(a[g-1].value),n=Math.sqrt(Math.pow(l,2)+Math.pow(m,2)),o=2/n;var u=2*o;for(h=o;1>=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function fe(b){var c,d,e;if(Th=Ce.select(Je),Th.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Th.html(""),Th.classed("c3",!0),De.data.x={},De.data.targets=ic(b),m(),P(),tf.domain(Ce.extent(Vb(De.data.targets))),uf.domain(Qb("y")),vf.domain(Qb("y2")),wf.domain(tf.domain()),xf.domain(uf.domain()),yf.domain(vf.domain()),Uh=tf.domain(),Ih.scale(wf),Oe&&Mh.scale(tf),Nh=Th.append("svg").attr("width",Xe+Ue.left+Ue.right).attr("height",Ze+Ue.top+Ue.bottom).on("mouseenter",Re).on("mouseleave",Se),Oh=Nh.append("defs"),Oh.append("clipPath").attr("id",mh).append("rect").attr("width",Xe).attr("height",Ze),Oh.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",z).attr("y",A).attr("width",F).attr("height",G),Oh.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ph=Nh.append("g").attr("transform",Ah.main),Qh=Zf?Nh.append("g").attr("transform",Ah.context):null,Rh=ag?Nh.append("g").attr("transform",Ah.legend):null,Sh=Ce.select(Je).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ph.append("g").attr("class",Ie.axisX).attr("clip-path",eg?"":h("xaxis-clip")).attr("transform",Ah.x).append("text").attr("class",Ie.axisXLabel).attr("transform",eg?"rotate(-90)":"").attr("dx",nb).attr("dy",qb).style("text-anchor",tb).text(eb),pg&&Ph.append("g").attr("class",Ie.axisY).attr("clip-path",eg?h("yaxis-clip"):"").append("text").attr("class",Ie.axisYLabel).attr("transform",eg?"":"rotate(-90)").attr("dx",ob).attr("dy",rb).style("text-anchor",ub).text(fb),yg&&Ph.append("g").attr("class",Ie.axisY2).attr("transform",Ah.y2).append("text").attr("class",Ie.axisY2Label).attr("transform",eg?"":"rotate(-90)").attr("dx",pb).style("text-anchor",vb).text(gb),d=Ph.append("g").attr("clip-path",nh).attr("class",Ie.grid),Hg&&d.append("g").attr("class",Ie.xgrids),Ld(Jg)&&d.append("g").attr("class",Ie.xgridLines),Pg&&d.append("g").attr("class",Ie.xgridFocus).append("line").attr("class",Ie.xgridFocus).attr("x1",eg?0:-10).attr("x2",eg?Xe:-10).attr("y1",eg?-10:Ue.top).attr("y2",eg?-10:Ze),Kg&&d.append("g").attr("class",Ie.ygrids),Ld(Lg)&&d.append("g").attr("class",Ie.ygridLines),Ph.append("g").attr("clip-path",nh).attr("class",Ie.regions),Ph.append("g").attr("clip-path",nh).attr("class",Ie.chart),c=Ph.select("."+Ie.chart).append("g").attr("class",Ie.eventRects).style("fill-opacity",0).style("cursor",Oe?eg?"ns-resize":"ew-resize":null),Ph.select("."+Ie.chart).append("g").attr("class",Ie.chartBars),Ph.select("."+Ie.chart).append("g").attr("class",Ie.chartLines),Ph.select("."+Ie.chart).append("g").attr("class",Ie.chartArcs).attr("transform",Ah.arc).append("text").attr("class",Ie.chartArcsTitle).style("text-anchor","middle").text(Kb()),Ph.select("."+Ie.chart).append("g").attr("class",Ie.chartTexts),Oe&&Ph.insert("rect",Qe?null:"g."+Ie.grid).attr("class",Ie.zoomRect).attr("width",Xe).attr("height",Ze).style("opacity",0).style("cursor",eg?"ns-resize":"ew-resize").call(Mh).on("dblclick.zoom",null),ng&&Ih.extent("function"!=typeof ng?ng:ng(Vb())),Zf&&(Qh.append("g").attr("clip-path",nh).attr("class",Ie.chart),Qh.select("."+Ie.chart).append("g").attr("class",Ie.chartBars),Qh.select("."+Ie.chart).append("g").attr("class",Ie.chartLines),Qh.append("g").attr("clip-path",nh).attr("class",Ie.brush).call(Ih).selectAll("rect").attr(eg?"width":"height",eg?Ye:$e),Qh.append("g").attr("class",Ie.axisX).attr("transform",Ah.subx).attr("clip-path",eg?"":h("xaxis-clip"))),se(De.data.targets),eg?Ph.select("."+Ie.axisX).style("opacity",0).call(zf):(Ph.select("."+Ie.axisY).style("opacity",0).call(Af),Ph.select("."+Ie.axisY2).style("opacity",0).call(Bf)),re({withTransform:!0,withLegend:!0,durationForAxis:0}),jh){if(oh&&"string"==typeof kh){for(kh=Hd(kh),e=0;e<De.data.targets[0].values.length&&De.data.targets[0].values[e].x-kh!==0;e++);kh=e}Sh.html(ih(De.data.targets.map(function(a){return fc(a.values[kh])}),Y(),Wc,uh)),Sh.style("top",lh.top).style("left",lh.left).style("display","block")}null==a.onresize&&(a.onresize=pe()),a.onresize.add&&a.onresize.add(function(){re({withTransition:!1,withLegend:!0})})}function ge(a){a.append("rect").attr("class",Jc).style("cursor",Qf&&Rf?"pointer":null).on("mouseover",function(a,b){if(!sh&&!vd(De.data.targets)){var c,d,e=De.data.targets.map(function(a){return fc(a.values[b])});if(Object.keys(Hf).length>0){d=[];for(var f in Hf)for(c=0;c<e.length;c++)if(e[c].id===f){d.push(e[c]),e.shift(c);break}e=d.concat(e)}Qg&&Wd(b),Zd(b)}}).on("mouseout",function(a,b){vd(De.data.targets)||(hd(),fd(),Xd(b),$d())}).on("mousemove",function(a,b){var c;sh||vd(De.data.targets)||(c=De.data.targets.map(function(a){return fc(a.values[b])}),ed(c,Ce.mouse(this)),gd(c),Qf&&(Rf||Ph.selectAll("."+Ie.shape+"-"+b).filter(function(a){return Sf(a)}).each(function(){var a=Ce.select(this).classed(Fe,!0);"circle"===this.nodeName&&a.attr("r",Rg),Nh.select("."+Ie.eventRect+"-"+b).style("cursor",null)}).filter(function(){return"circle"===this.nodeName?Id(this,Sg):"path"===this.nodeName?Jd(this):void 0}).each(function(){var a=Ce.select(this);a.classed(Fe)||(a.classed(Fe,!0),"circle"===this.nodeName&&a.attr("r",Sg)),Nh.select("."+Ie.eventRect+"-"+b).style("cursor","pointer")})))}).on("click",function(a,b){return vd(De.data.targets)?void 0:th?void(th=!1):void Ph.selectAll("."+Ie.shape+"-"+b).each(function(a){ie(this,a,b)})}).call(Ce.behavior.drag().origin(Object).on("drag",function(){je(Ce.mouse(this))}).on("dragstart",function(){ke(Ce.mouse(this))}).on("dragend",function(){le()})).call(Mh).on("dblclick.zoom",null)}function he(a){a.append("rect").attr("x",0).attr("y",0).attr("width",Xe).attr("height",Ze).attr("class",Ie.eventRect).on("mouseout",function(){vd(De.data.targets)||(hd(),fd(),Xd())}).on("mousemove",function(){var a,b,c;sh||vd(De.data.targets)||(a=Ce.mouse(this),b=$c(De.data.targets,a),c=[fc(b)],ed(c,a),Qg&&(Xd(),Wd(b.index,b.id)),gd(c),Nh.select("."+Ie.eventRect).style("cursor",Nd(b,a)<100?"pointer":null))}).on("click",function(){var a,b;vd(De.data.targets)||(a=Ce.mouse(this),b=$c(De.data.targets,a),Nd(b,a)<100&&Ph.select("."+Ie.circles+"-"+Kc(b.id)).select("."+Ie.circle+"-"+b.index).each(function(){ie(this,b,b.index)}))}).call(Ce.behavior.drag().origin(Object).on("drag",function(){je(Ce.mouse(this))}).on("dragstart",function(){ke(Ce.mouse(this))}).on("dragend",function(){le()})).call(Mh).on("dblclick.zoom",null)}function ie(a,b,c){var d,e=Ce.select(a),f=e.classed(Ge),g=!1;"circle"===a.nodeName?(g=Id(a,1.5*Sg),d=Qd):"path"===a.nodeName&&(g=Jd(a),d=Td),(Rf||g)&&(Qf&&Sf(b)&&(Tf||Ph.selectAll("."+Ie.shapes+(Rf?Kc(b.id):"")).selectAll("."+Ie.shape).each(function(a,b){var c=Ce.select(this);c.classed(Ge)&&d(!1,c.classed(Ge,!1),a,b)}),e.classed(Ge,!f),d(!f,e,b,c)),Uf(b,a))}function je(a){var b,c,d,e,f,g,h,i;vd(De.data.targets)||Qf&&(!Oe||Mh.altDomain)&&Tf&&(b=rh[0],c=rh[1],d=a[0],e=a[1],f=Math.min(b,d),g=Math.max(b,d),h=Rf?Ue.top:Math.min(c,e),i=Rf?Ze:Math.max(c,e),Ph.select("."+Ie.dragarea).attr("x",f).attr("y",h).attr("width",g-f).attr("height",i-h),Ph.selectAll("."+Ie.shapes).selectAll("."+Ie.shape).filter(function(a){return Sf(a)}).each(function(a,b){var c,d,e,j,k,l,m=Ce.select(this),n=m.classed(Ge),o=m.classed(He),p=!1;"circle"===this.nodeName?(c=1*m.attr("cx"),d=1*m.attr("cy"),k=Qd,p=c>f&&g>c&&d>h&&i>d):"path"===this.nodeName&&(l=ad(this),c=l.x,d=l.y,e=l.width,j=l.height,k=Td,p=!(c>g||f>c+e||d>i||h>d+j)),p^o&&(m.classed(He,!o),m.classed(Ge,!n),k(!n,m,a,b))}))}function ke(a){vd(De.data.targets)||Qf&&(rh=a,Ph.select("."+Ie.chart).append("rect").attr("class",Ie.dragarea).style("opacity",.1),sh=!0,Xf())}function le(){vd(De.data.targets)||Qf&&(Ph.select("."+Ie.dragarea).transition().duration(100).style("opacity",0).remove(),Ph.selectAll("."+Ie.shape).classed(He,!1),sh=!1,Yf()) }function me(a){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H=kd(),I=vd(De.data.targets);if(a=d(a)?a:{},t=d(a.withY)?a.withY:!0,u=d(a.withSubchart)?a.withSubchart:!0,v=d(a.withTransition)?a.withTransition:!0,w=d(a.withTransform)?a.withTransform:!1,x=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,y=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,z=d(a.withLegend)?a.withLegend:!1,E=v?Te:0,F=d(a.durationForExit)?a.durationForExit:E,G=d(a.durationForAxis)?a.durationForAxis:E,z&&ag&&ye(De.data.targets,a),y&&(tf.domain(Ce.extent(Vb(De.data.targets))),Uh=tf.domain(),Oe&&Mh.scale(tf).updateScaleExtent(),wf.domain(tf.domain()),Ih.scale(wf)),x&&(tf.domain(Ih.empty()?Uh:Ih.extent()),Oe&&Mh.scale(tf).updateScaleExtent()),uf.domain(Qb("y")),vf.domain(Qb("y2")),Ph.select("."+Ie.axisX).style("opacity",I?0:1).transition().duration(G).call(zf),Ph.select("."+Ie.axisY).style("opacity",I?0:1).transition().duration(G).call(Af),Ph.select("."+Ie.axisY2).style("opacity",I?0:1).transition().duration(G).call(Bf),A=_d(H),C=ae(H,!0),D=ae(H,!1),Ph.select("."+Ie.axisX+" ."+Ie.axisXLabel).attr("x",kb),Ph.select("."+Ie.axisY+" ."+Ie.axisYLabel).attr("x",lb).attr("dy",rb),Ph.select("."+Ie.axisY2+" ."+Ie.axisY2Label).attr("x",mb).attr("dy",sb),xf.domain(uf.domain()),yf.domain(vf.domain()),Sh.style("display","none"),Ph.select("line."+Ie.xgridFocus).style("visibility","hidden"),Hg){if("year"===Ig){e=[];for(var K=Vb(),L=K[0].getFullYear(),M=K[1].getFullYear(),N=L;M>=N;N++)e.push(new Date(N+"-01-01 00:00:00"))}else e=tf.ticks(10);c=Ph.select("."+Ie.xgrids).selectAll("."+Ie.xgrid).data(e),c.enter().append("line").attr("class",Ie.xgrid),c.attr("x1",eg?0:function(a){return tf(a)-zf.tickOffset()}).attr("x2",eg?Xe:function(a){return tf(a)-zf.tickOffset()}).attr("y1",eg?function(a){return tf(a)-zf.tickOffset()}:Ue.top).attr("y2",eg?function(a){return tf(a)-zf.tickOffset()}:Ze).style("opacity",function(){return+Ce.select(this).attr(eg?"y1":"x1")===(eg?Ze:0)?0:1}),c.exit().remove()}Ld(Jg)&&(f=Ph.select("."+Ie.xgridLines).selectAll("."+Ie.xgridLine).data(Jg),g=f.enter().append("g").attr("class",function(a){return Ie.xgridLine+(a.class?a.class:"")}),g.append("line").style("opacity",0),g.append("text").attr("text-anchor","end").attr("transform",eg?"":"rotate(-90)").attr("dx",eg?0:-Ue.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(E).attr("x1",eg?0:Tc).attr("x2",eg?Xe:Tc).attr("y1",eg?Tc:Ue.top).attr("y2",eg?Tc:Ze).style("opacity",1),f.select("text").transition().duration(E).attr("x",eg?Xe:0).attr("y",Tc).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(E).style("opacity",0).remove()),t&&Kg&&(h=Ph.select("."+Ie.ygrids).selectAll("."+Ie.ygrid).data(uf.ticks(Mg)),h.enter().append("line").attr("class",Ie.ygrid),h.attr("x1",eg?uf:0).attr("x2",eg?uf:Xe).attr("y1",eg?0:uf).attr("y2",eg?Ze:uf),h.exit().remove()),t&&Ld(Lg)&&(i=Ph.select("."+Ie.ygridLines).selectAll("."+Ie.ygridLine).data(Lg),j=i.enter().append("g").attr("class",function(a){return Ie.ygridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",eg?"rotate(-90)":"").attr("dx",eg?0:-Ue.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(E).attr("x1",eg?Uc:0).attr("x2",eg?Uc:Xe).attr("y1",eg?0:Uc).attr("y2",eg?Ze:Uc).style("opacity",1),i.select("text").transition().duration(E).attr("x",eg?0:Xe).attr("y",Uc).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(E).style("opacity",0).remove()),l=Ph.selectAll("."+Ie.bars).selectAll("."+Ie.bar).data(Dd),l.enter().append("path").attr("d",A).style("stroke","none").style("opacity",0).style("fill",function(a){return uh(a.id)}).attr("class",Ec),l.style("opacity",Mc).transition().duration(E).attr("d",A).style("opacity",1),l.exit().transition().duration(F).style("opacity",0).remove(),n=Ph.selectAll("."+Ie.texts).selectAll("."+Ie.text).data(Fd),n.enter().append("text").attr("class",xc).attr("text-anchor",function(a){return eg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return Wc(a.value)}),n.style("fill-opacity",Nc).transition().duration(E).attr("x",C).attr("y",D).style("fill-opacity",Pc),n.exit().transition().duration(F).style("fill-opacity",0).remove(),Ph.selectAll("."+Ie.line).style("opacity",Mc).transition().duration(E).attr("d",Jh).style("opacity",1),Ph.selectAll("."+Ie.area).style("opacity",0).transition().duration(E).attr("d",Kh).style("opacity",Vh),k=Ph.selectAll("."+Ie.circles).selectAll("."+Ie.circle).data(Ed),k.enter().append("circle").attr("class",Cc).style("opacity",0).attr("r",Og),k.style("opacity",Mc).transition().duration(E).style("opacity",Oc).attr("cx",eg?jd:id).attr("cy",eg?id:jd),k.exit().remove(),Ph.selectAll("."+Ie.chartArc).select("."+Ie.arc).attr("transform",w?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(E).attrTween("d",function(a){var b=yb(a);if(!b)return function(){return"M 0 0"};var c=Ce.interpolate(this._current,b);return this._current=c(0),function(a){return Bb(c(a),!0)}}).attr("transform",w?"scale(1)":"").style("opacity",1),Ph.selectAll("."+Ie.chartArc).select("text").attr("transform",Cb).style("opacity",0).transition().duration(E).text(Fb).style("opacity",function(a){return Cd(a.data)?1:0}),Ph.select("."+Ie.chartArcsTitle).style("opacity",ud(De.data.targets)?1:0),Zf&&(null!==Ce.event&&"zoom"===Ce.event.type&&Ih.extent(tf.orgDomain()).update(),u&&(Qh.select("."+Ie.axisX).style("opacity",I?0:1).transition().duration(E).call(Cf),Ih.empty()||Ih.extent(tf.orgDomain()).update(),B=_d(H,!0),o=Qh.selectAll("."+Ie.bars).selectAll("."+Ie.bar).data(Dd),o.enter().append("path").attr("d",B).style("stroke","none").style("fill",function(a){return uh(a.id)}).attr("class",Ec),o.style("opacity",Mc).transition().duration(E).attr("d",B).style("opacity",1),o.exit().transition().duration(E).style("opacity",0).remove(),Qh.selectAll("."+Ie.line).style("opacity",Mc).transition().duration(E).attr("d",Lh).style("opacity",1))),Ph.selectAll("."+Ie.selectedCircles).filter(function(a){return yd(a)}).selectAll("circle").remove(),Ph.selectAll("."+Ie.selectedCircle).transition().duration(E).attr("cx",eg?jd:id).attr("cy",eg?id:jd),Ld(Ef)?(p=Ph.select("."+Ie.eventRects).selectAll("."+Ie.eventRect).data([0]),he(p.enter()),p.attr("x",0).attr("y",0).attr("width",Xe).attr("height",Ze)):(qh&&!ph?(s=function(a,b){var c=kc(b),d=lc(b);return(tf(d?d:a.x+50)-tf(c?c:a.x-50))/2},r=function(a,b){var c=kc(b);return(tf(a.x)+tf(c?c:a.x-50))/2}):(s=J(),r=function(a){return tf(a.x)-s/2}),q=nc(),Ph.select("."+Ie.eventRects).datum(q?q.values:[]),p=Ph.select("."+Ie.eventRects).selectAll("."+Ie.eventRect).data(function(a){return a}),ge(p.enter()),p.attr("class",Jc).attr("x",eg?0:r).attr("y",eg?r:0).attr("width",eg?Xe:s).attr("height",eg?s:Ze),p.exit().remove()),m=Ph.select("."+Ie.regions).selectAll("rect."+Ie.region).data(eh),m.enter().append("rect").style("fill-opacity",0),m.attr("class",Ic).attr("x",eg?0:$b).attr("y",eg?$b:Ue.top).attr("width",eg?Xe:_b).attr("height",eg?_b:Ze).transition().duration(E).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),m.exit().transition().duration(E).style("fill-opacity",0).remove(),oc().forEach(function(a){Wh[a]=!0})}function ne(){me({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function oe(){return"mousemove"===Ce.event.sourceEvent.type&&Mh.altDomain?(tf.domain(Mh.altDomain),void Mh.scale(tf).updateScaleExtent()):(ph&&tf.orgDomain()[0]===Uh[0]&&tf.domain([Uh[0]-1e-10,tf.orgDomain()[1]]),me({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ce.event.sourceEvent.type&&(th=!0)))}function pe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function qe(){Nh.attr("width",_e).attr("height",af),Nh.select("#"+mh).select("rect").attr("width",Xe).attr("height",Ze),Nh.select("#xaxis-clip").select("rect").attr("width",F),Nh.select("#yaxis-clip").select("rect").attr("width",H),Nh.select("."+Ie.zoomRect).attr("width",Xe).attr("height",Ze)}function re(a){a=d(a)?a:{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.durationForExit=0,m(),P(),qe(),l(a.withTransition),me(a)}function se(a){var b,c,d,e,f,g,h,i,j,k,l,m;h=Ph.select("."+Ie.chartTexts).selectAll("."+Ie.chartText).data(a),i=h.enter().append("g").attr("class",function(a){return Ie.chartText+wc(Ie.target,a.id)}).style("pointer-events","none"),i.append("g").attr("class",yc).style("fill",function(a){return uh(a.id)}),e=Ph.select("."+Ie.chartBars).selectAll("."+Ie.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return Ie.chartBar+wc(Ie.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Fc).style("fill",function(a){return uh(a.id)}).style("stroke","none").style("cursor",function(a){return Sf(a)?"pointer":null}),c=Ph.select("."+Ie.chartLines).selectAll("."+Ie.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return Ie.chartLine+wc(Ie.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Bc).style("opacity",0).style("stroke",function(a){return uh(a.id)}),b.append("path").attr("class",Hc).style("opacity",function(){return Vh=+Ce.select(this).style("opacity"),0}).style("fill",function(a){return uh(a.id)}),b.append("g").attr("class",function(a){return wc(Ie.selectedCircles,a.id)}),b.append("g").attr("class",Dc).style("fill",function(a){return uh(a.id)}).style("cursor",function(a){return Sf(a)?"pointer":null}),a.forEach(function(a){Ph.selectAll("."+Ie.selectedCircles+Kc(a.id)).selectAll("."+Ie.selectedCircle).each(function(b){b.value=a.values[b.x].value})}),g=Ph.select("."+Ie.chartArcs).selectAll("."+Ie.chartArc).data(kf(a)),f=g.enter().append("g").attr("class",function(a){return Ie.chartArc+wc(Ie.target,a.data.id)}),f.append("path").attr("class",Gc).style("opacity",0).style("fill",function(a){return uh(a.data.id)}).style("cursor",function(a){return Sf(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Eb(a),d=Mb();Gb(a.data.id),ve(a.data.id),d(c,b)}).on("mousemove",function(a){var b=[Eb(a)];ed(b,Ce.mouse(this))}).on("mouseout",function(a,b){var c=Eb(a),d=Nb();Hb(a.data.id),xe(),fd(),d(c,b)}).on("click",function(a,b){var c=Eb(a),d=Lb();d(c,b)}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Zf&&(m=Qh.select("."+Ie.chartBars).selectAll("."+Ie.chartBar).data(a),l=m.enter().append("g").attr("class",function(a){return Ie.chartBar+wc(Ie.target,a.id)}),l.append("g").attr("class",Fc).style("fill",function(a){return uh(a.id)}),k=Qh.select("."+Ie.chartLines).selectAll("."+Ie.chartLine).data(a),j=k.enter().append("g").attr("class",function(a){return Ie.chartLine+wc(Ie.target,a.id)}),j.append("path").attr("class",Bc).style("opacity",0).style("stroke",function(a){return uh(a.id)})),Nh.selectAll("."+Ie.target).transition().style("opacity",1)}function te(a,b){De.data.targets.forEach(function(b){for(var c=0;c<a.length;c++)if(b.id===a[c].id){b.values=a[c].values,a.splice(c,1);break}}),De.data.targets=De.data.targets.concat(a),se(De.data.targets),me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),b()}function ue(a,b){var c,d,e;ag&&(c=Rh.selectAll("."+Ie.legendItem),d=function(b){return!a||b===a},e=function(a){return!d(a)},c.filter(e).transition().duration(100).style("opacity",b?.3:1),c.filter(d).transition().duration(100).style("opacity",b?1:.3))}function ve(a){ue(a,!0)}function we(a){ue(a,!1)}function xe(){ag&&Rh.selectAll("."+Ie.legendItem).transition().duration(100).style("opacity",1)}function ye(a,b){function e(a,b,c){function d(a,b){b||(e=(k-v-j)/2,u>e&&(e=(k-j)/2,v=0,B++)),A[a]=B,z[B]=e,w[a]=v,v+=j}var e,f,g=a.getBBox(),h=10*Math.ceil((g.width+r)/10),i=10*Math.ceil((g.height+q)/10),j=Bh?i:h,k=Bh?bf:cf;c&&(v=0,B=0,s=0,t=0),x[b]=h,y[b]=i,(!s||h>=s)&&(s=h),(!t||i>=t)&&(t=i),f=Bh?t:s,dg?(Object.keys(x).forEach(function(a){x[a]=s}),Object.keys(y).forEach(function(a){y[a]=t}),e=(k-f*p.length)/2,u>e?(v=0,B=0,p.forEach(function(a){d(a)})):d(b,!0)):d(b)}var f,g,h,i,j,k,n,o,p=oc(a),q=4,r=26,s=0,t=0,u=10,v=0,w={},x={},y={},z={},A={},B=0;b=c(b)?{}:b,o=d(b.withTransition)?b.withTransition:!0,Bh?(g=function(a){return s*(.2+A[a])},j=function(a){return z[A[a]]+w[a]}):(g=function(a){return z[A[a]]+w[a]},j=function(a){return t*(.2+A[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},n=function(a,b){return j(a,b)-7},f=Rh.selectAll("."+Ie.legendItem).data(p).enter().append("g").attr("class",function(a){return wc(Ie.legendItem,a)}).style("cursor","pointer").on("click",function(a){cg(a)}).on("mouseover",function(a){De.focus(a)}).on("mouseout",function(){De.revert()}),f.append("text").text(function(a){return d(Hf[a])?Hf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Bh?h:-200).attr("y",Bh?-200:k),f.append("rect").attr("class",Ie.legendItemEvent).style("fill-opacity",0).attr("x",Bh?i:-200).attr("y",Bh?-200:n).attr("width",function(a){return x[a]}).attr("height",function(a){return y[a]}),f.append("rect").attr("class",Ie.legendItemTile).style("pointer-events","none").style("fill",function(a){return uh(a)}).attr("x",Bh?h:-200).attr("y",Bh?-200:j).attr("width",10).attr("height",10),Rh.selectAll("text").data(p).each(function(a,b){e(this,a,0===b)}).transition().duration(o?250:0).attr("x",h).attr("y",k),Rh.selectAll("rect."+Ie.legendItemEvent).data(p).transition().duration(o?250:0).attr("x",i).attr("y",n),Rh.selectAll("rect."+Ie.legendItemTile).data(p).transition().duration(o?250:0).attr("x",g).attr("y",j),L(s),M(t),K(B),m(),P(),qe(),l(!1)}function ze(a){return pc(a.id)}function Ae(a){return"data"in a&&pc(a.data.id)}function Be(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}var Ce=a.d3?a.d3:a.require?a.require("d3"):void 0,De={data:{}},Ee={},Fe="_expanded_",Ge="_selected_",He="_included_",Ie={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",dragarea:"c3-dragarea"},Je=g(["bindto"],"#chart"),Ke=g(["size","width"]),Le=g(["size","height"]),Me=g(["padding","left"]),Ne=g(["padding","right"]),Oe=g(["zoom","enabled"],!1),Pe=g(["zoom","extent"]),Qe=g(["zoom","privileged"],!1),Re=g(["onenter"],function(){}),Se=g(["onleave"],function(){}),Te=g(["transition","duration"],350);f("data","data is required in config");var Ue,Ve,We,Xe,Ye,Ze,$e,_e,af,bf,cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf,rf,sf,tf,uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df=g(["data","x"]),Ef=g(["data","xs"],{}),Ff=g(["data","x_format"],"%Y-%m-%d"),Gf=g(["data","id_converter"],function(a){return a}),Hf=g(["data","names"],{}),If=g(["data","groups"],[]),Jf=g(["data","axes"],{}),Kf=g(["data","type"]),Lf=g(["data","types"],{}),Mf=g(["data","labels"],{}),Nf=g(["data","order"]),Of=g(["data","regions"],{}),Pf=g(["data","colors"],{}),Qf=g(["data","selection","enabled"],!1),Rf=g(["data","selection","grouped"],!1),Sf=g(["data","selection","isselectable"],function(){return!0}),Tf=g(["data","selection","multiple"],!0),Uf=g(["data","onclick"],function(){}),Vf=g(["data","onselected"],function(){}),Wf=g(["data","onunselected"],function(){}),Xf=g(["data","ondragstart"],function(){}),Yf=g(["data","ondragend"],function(){}),Zf=g(["subchart","show"],!1),$f=Zf?g(["subchart","size","height"],60):0,_f=g(["color","pattern"],[]),ag=g(["legend","show"],!0),bg=g(["legend","position"],"bottom"),cg=g(["legend","item","onclick"],function(){}),dg=g(["legend","equally"],!1),eg=g(["axis","rotated"],!1),fg=g(["axis","x","type"],"indexed"),gg=g(["axis","x","categories"],[]),hg=g(["axis","x","tick","centered"],!1),ig=g(["axis","x","tick","format"]),jg=g(["axis","x","tick","culling"],"categorized"===fg?!1:!0),kg=g(["axis","x","tick","count"],10),lg=g(["axis","x","max"]),mg=g(["axis","x","min"]),ng=g(["axis","x","default"]),og=g(["axis","x","label"],{}),pg=g(["axis","y","show"],!0),qg=g(["axis","y","max"]),rg=g(["axis","y","min"]),sg=g(["axis","y","center"]),tg=g(["axis","y","label"],{}),ug=g(["axis","y","inner"],!1),vg=g(["axis","y","tick","format"]),wg=g(["axis","y","padding"]),xg=g(["axis","y","ticks"],10),yg=g(["axis","y2","show"],!1),zg=g(["axis","y2","max"]),Ag=g(["axis","y2","min"]),Bg=g(["axis","y2","center"]),Cg=g(["axis","y2","label"]),Dg=g(["axis","y2","inner"],!1),Eg=g(["axis","y2","tick","format"]),Fg=g(["axis","y2","padding"]),Gg=g(["axis","y2","ticks"],10),Hg=g(["grid","x","show"],!1),Ig=g(["grid","x","type"],"tick"),Jg=g(["grid","x","lines"],[]),Kg=g(["grid","y","show"],!1),Lg=g(["grid","y","lines"],[]),Mg=g(["grid","y","ticks"],10),Ng=g(["point","show"],!0),Og=Ng?g(["point","r"],2.5):0,Pg=g(["point","focus","line","enabled"],!0),Qg=g(["point","focus","expand","enabled"],!0),Rg=g(["point","focus","expand","r"],Qg?4:Og),Sg=g(["point","focus","select","r"],8),Tg=g(["bar","width"]),Ug=g(["bar","width","ratio"],.6),Vg=g(["pie","label","show"],!0),Wg=g(["pie","label","format"]),Xg=g(["pie","onclick"],function(){}),Yg=g(["pie","onmouseover"],function(){}),Zg=g(["pie","onmouseout"],function(){}),$g=g(["donut","label","show"],!0),_g=g(["donut","label","format"]),ah=g(["donut","title"],""),bh=g(["donut","onclick"],function(){}),ch=g(["donut","onmouseover"],function(){}),dh=g(["donut","onmouseout"],function(){}),eh=g(["regions"],[]),fh=g(["tooltip","show"],!0),gh=g(["tooltip","format","title"]),hh=g(["tooltip","format","value"]),ih=g(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=gh?gh:b,k=hh?hh:c;for(f=0;f<a.length;f++)a[f]&&(a[f].value||0===a[f].value)&&(e||(g=j?j(a[f].x):a[f].x,e="<table class='"+Ie.tooltip+"'>"+(g||0===g?"<tr><th colspan='2'>"+g+"</th></tr>":"")),i=a[f].name,h=k(a[f].value,a[f].ratio),e+="<tr class='"+Ie.tooltipName+"-"+a[f].id+"'>",e+="<td class='name'><span style='background-color:"+d(a[f].id)+"'></span>"+i+"</td>",e+="<td class='value'>"+h+"</td>",e+="</tr>");return e+"</table>"}),jh=g(["tooltip","init","show"],!1),kh=g(["tooltip","init","x"],0),lh=g(["tooltip","init","position"],{top:"0px",left:"50px"}),mh=("string"==typeof Je?Je.replace("#",""):Je.id)+"-clip",nh=h(mh),oh="timeseries"===fg,ph="categorized"===fg,qh=!oh&&(Df||Ld(Ef)),rh=null,sh=!1,th=!1,uh=Gd(Pf,_f),vh=function(){var a=[[Ce.time.format("%Y/%-m/%-d"),function(){return!0}],[Ce.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ce.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ce.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ce.time.format("%I %p"),function(a){return a.getHours()}],[Ce.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ce.time.format(":%S"),function(a){return a.getSeconds()}],[Ce.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),wh=eg?"left":"bottom",xh=eg?ug?"top":"bottom":ug?"right":"left",yh=eg?Dg?"bottom":"top":Dg?"left":"right",zh=eg?"left":"bottom",Ah={main:function(){return"translate("+Ue.left+","+Ue.top+")"},context:function(){return"translate("+Ve.left+","+Ve.top+")"},legend:function(){return"translate("+We.left+","+We.top+")"},x:function(){return"translate(0,"+(eg?0:Ze)+")"},y:function(){return"translate(0,"+(eg?Ze:0)+")"},y2:function(){return"translate("+(eg?0:Xe)+","+(eg?1:0)+")"},subx:function(){return"translate(0,"+(eg?0:$e)+")"},arc:function(){return"translate("+Xe/2+","+Ze/2+")"}},Bh="right"===bg,Ch=0,Dh=0,Eh=0,Fh=30,Gh=30,Hh=5;kf=Ce.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ih,Jh=function(){var a=Ce.svg.line().x(eg?function(a){return T(a.id)(a.value)}:Sc).y(eg?Sc:function(a){return T(a.id)(a.value)});return function(b){var c,d,e=Ud(b.values);return wd(b)?(a.interpolate(xd(b)?"cardinal":"linear"),Of[b.id]?ee(e,tf,T(b.id),Of[b.id]):a(e)):(c=tf(e[0].x),d=T(b.id)(e[0].value),eg?"M "+d+" "+c:"M "+c+" "+d)}}(),Kh=function(){var a;return a=eg?Ce.svg.area().x0(function(a){return T(a.id)(0)}).x1(function(a){return T(a.id)(a.value)}).y(Sc):Ce.svg.area().x(Sc).y0(function(a){return T(a.id)(0)}).y1(function(a){return T(a.id)(a.value)}),function(b){var c,d,e=Ud(b.values);return qd([b],"area")||qd([b],"area-spline")?(a.interpolate(xd(b)?"cardinal":"linear"),a(e)):(c=tf(e[0].x),d=T(b.id)(e[0].value),eg?"M "+d+" "+c:"M "+c+" "+d)}}(),Lh=function(){var a=Ce.svg.line().x(eg?function(a){return U(a.id)(a.value)}:Vc).y(eg?Vc:function(a){return U(a.id)(a.value)});return function(b){var c=Ud(b.values);return wd(b)?a(c):"M "+wf(c[0].x)+" "+U(b.id)(c[0].value)}}(),Mh=function(){};Ih=Ce.svg.brush().on("brush",ne),Ih.update=function(){return Qh&&Qh.select("."+Ie.brush).call(this),this},Ih.scale=function(a){return eg?this.y(a):this.x(a)},Oe&&(Mh=Ce.behavior.zoom().on("zoomstart",function(){Mh.altDomain=Ce.event.sourceEvent.altKey?tf.orgDomain():null}).on("zoom",Oe?oe:null),Mh.scale=function(a){return eg?this.y(a):this.x(a)},Mh.orgScaleExtent=function(){var a=Pe?Pe:[1,10];return[a[0],Math.max(mc()/a[1],a[1])]},Mh.updateScaleExtent=function(){var a=Wb(tf.orgDomain())/Wb(Uh),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Nh,Oh,Ph,Qh,Rh,Sh,Th,Uh,Vh,Wh={};if(De.focus=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Nh.selectAll(Lc(a)),d=c.filter(ze),e=c.filter(Ae);De.revert(),De.defocus(),b(d.classed(Ie.focused,!0)),b(e),vd(De.data.targets)&&Gb(a,!0),ve(a)},De.defocus=function(a){function b(a){a.transition().duration(100).style("opacity",.3)}var c=Nh.selectAll(Lc(a)),d=c.filter(ze),e=c.filter(Ae);De.revert(),b(d.classed(Ie.focused,!1)),b(e),vd(De.data.targets)&&Hb(a),we(a)},De.revert=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Nh.selectAll(Lc(a)),d=c.filter(ze),e=c.filter(Ae);b(d.classed(Ie.focused,!1)),b(e),vd(De.data.targets)&&Hb(a),xe()},De.show=function(a){Nh.selectAll(Lc(a)).transition().style("opacity",1)},De.hide=function(a){Nh.selectAll(Lc(a)).transition().style("opacity",0)},De.unzoom=function(){Ih.clear().update(),me({withUpdateXDomain:!0})},De.load=function(a){if("function"!=typeof a.done&&(a.done=function(){}),a.xs&&ec(a.xs),"categories"in a&&ph&&(gg=a.categories,zf.categories(gg)),"cacheIds"in a&&Xb(a.cacheIds))return void te(Zb(a.cacheIds),a.done);if("data"in a)te(ic(a.data),a.done);else if("url"in a)Ce.csv(a.url,function(b,c){te(ic(c),a.done)});else if("rows"in a)te(ic(gc(a.rows)),a.done);else{if(!("columns"in a))throw Error("url or rows or columns is required.");te(ic(hc(a.columns)),a.done)}},De.unload=function(a){De.data.targets=De.data.targets.filter(function(b){return b.id!==a}),Nh.selectAll(Lc(a)).transition().style("opacity",0).remove(),ag&&Rh.selectAll("."+Ie.legendItem+Kc(a)).remove(),De.data.targets.length>0&&me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},De.selected=function(a){return Ce.merge(Ph.selectAll("."+Ie.shapes+Kc(a)).selectAll("."+Ie.shape).filter(function(){return Ce.select(this).classed(Ge)}).map(function(a){return a.map(function(a){return a.__data__})}))},De.select=function(a,b,c){Qf&&Ph.selectAll("."+Ie.shapes).selectAll("."+Ie.shape).each(function(e,f){var g=Ce.select(this),h="circle"===this.nodeName?Od:Rd,i="circle"===this.nodeName?Pd:Sd,j=Rf||!a||a.indexOf(e.id)>=0,k=!b||b.indexOf(f)>=0,l=g.classed(Ge);j&&k?Sf(e)&&!l&&h(g.classed(Ge,!0),e,f):d(c)&&c&&l&&i(g.classed(Ge,!1),e,f)})},De.unselect=function(a,b){Qf&&Ph.selectAll("."+Ie.shapes).selectAll("."+Ie.shape).each(function(c,d){var e=Ce.select(this),f="circle"===this.nodeName?Pd:Sd,g=Rf||!a||a.indexOf(c.id)>=0,h=!b||b.indexOf(d)>=0,i=e.classed(Ge);g&&h&&Sf(c)&&i&&f(e.classed(Ge,!1),c,d)})},De.toLine=function(a){pd(a,"line"),re()},De.toSpline=function(a){pd(a,"spline"),re()},De.toBar=function(a){pd(a,"bar"),re()},De.toScatter=function(a){pd(a,"scatter"),re()},De.toArea=function(a){pd(a,"area"),re()},De.toAreaSpline=function(a){pd(a,"area-spline"),re()},De.toPie=function(a){pd(a,"pie"),re({withTransform:!0})},De.toDonut=function(a){pd(a,"donut"),re({withTransform:!0})},De.groups=function(a){return c(a)?If:(If=a,me(),If)},De.xgrids=function(a){return a?(Jg=a,me(),Jg):Jg},De.xgrids.add=function(a){return a?De.xgrids(Jg.concat(a)):void 0},De.xgrids.remove=function(a){var b=Be(a);return De.xgrids(Jg.filter(b))},De.ygrids=function(a){return a?(Lg=a,me(),Lg):Lg},De.ygrids.add=function(a){return a?De.ygrids(Lg.concat(a)):void 0},De.ygrids.remove=function(a){var b=Be(a);return De.ygrids(Lg.filter(b))},De.regions=function(a){return c(a)?eh:(eh=a,me(),eh)},De.regions.add=function(a){return c(a)?eh:(eh=eh.concat(a),me(),eh)},De.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Nh.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),eh=eh.filter(function(b){return b.classes.indexOf(a)<0})}),eh},De.data.get=function(a){var b=De.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},De.data.getAsTarget=function(a){var b=qc(function(b){return b.id===a});return b.length>0?b[0]:void 0},De.resize=function(a){Ke=a?a.width:null,Le=a?a.height:null,re({withLegend:!0,withTransition:!1})},De.destroy=function(){De.data.targets=void 0,De.data.x={},Th.html(""),a.onresize=null},"url"in e.data)Ce.csv(e.data.url,function(a,b){fe(b)});else if("rows"in e.data)fe(gc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");fe(hc(e.data.columns))}return De},"function"==typeof a.define&&a.define.amd?a.define(e):a.c3=e}(window);
fbender/cdnjs
ajax/libs/c3/0.1.24/c3.min.js
JavaScript
mit
59,066
/*! Picturefill - v2.1.0-beta - 2014-07-15 * http://scottjehl.github.io/picturefill * Copyright (c) 2014 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */ window.matchMedia||(window.matchMedia=function(){"use strict";var a=window.styleMedia||window.media;if(!a){var b=document.createElement("style"),c=document.getElementsByTagName("script")[0],d=null;b.type="text/css",b.id="matchmediajs-test",c.parentNode.insertBefore(b,c),d="getComputedStyle"in window&&window.getComputedStyle(b,null)||b.currentStyle,a={matchMedium:function(a){var c="@media "+a+"{ #matchmediajs-test { width: 1px; } }";return b.styleSheet?b.styleSheet.cssText=c:b.textContent=c,"1px"===d.width}}}return function(b){return{matches:a.matchMedium(b||"all"),media:b||"all"}}}()),function(a,b){"use strict";function c(a){var b,c,d,f,g,h=a||{};b=h.elements||e.getAllElements();for(var i=0,j=b.length;j>i;i++)if(c=b[i],d=c.parentNode,f=void 0,g=void 0,c[e.ns]||(c[e.ns]={}),h.reevaluate||!c[e.ns].evaluated){if("PICTURE"===d.nodeName.toUpperCase()){if(e.removeVideoShim(d),f=e.getMatch(c,d),f===!1)continue}else f=void 0;("PICTURE"===d.nodeName.toUpperCase()||c.srcset&&!e.srcsetSupported||!e.sizesSupported&&c.srcset&&c.srcset.indexOf("w")>-1)&&e.dodgeSrcset(c),f?(g=e.processSourceSet(f),e.applyBestCandidate(g,c)):(g=e.processSourceSet(c),(void 0===c.srcset||c[e.ns].srcset)&&e.applyBestCandidate(g,c)),c[e.ns].evaluated=!0}}function d(){c();var d=setInterval(function(){return c(),/^loaded|^i|^c/.test(b.readyState)?void clearInterval(d):void 0},250);if(a.addEventListener){var e;a.addEventListener("resize",function(){a._picturefillWorking||(a._picturefillWorking=!0,a.clearTimeout(e),e=a.setTimeout(function(){c({reevaluate:!0}),a._picturefillWorking=!1},60))},!1)}}if(a.HTMLPictureElement)return void(a.picturefill=function(){});b.createElement("picture");var e={};e.ns="picturefill",e.srcsetSupported="srcset"in b.createElement("img"),e.sizesSupported=a.HTMLImageElement.sizes,e.trim=function(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")},e.endsWith=function(a,b){return a.endsWith?a.endsWith(b):-1!==a.indexOf(b,a.length-b.length)},e.matchesMedia=function(b){return a.matchMedia&&a.matchMedia(b).matches},e.getDpr=function(){return a.devicePixelRatio||1},e.getWidthFromLength=function(a){return a=a&&(parseFloat(a)>0||a.indexOf("calc(")>-1)?a:"100vw",a=a.replace("vw","%"),e.lengthEl||(e.lengthEl=b.createElement("div"),b.documentElement.insertBefore(e.lengthEl,b.documentElement.firstChild)),e.lengthEl.style.cssText="position: absolute; left: 0; width: "+a+";",e.lengthEl.offsetWidth<=0&&(e.lengthEl.style.cssText="width: 100%;"),e.lengthEl.offsetWidth},e.types={},e.types["image/jpeg"]=!0,e.types["image/gif"]=!0,e.types["image/png"]=!0,e.types["image/svg+xml"]=b.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1"),e.types["image/webp"]=function(){var b=new a.Image,d="image/webp";b.onerror=function(){e.types[d]=!1,c()},b.onload=function(){e.types[d]=1===b.width,c()},b.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="},e.verifyTypeSupport=function(a){var b=a.getAttribute("type");return null===b||""===b?!0:"function"==typeof e.types[b]?(e.types[b](),"pending"):e.types[b]},e.parseSize=function(a){var b=/(\([^)]+\))?\s*(.+)/g.exec(a);return{media:b&&b[1],length:b&&b[2]}},e.findWidthFromSourceSize=function(a){for(var b,c=e.trim(a).split(/\s*,\s*/),d=0,f=c.length;f>d;d++){var g=c[d],h=e.parseSize(g),i=h.length,j=h.media;if(i&&(!j||e.matchesMedia(j))){b=i;break}}return e.getWidthFromLength(b)},e.parseSrcset=function(a){for(var b=[];""!==a;){a=a.replace(/^\s+/g,"");var c,d=a.search(/\s/g),e=null;if(-1!==d){c=a.slice(0,d);var f=c[c.length-1];if((","===f||""===c)&&(c=c.replace(/,+$/,""),e=""),a=a.slice(d+1),null===e){var g=a.indexOf(",");-1!==g?(e=a.slice(0,g),a=a.slice(g+1)):(e=a,a="")}}else c=a,a="";(c||e)&&b.push({url:c,descriptor:e})}return b},e.parseDescriptor=function(a,b){var c,d=b||"100vw",f=a&&a.replace(/(^\s+|\s+$)/g,""),g=e.findWidthFromSourceSize(d);if(f)for(var h=f.split(" "),i=h.length+1;i>=0;i--)if(void 0!==h[i]){var j=h[i],k=j&&j.slice(j.length-1);if("h"!==k&&"w"!==k||e.sizesSupported){if("x"===k){var l=j&&parseFloat(j,10);c=l&&!isNaN(l)?l:1}}else c=parseFloat(parseInt(j,10)/g)}return c||1},e.getCandidatesFromSourceSet=function(a,b){for(var c=e.parseSrcset(a),d=[],f=0,g=c.length;g>f;f++){var h=c[f];d.push({url:h.url,resolution:e.parseDescriptor(h.descriptor,b)})}return d},e.dodgeSrcset=function(a){a.srcset&&(a[e.ns].srcset=a.srcset,a.removeAttribute("srcset"))},e.processSourceSet=function(a){var b=a.getAttribute("srcset"),c=a.getAttribute("sizes"),d=[];return"IMG"===a.nodeName.toUpperCase()&&a[e.ns]&&a[e.ns].srcset&&(b=a[e.ns].srcset),b&&(d=e.getCandidatesFromSourceSet(b,c)),d},e.applyBestCandidate=function(a,b){var c,d,f;a.sort(e.ascendingSort),d=a.length,f=a[d-1];for(var g=0;d>g;g++)if(c=a[g],c.resolution>=e.getDpr()){f=c;break}f&&!e.endsWith(b.src,f.url)&&(b.src=f.url,b.currentSrc=b.src)},e.ascendingSort=function(a,b){return a.resolution-b.resolution},e.removeVideoShim=function(a){var b=a.getElementsByTagName("video");if(b.length){for(var c=b[0],d=c.getElementsByTagName("source");d.length;)a.insertBefore(d[0],c);c.parentNode.removeChild(c)}},e.getAllElements=function(){for(var a=[],c=b.getElementsByTagName("img"),d=0,f=c.length;f>d;d++){var g=c[d];("PICTURE"===g.parentNode.nodeName.toUpperCase()||null!==g.getAttribute("srcset")||g[e.ns]&&null!==g[e.ns].srcset)&&a.push(g)}return a},e.getMatch=function(a,b){for(var c,d=b.childNodes,f=0,g=d.length;g>f;f++){var h=d[f];if(1===h.nodeType){if(h===a)return c;if("SOURCE"===h.nodeName.toUpperCase()){var i=h.getAttribute("media");if(h.getAttribute("srcset")&&(!i||e.matchesMedia(i))){var j=e.verifyTypeSupport(h);if(j===!0){c=h;break}if("pending"===j)return!1}}}}return c},d(),c._=e,"object"==typeof module&&"object"==typeof module.exports?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):"object"==typeof a&&(a.picturefill=c)}(this,this.document);
yinghunglai/cdnjs
ajax/libs/picturefill/2.1.0-beta2/picturefill.min.js
JavaScript
mit
6,060
/* * # Semantic UI - 1.7.3 * https://github.com/Semantic-Org/Semantic-UI * http://www.semantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ .transition{-webkit-animation-iteration-count:1;animation-iteration-count:1;-webkit-animation-duration:500ms;animation-duration:500ms;-webkit-animation-timing-function:ease;animation-timing-function:ease;-webkit-animation-fill-mode:both;animation-fill-mode:both}.animating.transition{-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform:translateZ(0);transform:translateZ(0);visibility:visible!important}.loading.transition{position:absolute;top:-99999px;left:-99999px}.hidden.transition{display:none;visibility:hidden}.visible.transition{display:block!important;visibility:visible!important;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform:translateZ(0);transform:translateZ(0)}.disabled.transition{-webkit-animation-play-state:paused;animation-play-state:paused}.looping.transition{-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.flash.transition{-webkit-animation-name:flash;animation-name:flash}.shake.transition{-webkit-animation-name:shake;animation-name:shake}.bounce.transition{-webkit-animation-name:bounce;animation-name:bounce}.tada.transition{-webkit-animation-name:tada;animation-name:tada}.pulse.transition{-webkit-animation-name:pulse;animation-name:pulse}@-webkit-keyframes flash{0%,100%,50%{opacity:1}25%,75%{opacity:0}}@keyframes flash{0%,100%,50%{opacity:1}25%,75%{opacity:0}}@-webkit-keyframes shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@-webkit-keyframes bounce{0%,100%,20%,50%,80%{-webkit-transform:translateY(0);transform:translateY(0)}40%{-webkit-transform:translateY(-30px);transform:translateY(-30px)}60%{-webkit-transform:translateY(-15px);transform:translateY(-15px)}}@keyframes bounce{0%,100%,20%,50%,80%{-webkit-transform:translateY(0);transform:translateY(0)}40%{-webkit-transform:translateY(-30px);transform:translateY(-30px)}60%{-webkit-transform:translateY(-15px);transform:translateY(-15px)}}@-webkit-keyframes tada{0%{-webkit-transform:scale(1);transform:scale(1)}10%,20%{-webkit-transform:scale(0.9) rotate(-3deg);transform:scale(0.9) rotate(-3deg)}30%,50%,70%,90%{-webkit-transform:scale(1.1) rotate(3deg);transform:scale(1.1) rotate(3deg)}40%,60%,80%{-webkit-transform:scale(1.1) rotate(-3deg);transform:scale(1.1) rotate(-3deg)}100%{-webkit-transform:scale(1) rotate(0);transform:scale(1) rotate(0)}}@keyframes tada{0%{-webkit-transform:scale(1);transform:scale(1)}10%,20%{-webkit-transform:scale(0.9) rotate(-3deg);transform:scale(0.9) rotate(-3deg)}30%,50%,70%,90%{-webkit-transform:scale(1.1) rotate(3deg);transform:scale(1.1) rotate(3deg)}40%,60%,80%{-webkit-transform:scale(1.1) rotate(-3deg);transform:scale(1.1) rotate(-3deg)}100%{-webkit-transform:scale(1) rotate(0);transform:scale(1) rotate(0)}}@-webkit-keyframes pulse{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}50%{-webkit-transform:scale(0.9);transform:scale(0.9);opacity:.7}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes pulse{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}50%{-webkit-transform:scale(0.9);transform:scale(0.9);opacity:.7}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}.slide.down.transition.in{-webkit-animation-name:slideIn;animation-name:slideIn;transform-origin:50% 0;-ms-transform-origin:50% 0;-webkit-transform-origin:50% 0}.slide.down.transition.out{-webkit-animation-name:slideOut;animation-name:slideOut;-webkit-transform-origin:50% 0;-ms-transform-origin:50% 0;transform-origin:50% 0}.slide.up.transition.in{-webkit-animation-name:slideIn;animation-name:slideIn;-webkit-transform-origin:50% 100%;-ms-transform-origin:50% 100%;transform-origin:50% 100%}.slide.up.transition.out{-webkit-animation-name:slideOut;animation-name:slideOut;-webkit-transform-origin:50% 100%;-ms-transform-origin:50% 100%;transform-origin:50% 100%}@-webkit-keyframes slideIn{0%{opacity:0;-webkit-transform:scaleY(0);transform:scaleY(0)}100%{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}}@keyframes slideIn{0%{opacity:0;-webkit-transform:scaleY(0);transform:scaleY(0)}100%{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}}@-webkit-keyframes slideOut{0%{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}100%{opacity:0;-webkit-transform:scaleY(0);transform:scaleY(0)}}@keyframes slideOut{0%{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}100%{opacity:0;-webkit-transform:scaleY(0);transform:scaleY(0)}}.flip.transition.in,.flip.transition.out{-webkit-perspective:2000px;perspective:2000px}.horizontal.flip.transition.in{-webkit-animation-name:horizontalFlipIn;animation-name:horizontalFlipIn}.horizontal.flip.transition.out{-webkit-animation-name:horizontalFlipOut;animation-name:horizontalFlipOut}.vertical.flip.transition.in{-webkit-animation-name:verticalFlipIn;animation-name:verticalFlipIn}.vertical.flip.transition.out{-webkit-animation-name:verticalFlipOut;animation-name:verticalFlipOut}@-webkit-keyframes horizontalFlipIn{0%{-webkit-transform:rotateY(-90deg);transform:rotateY(-90deg);opacity:0}100%{-webkit-transform:rotateY(0deg);transform:rotateY(0deg);opacity:1}}@keyframes horizontalFlipIn{0%{-webkit-transform:rotateY(-90deg);transform:rotateY(-90deg);opacity:0}100%{-webkit-transform:rotateY(0deg);transform:rotateY(0deg);opacity:1}}@-webkit-keyframes horizontalFlipOut{0%{-webkit-transform:rotateY(0deg);transform:rotateY(0deg);opacity:1}100%{-webkit-transform:rotateY(90deg);transform:rotateY(90deg);opacity:0}}@keyframes horizontalFlipOut{0%{-webkit-transform:rotateY(0deg);transform:rotateY(0deg);opacity:1}100%{-webkit-transform:rotateY(90deg);transform:rotateY(90deg);opacity:0}}@-webkit-keyframes verticalFlipIn{0%{-webkit-transform:rotateX(-90deg);transform:rotateX(-90deg);opacity:0}100%{-webkit-transform:rotateX(0deg);transform:rotateX(0deg);opacity:1}}@keyframes verticalFlipIn{0%{-webkit-transform:rotateX(-90deg);transform:rotateX(-90deg);opacity:0}100%{-webkit-transform:rotateX(0deg);transform:rotateX(0deg);opacity:1}}@-webkit-keyframes verticalFlipOut{0%{-webkit-transform:rotateX(0deg);transform:rotateX(0deg);opacity:1}100%{-webkit-transform:rotateX(-90deg);transform:rotateX(-90deg);opacity:0}}@keyframes verticalFlipOut{0%{-webkit-transform:rotateX(0deg);transform:rotateX(0deg);opacity:1}100%{-webkit-transform:rotateX(-90deg);transform:rotateX(-90deg);opacity:0}}.fade.transition.in{-webkit-animation-name:fadeIn;animation-name:fadeIn}.fade.transition.out{-webkit-animation-name:fadeOut;animation-name:fadeOut}.fade.up.transition.in{-webkit-animation-name:fadeUpIn;animation-name:fadeUpIn}.fade.up.transition.out{-webkit-animation-name:fadeUpOut;animation-name:fadeUpOut}.fade.down.transition.in{-webkit-animation-name:fadeDownIn;animation-name:fadeDownIn}.fade.down.transition.out{-webkit-animation-name:fadeDownOut;animation-name:fadeDownOut}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes fadeUpIn{0%{opacity:0;-webkit-transform:translateY(10%);transform:translateY(10%)}100%{opacity:1;-webkit-transform:translateY(0%);transform:translateY(0%)}}@keyframes fadeUpIn{0%{opacity:0;-webkit-transform:translateY(10%);transform:translateY(10%)}100%{opacity:1;-webkit-transform:translateY(0%);transform:translateY(0%)}}@-webkit-keyframes fadeUpOut{0%{opacity:1;-webkit-transform:translateY(0%);transform:translateY(0%)}100%{opacity:0;-webkit-transform:translateY(10%);transform:translateY(10%)}}@keyframes fadeUpOut{0%{opacity:1;-webkit-transform:translateY(0%);transform:translateY(0%)}100%{opacity:0;-webkit-transform:translateY(10%);transform:translateY(10%)}}@-webkit-keyframes fadeDownIn{0%{opacity:0;-webkit-transform:translateY(-10%);transform:translateY(-10%)}100%{opacity:1;-webkit-transform:translateY(0%);transform:translateY(0%)}}@keyframes fadeDownIn{0%{opacity:0;-webkit-transform:translateY(-10%);transform:translateY(-10%)}100%{opacity:1;-webkit-transform:translateY(0%);transform:translateY(0%)}}@-webkit-keyframes fadeDownOut{0%{opacity:1;-webkit-transform:translateY(0%);transform:translateY(0%)}100%{opacity:0;-webkit-transform:translateY(-10%);transform:translateY(-10%)}}@keyframes fadeDownOut{0%{opacity:1;-webkit-transform:translateY(0%);transform:translateY(0%)}100%{opacity:0;-webkit-transform:translateY(-10%);transform:translateY(-10%)}}.scale.transition.in{-webkit-animation-name:scaleIn;animation-name:scaleIn}.scale.transition.out{-webkit-animation-name:scaleOut;animation-name:scaleOut}@-webkit-keyframes scaleIn{0%{opacity:0;-webkit-transform:scale(0.7);transform:scale(0.7)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes scaleIn{0%{opacity:0;-webkit-transform:scale(0.7);transform:scale(0.7)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes scaleOut{0%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}100%{opacity:0;-webkit-transform:scale(0.7);transform:scale(0.7)}}@keyframes scaleOut{0%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}100%{opacity:0;-webkit-transform:scale(0.7);transform:scale(0.7)}}.drop.transition{-webkit-transform-origin:top center;-ms-transform-origin:top center;transform-origin:top center;-webkit-animation-timing-function:cubic-bezier(0.34,1.61,.7,1);animation-timing-function:cubic-bezier(0.34,1.61,.7,1)}.drop.transition.in{-webkit-animation-name:dropIn;animation-name:dropIn}.drop.transition.out{-webkit-animation-name:dropOut;animation-name:dropOut}@-webkit-keyframes dropIn{0%{opacity:0;-webkit-transform:scale(0);transform:scale(0)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes dropIn{0%{opacity:0;-webkit-transform:scale(0);transform:scale(0)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes dropOut{0%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}100%{opacity:0;-webkit-transform:scale(0);transform:scale(0)}}@keyframes dropOut{0%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}100%{opacity:0;-webkit-transform:scale(0);transform:scale(0)}}.browse.transition.in{-webkit-animation-name:browseIn;animation-name:browseIn;-webkit-animation-timing-function:ease;animation-timing-function:ease}.browse.transition.out,.browse.transition.out.left{-webkit-animation-name:browseOutLeft;animation-name:browseOutLeft;-webkit-animation-timing-function:ease;animation-timing-function:ease}.browse.transition.out.right{-webkit-animation-name:browseOutRight;animation-name:browseOutRight;-webkit-animation-timing-function:ease;animation-timing-function:ease}@-webkit-keyframes browseIn{0%{-webkit-transform:scale(0.8) translateZ(0px);transform:scale(0.8) translateZ(0px);z-index:-1}10%{-webkit-transform:scale(0.8) translateZ(0px);transform:scale(0.8) translateZ(0px);z-index:-1;opacity:.7}80%{-webkit-transform:scale(1.05) translateZ(0px);transform:scale(1.05) translateZ(0px);opacity:1;z-index:999}100%{-webkit-transform:scale(1) translateZ(0px);transform:scale(1) translateZ(0px);z-index:999}}@keyframes browseIn{0%{-webkit-transform:scale(0.8) translateZ(0px);transform:scale(0.8) translateZ(0px);z-index:-1}10%{-webkit-transform:scale(0.8) translateZ(0px);transform:scale(0.8) translateZ(0px);z-index:-1;opacity:.7}80%{-webkit-transform:scale(1.05) translateZ(0px);transform:scale(1.05) translateZ(0px);opacity:1;z-index:999}100%{-webkit-transform:scale(1) translateZ(0px);transform:scale(1) translateZ(0px);z-index:999}}@-webkit-keyframes browseOutLeft{0%{z-index:999;-webkit-transform:translateX(0%) rotateY(0deg) rotateX(0deg);transform:translateX(0%) rotateY(0deg) rotateX(0deg)}50%{z-index:-1;-webkit-transform:translateX(-105%) rotateY(35deg) rotateX(10deg) translateZ(-10px);transform:translateX(-105%) rotateY(35deg) rotateX(10deg) translateZ(-10px)}80%{opacity:1}100%{z-index:-1;-webkit-transform:translateX(0%) rotateY(0deg) rotateX(0deg) translateZ(-10px);transform:translateX(0%) rotateY(0deg) rotateX(0deg) translateZ(-10px);opacity:0}}@keyframes browseOutLeft{0%{z-index:999;-webkit-transform:translateX(0%) rotateY(0deg) rotateX(0deg);transform:translateX(0%) rotateY(0deg) rotateX(0deg)}50%{z-index:-1;-webkit-transform:translateX(-105%) rotateY(35deg) rotateX(10deg) translateZ(-10px);transform:translateX(-105%) rotateY(35deg) rotateX(10deg) translateZ(-10px)}80%{opacity:1}100%{z-index:-1;-webkit-transform:translateX(0%) rotateY(0deg) rotateX(0deg) translateZ(-10px);transform:translateX(0%) rotateY(0deg) rotateX(0deg) translateZ(-10px);opacity:0}}@-webkit-keyframes browseOutRight{0%{z-index:999;-webkit-transform:translateX(0%) rotateY(0deg) rotateX(0deg);transform:translateX(0%) rotateY(0deg) rotateX(0deg)}50%{z-index:1;-webkit-transform:translateX(105%) rotateY(35deg) rotateX(10deg) translateZ(-10px);transform:translateX(105%) rotateY(35deg) rotateX(10deg) translateZ(-10px)}80%{opacity:1}100%{z-index:1;-webkit-transform:translateX(0%) rotateY(0deg) rotateX(0deg) translateZ(-10px);transform:translateX(0%) rotateY(0deg) rotateX(0deg) translateZ(-10px);opacity:0}}@keyframes browseOutRight{0%{z-index:999;-webkit-transform:translateX(0%) rotateY(0deg) rotateX(0deg);transform:translateX(0%) rotateY(0deg) rotateX(0deg)}50%{z-index:1;-webkit-transform:translateX(105%) rotateY(35deg) rotateX(10deg) translateZ(-10px);transform:translateX(105%) rotateY(35deg) rotateX(10deg) translateZ(-10px)}80%{opacity:1}100%{z-index:1;-webkit-transform:translateX(0%) rotateY(0deg) rotateX(0deg) translateZ(-10px);transform:translateX(0%) rotateY(0deg) rotateX(0deg) translateZ(-10px);opacity:0}}
viskin/cdnjs
ajax/libs/semantic-ui/1.7.3/components/transition.min.css
CSS
mit
14,195
/** * @license * Lo-Dash 2.1.0 (Custom Build) <http://lodash.com/> * Build: `lodash mobile -o ./dist/lodash.mobile.js` * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE> * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <http://lodash.com/license> */ ;(function() { /** Used as a safe reference for `undefined` in pre ES5 environments */ var undefined; /** Used to pool arrays and objects used internally */ var arrayPool = [], objectPool = []; /** Used to generate unique IDs */ var idCounter = 0; /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */ var keyPrefix = +new Date + ''; /** Used as the size when optimizations are enabled for large arrays */ var largeArraySize = 75; /** Used as the max size of the `arrayPool` and `objectPool` */ var maxPoolSize = 40; /** Used to detect and test whitespace */ var whitespace = ( // whitespace ' \t\x0B\f\xA0\ufeff' + // line terminators '\n\r\u2028\u2029' + // unicode category "Zs" space separators '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' ); /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; /** * Used to match ES6 template delimiters * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6 */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; /** Used to match regexp flags from their coerced string values */ var reFlags = /\w*$/; /** Used to match "interpolate" template delimiters */ var reInterpolate = /<%=([\s\S]+?)%>/g; /** Used to match leading whitespace and zeros to be removed */ var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)'); /** Used to ensure capturing order of template delimiters */ var reNoMatch = /($^)/; /** Used to detect functions containing a `this` reference */ var reThis = /\bthis\b/; /** Used to match unescaped characters in compiled string literals */ var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g; /** Used to assign default `context` object properties */ var contextProps = [ 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', 'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', 'parseInt', 'setImmediate', 'setTimeout' ]; /** Used to make template sourceURLs easier to identify */ var templateCounter = 0; /** `Object#toString` result shortcuts */ var argsClass = '[object Arguments]', arrayClass = '[object Array]', boolClass = '[object Boolean]', dateClass = '[object Date]', funcClass = '[object Function]', numberClass = '[object Number]', objectClass = '[object Object]', regexpClass = '[object RegExp]', stringClass = '[object String]'; /** Used to identify object classifications that `_.clone` supports */ var cloneableClasses = {}; cloneableClasses[funcClass] = false; cloneableClasses[argsClass] = cloneableClasses[arrayClass] = cloneableClasses[boolClass] = cloneableClasses[dateClass] = cloneableClasses[numberClass] = cloneableClasses[objectClass] = cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true; /** Used to determine if values are of the language type Object */ var objectTypes = { 'boolean': false, 'function': true, 'object': true, 'number': false, 'string': false, 'undefined': false }; /** Used to escape characters for inclusion in compiled string literals */ var stringEscapes = { '\\': '\\', "'": "'", '\n': 'n', '\r': 'r', '\t': 't', '\u2028': 'u2028', '\u2029': 'u2029' }; /** Used as a reference to the global object */ var root = (objectTypes[typeof window] && window) || this; /** Detect free variable `exports` */ var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; /** Detect free variable `module` */ var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports` */ var moduleExports = freeModule && freeModule.exports === freeExports && freeExports; /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */ var freeGlobal = objectTypes[typeof global] && global; if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { root = freeGlobal; } /*--------------------------------------------------------------------------*/ /** * The base implementation of `_.indexOf` without support for binary searches * or `fromIndex` constraints. * * @private * @param {Array} array The array to search. * @param {*} value The value to search for. * @param {number} [fromIndex=0] The index to search from. * @returns {number} Returns the index of the matched value or `-1`. */ function baseIndexOf(array, value, fromIndex) { var index = (fromIndex || 0) - 1, length = array ? array.length : 0; while (++index < length) { if (array[index] === value) { return index; } } return -1; } /** * An implementation of `_.contains` for cache objects that mimics the return * signature of `_.indexOf` by returning `0` if the value is found, else `-1`. * * @private * @param {Object} cache The cache object to inspect. * @param {*} value The value to search for. * @returns {number} Returns `0` if `value` is found, else `-1`. */ function cacheIndexOf(cache, value) { var type = typeof value; cache = cache.cache; if (type == 'boolean' || value == null) { return cache[value] ? 0 : -1; } if (type != 'number' && type != 'string') { type = 'object'; } var key = type == 'number' ? value : keyPrefix + value; cache = (cache = cache[type]) && cache[key]; return type == 'object' ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1) : (cache ? 0 : -1); } /** * Adds a given value to the corresponding cache object. * * @private * @param {*} value The value to add to the cache. */ function cachePush(value) { var cache = this.cache, type = typeof value; if (type == 'boolean' || value == null) { cache[value] = true; } else { if (type != 'number' && type != 'string') { type = 'object'; } var key = type == 'number' ? value : keyPrefix + value, typeCache = cache[type] || (cache[type] = {}); if (type == 'object') { (typeCache[key] || (typeCache[key] = [])).push(value); } else { typeCache[key] = true; } } } /** * Used by `_.max` and `_.min` as the default callback when a given * collection is a string value. * * @private * @param {string} value The character to inspect. * @returns {number} Returns the code unit of given character. */ function charAtCallback(value) { return value.charCodeAt(0); } /** * Used by `sortBy` to compare transformed `collection` elements, stable sorting * them in ascending order. * * @private * @param {Object} a The object to compare to `b`. * @param {Object} b The object to compare to `a`. * @returns {number} Returns the sort order indicator of `1` or `-1`. */ function compareAscending(a, b) { var ac = a.criteria, bc = b.criteria; // ensure a stable sort in V8 and other engines // http://code.google.com/p/v8/issues/detail?id=90 if (ac !== bc) { if (ac > bc || typeof ac == 'undefined') { return 1; } if (ac < bc || typeof bc == 'undefined') { return -1; } } // The JS engine embedded in Adobe applications like InDesign has a buggy // `Array#sort` implementation that causes it, under certain circumstances, // to return the same value for `a` and `b`. // See https://github.com/jashkenas/underscore/pull/1247 return a.index - b.index; } /** * Creates a cache object to optimize linear searches of large arrays. * * @private * @param {Array} [array=[]] The array to search. * @returns {null|Object} Returns the cache object or `null` if caching should not be used. */ function createCache(array) { var index = -1, length = array.length, first = array[0], mid = array[(length / 2) | 0], last = array[length - 1]; if (first && typeof first == 'object' && mid && typeof mid == 'object' && last && typeof last == 'object') { return false; } var cache = getObject(); cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; var result = getObject(); result.array = array; result.cache = cache; result.push = cachePush; while (++index < length) { result.push(array[index]); } return result; } /** * Used by `template` to escape characters for inclusion in compiled * string literals. * * @private * @param {string} match The matched character to escape. * @returns {string} Returns the escaped character. */ function escapeStringChar(match) { return '\\' + stringEscapes[match]; } /** * Gets an array from the array pool or creates a new one if the pool is empty. * * @private * @returns {Array} The array from the pool. */ function getArray() { return arrayPool.pop() || []; } /** * Gets an object from the object pool or creates a new one if the pool is empty. * * @private * @returns {Object} The object from the pool. */ function getObject() { return objectPool.pop() || { 'array': null, 'cache': null, 'criteria': null, 'false': false, 'index': 0, 'leading': false, 'maxWait': 0, 'null': false, 'number': null, 'object': null, 'push': null, 'string': null, 'trailing': false, 'true': false, 'undefined': false, 'value': null }; } /** * A no-operation function. * * @private */ function noop() { // no operation performed } /** * Releases the given array back to the array pool. * * @private * @param {Array} [array] The array to release. */ function releaseArray(array) { array.length = 0; if (arrayPool.length < maxPoolSize) { arrayPool.push(array); } } /** * Releases the given object back to the object pool. * * @private * @param {Object} [object] The object to release. */ function releaseObject(object) { var cache = object.cache; if (cache) { releaseObject(cache); } object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; if (objectPool.length < maxPoolSize) { objectPool.push(object); } } /** * Slices the `collection` from the `start` index up to, but not including, * the `end` index. * * Note: This function is used instead of `Array#slice` to support node lists * in IE < 9 and to ensure dense arrays are returned. * * @private * @param {Array|Object|string} collection The collection to slice. * @param {number} start The start index. * @param {number} end The end index. * @returns {Array} Returns the new array. */ function slice(array, start, end) { start || (start = 0); if (typeof end == 'undefined') { end = array ? array.length : 0; } var index = -1, length = end - start || 0, result = Array(length < 0 ? 0 : length); while (++index < length) { result[index] = array[start + index]; } return result; } /*--------------------------------------------------------------------------*/ /** * Create a new `lodash` function using the given context object. * * @static * @memberOf _ * @category Utilities * @param {Object} [context=root] The context object. * @returns {Function} Returns the `lodash` function. */ function runInContext(context) { // Avoid issues with some ES3 environments that attempt to use values, named // after built-in constructors like `Object`, for the creation of literals. // ES5 clears this up by stating that literals must use built-in constructors. // See http://es5.github.io/#x11.1.5. context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root; /** Native constructor references */ var Array = context.Array, Boolean = context.Boolean, Date = context.Date, Error = context.Error, Function = context.Function, Math = context.Math, Number = context.Number, Object = context.Object, RegExp = context.RegExp, String = context.String, TypeError = context.TypeError; /** * Used for `Array` method references. * * Normally `Array.prototype` would suffice, however, using an array literal * avoids issues in Narwhal. */ var arrayRef = []; /** Used for native method references */ var errorProto = Error.prototype, objectProto = Object.prototype; /** Used to restore the original `_` reference in `noConflict` */ var oldDash = context._; /** Used to detect if a method is native */ var reNative = RegExp('^' + String(objectProto.valueOf) .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') .replace(/valueOf|for [^\]]+/g, '.+?') + '$' ); /** Native method shortcuts */ var ceil = Math.ceil, clearTimeout = context.clearTimeout, floor = Math.floor, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, push = arrayRef.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, setTimeout = context.setTimeout, splice = arrayRef.splice, toString = objectProto.toString, unshift = arrayRef.unshift; /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, nativeCreate = reNative.test(nativeCreate = Object.create) && nativeCreate, nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray, nativeIsFinite = context.isFinite, nativeIsNaN = context.isNaN, nativeKeys = reNative.test(nativeKeys = Object.keys) && nativeKeys, nativeMax = Math.max, nativeMin = Math.min, nativeParseInt = context.parseInt, nativeRandom = Math.random, nativeSlice = arrayRef.slice; /** Detect various environments */ var isIeOpera = reNative.test(context.attachEvent), isV8 = nativeBind && !/\n|true/.test(nativeBind + isIeOpera); /** Used to lookup a built-in constructor by [[Class]] */ var ctorByClass = {}; ctorByClass[arrayClass] = Array; ctorByClass[boolClass] = Boolean; ctorByClass[dateClass] = Date; ctorByClass[funcClass] = Function; ctorByClass[objectClass] = Object; ctorByClass[numberClass] = Number; ctorByClass[regexpClass] = RegExp; ctorByClass[stringClass] = String; /*--------------------------------------------------------------------------*/ /** * Creates a `lodash` object which wraps the given value to enable method * chaining. * * In addition to Lo-Dash methods, wrappers also have the following `Array` methods: * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, * and `unshift` * * Chaining is supported in custom builds as long as the `value` method is * implicitly or explicitly included in the build. * * The chainable wrapper functions are: * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, * `compose`, `concat`, `countBy`, `createCallback`, `curry`, `debounce`, * `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, `forEach`, * `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, * `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, * `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, `once`, `pairs`, * `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`, `range`, `reject`, * `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, * `unzip`, `values`, `where`, `without`, `wrap`, and `zip` * * The non-chainable wrapper functions are: * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`, * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, * `template`, `unescape`, `uniqueId`, and `value` * * The wrapper functions `first` and `last` return wrapped values when `n` is * provided, otherwise they return unwrapped values. * * @name _ * @constructor * @category Chaining * @param {*} value The value to wrap in a `lodash` instance. * @returns {Object} Returns a `lodash` instance. * @example * * var wrapped = _([1, 2, 3]); * * // returns an unwrapped value * wrapped.reduce(function(sum, num) { * return sum + num; * }); * // => 6 * * // returns a wrapped value * var squares = wrapped.map(function(num) { * return num * num; * }); * * _.isArray(squares); * // => false * * _.isArray(squares.value()); * // => true */ function lodash(value) { // don't wrap if already wrapped, even if wrapped by a different `lodash` constructor return (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__')) ? value : new lodashWrapper(value); } /** * A fast path for creating `lodash` wrapper objects. * * @private * @param {*} value The value to wrap in a `lodash` instance. * @param {boolean} chainAll A flag to enable chaining for all methods * @returns {Object} Returns a `lodash` instance. */ function lodashWrapper(value, chainAll) { this.__chain__ = !!chainAll; this.__wrapped__ = value; } // ensure `new lodashWrapper` is an instance of `lodash` lodashWrapper.prototype = lodash.prototype; /** * An object used to flag environments features. * * @static * @memberOf _ * @type Object */ var support = lodash.support = {}; /** * Detect if `name` or `message` properties of `Error.prototype` are * enumerable by default. (IE < 9, Safari < 5.1) * * @memberOf _.support * @type boolean */ support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); /** * Detect if `prototype` properties are enumerable by default. * * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 * (if the prototype or a property on the prototype has been set) * incorrectly sets a function's `prototype` property [[Enumerable]] * value to `true`. * * @memberOf _.support * @type boolean */ support.enumPrototypes = true; /** * Detect if `Function#bind` exists and is inferred to be fast (all but V8). * * @memberOf _.support * @type boolean */ support.fastBind = nativeBind && !isV8; /** * Detect if functions can be decompiled by `Function#toString` * (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps). * * @memberOf _.support * @type boolean */ support.funcDecomp = !reNative.test(context.WinRTError) && reThis.test(runInContext); /** * Detect if `arguments` object indexes are non-enumerable * (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1). * * @memberOf _.support * @type boolean */ support.nonEnumArgs = true; /** * By default, the template delimiters used by Lo-Dash are similar to those in * embedded Ruby (ERB). Change the following template settings to use alternative * delimiters. * * @static * @memberOf _ * @type Object */ lodash.templateSettings = { /** * Used to detect `data` property values to be HTML-escaped. * * @memberOf _.templateSettings * @type RegExp */ 'escape': /<%-([\s\S]+?)%>/g, /** * Used to detect code to be evaluated. * * @memberOf _.templateSettings * @type RegExp */ 'evaluate': /<%([\s\S]+?)%>/g, /** * Used to detect `data` property values to inject. * * @memberOf _.templateSettings * @type RegExp */ 'interpolate': reInterpolate, /** * Used to reference the data object in the template text. * * @memberOf _.templateSettings * @type string */ 'variable': '', /** * Used to import variables into the compiled template. * * @memberOf _.templateSettings * @type Object */ 'imports': { /** * A reference to the `lodash` function. * * @memberOf _.templateSettings.imports * @type Function */ '_': lodash } }; /*--------------------------------------------------------------------------*/ /** * The base implementation of `_.clone` without argument juggling or support * for `thisArg` binding. * * @private * @param {*} value The value to clone. * @param {boolean} [deep=false] Specify a deep clone. * @param {Function} [callback] The function to customize cloning values. * @param {Array} [stackA=[]] Tracks traversed source objects. * @param {Array} [stackB=[]] Associates clones with source counterparts. * @returns {*} Returns the cloned `value`. */ function baseClone(value, deep, callback, stackA, stackB) { var result = value; if (callback) { result = callback(result); if (typeof result != 'undefined') { return result; } result = value; } // inspect [[Class]] var isObj = isObject(result); if (isObj) { var className = toString.call(result); if (!cloneableClasses[className]) { return result; } var isArr = isArray(result); } // shallow clone if (!isObj || !deep) { return isObj ? (isArr ? slice(result) : assign({}, result)) : result; } var ctor = ctorByClass[className]; switch (className) { case boolClass: case dateClass: return new ctor(+result); case numberClass: case stringClass: return new ctor(result); case regexpClass: return ctor(result.source, reFlags.exec(result)); } // check for circular references and return corresponding clone var initedStack = !stackA; stackA || (stackA = getArray()); stackB || (stackB = getArray()); var length = stackA.length; while (length--) { if (stackA[length] == value) { return stackB[length]; } } // init cloned object result = isArr ? ctor(result.length) : {}; // add array properties assigned by `RegExp#exec` if (isArr) { if (hasOwnProperty.call(value, 'index')) { result.index = value.index; } if (hasOwnProperty.call(value, 'input')) { result.input = value.input; } } // add the source value to the stack of traversed objects // and associate it with its clone stackA.push(value); stackB.push(result); // recursively populate clone (susceptible to call stack limits) (isArr ? baseEach : forOwn)(value, function(objValue, key) { result[key] = baseClone(objValue, deep, callback, stackA, stackB); }); if (initedStack) { releaseArray(stackA); releaseArray(stackB); } return result; } /** * The base implementation of `_.createCallback` without support for creating * "_.pluck" or "_.where" style callbacks. * * @private * @param {*} [func=identity] The value to convert to a callback. * @param {*} [thisArg] The `this` binding of the created callback. * @param {number} [argCount] The number of arguments the callback accepts. * @returns {Function} Returns a callback function. */ function baseCreateCallback(func, thisArg, argCount) { if (typeof func != 'function') { return identity; } // exit early if there is no `thisArg` if (typeof thisArg == 'undefined') { return func; } switch (argCount) { case 1: return function(value) { return func.call(thisArg, value); }; case 2: return function(a, b) { return func.call(thisArg, a, b); }; case 3: return function(value, index, collection) { return func.call(thisArg, value, index, collection); }; case 4: return function(accumulator, value, index, collection) { return func.call(thisArg, accumulator, value, index, collection); }; } return bind(func, thisArg); } /** * The base implementation of `_.flatten` without support for callback * shorthands or `thisArg` binding. * * @private * @param {Array} array The array to flatten. * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. * @param {boolean} [isArgArrays=false] A flag to restrict flattening to arrays and `arguments` objects. * @param {number} [fromIndex=0] The index to start from. * @returns {Array} Returns a new flattened array. */ function baseFlatten(array, isShallow, isArgArrays, fromIndex) { var index = (fromIndex || 0) - 1, length = array ? array.length : 0, result = []; while (++index < length) { var value = array[index]; if (value && typeof value == 'object' && typeof value.length == 'number' && (isArray(value) || isArguments(value))) { // recursively flatten arrays (susceptible to call stack limits) if (!isShallow) { value = baseFlatten(value, isShallow, isArgArrays); } var valIndex = -1, valLength = value.length, resIndex = result.length; result.length += valLength; while (++valIndex < valLength) { result[resIndex++] = value[valIndex]; } } else if (!isArgArrays) { result.push(value); } } return result; } /** * The base implementation of `_.isEqual`, without support for `thisArg` binding, * that allows partial "_.where" style comparisons. * * @private * @param {*} a The value to compare. * @param {*} b The other value to compare. * @param {Function} [callback] The function to customize comparing values. * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons. * @param {Array} [stackA=[]] Tracks traversed `a` objects. * @param {Array} [stackB=[]] Tracks traversed `b` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(a, b, callback, isWhere, stackA, stackB) { // used to indicate that when comparing objects, `a` has at least the properties of `b` if (callback) { var result = callback(a, b); if (typeof result != 'undefined') { return !!result; } } // 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 && objectTypes[type]) && !(b && objectTypes[otherType])) { return false; } // exit early for `null` and `undefined` avoiding ES3's Function#call behavior // http://es5.github.io/#x15.3.4.4 if (a == null || b == null) { return a === b; } // 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) { // unwrap any `lodash` wrapped values if (hasOwnProperty.call(a, '__wrapped__ ') || hasOwnProperty.call(b, '__wrapped__')) { return baseIsEqual(a.__wrapped__ || a, b.__wrapped__ || b, callback, isWhere, stackA, stackB); } // exit for functions and DOM nodes if (className != objectClass) { return false; } // in older versions of Opera, `arguments` objects have `Array` constructors var ctorA = a.constructor, ctorB = b.constructor; // non `Object` object instances with different constructors are not equal if (ctorA != ctorB && !( isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB )) { 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 = getArray()); stackB || (stackB = getArray()); 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) { length = a.length; size = b.length; // compare lengths to determine if a deep comparison is necessary result = size == a.length; if (!result && !isWhere) { return result; } // deep compare the contents, ignoring non-numeric properties while (size--) { var index = length, value = b[size]; if (isWhere) { while (index--) { if ((result = baseIsEqual(a[index], value, callback, isWhere, stackA, stackB))) { break; } } } else if (!(result = baseIsEqual(a[size], value, callback, isWhere, stackA, stackB))) { break; } } return result; } // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` // which, in this case, is more costly forIn(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) && baseIsEqual(a[key], value, callback, isWhere, stackA, stackB)); } }); if (result && !isWhere) { // ensure both objects have the same number of properties forIn(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); } }); } if (initedStack) { releaseArray(stackA); releaseArray(stackB); } return result; } /** * The base implementation of `_.merge` without argument juggling or support * for `thisArg` binding. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {Function} [callback] The function to customize merging properties. * @param {Array} [stackA=[]] Tracks traversed source objects. * @param {Array} [stackB=[]] Associates values with source counterparts. */ function baseMerge(object, source, callback, stackA, stackB) { (isArray(source) ? forEach : forOwn)(source, function(source, key) { var found, isArr, result = source, value = object[key]; if (source && ((isArr = isArray(source)) || isPlainObject(source))) { // avoid merging previously merged cyclic sources var stackLength = stackA.length; while (stackLength--) { if ((found = stackA[stackLength] == source)) { value = stackB[stackLength]; break; } } if (!found) { var isShallow; if (callback) { result = callback(value, source); if ((isShallow = typeof result != 'undefined')) { value = result; } } if (!isShallow) { value = isArr ? (isArray(value) ? value : []) : (isPlainObject(value) ? value : {}); } // add `source` and associated `value` to the stack of traversed objects stackA.push(source); stackB.push(value); // recursively merge objects and arrays (susceptible to call stack limits) if (!isShallow) { baseMerge(value, source, callback, stackA, stackB); } } } else { if (callback) { result = callback(value, source); if (typeof result == 'undefined') { result = source; } } if (typeof result != 'undefined') { value = result; } } object[key] = value; }); } /** * The base implementation of `_.uniq` without support for callback shorthands * or `thisArg` binding. * * @private * @param {Array} array The array to process. * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted. * @param {Function} [callback] The function called per iteration. * @returns {Array} Returns a duplicate-value-free array. */ function baseUniq(array, isSorted, callback) { var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, result = []; var isLarge = !isSorted && length >= largeArraySize && indexOf === baseIndexOf, seen = (callback || isLarge) ? getArray() : result; if (isLarge) { var cache = createCache(seen); if (cache) { indexOf = cacheIndexOf; seen = cache; } else { isLarge = false; seen = callback ? seen : (releaseArray(seen), result); } } while (++index < length) { var value = array[index], computed = callback ? callback(value, index, array) : value; if (isSorted ? !index || seen[seen.length - 1] !== computed : indexOf(seen, computed) < 0 ) { if (callback || isLarge) { seen.push(computed); } result.push(value); } } if (isLarge) { releaseArray(seen.array); releaseObject(seen); } else if (callback) { releaseArray(seen); } return result; } /** * Creates a function that aggregates a collection, creating an object composed * of keys generated from the results of running each element of the collection * through a callback. The given `setter` function sets the keys and values * of the composed object. * * @private * @param {Function} setter The setter function. * @returns {Function} Returns the new aggregator function. */ function createAggregator(setter) { return function(collection, callback, thisArg) { var result = {}; callback = lodash.createCallback(callback, thisArg, 3); if (isArray(collection)) { var index = -1, length = collection.length; while (++index < length) { var value = collection[index]; setter(result, value, callback(value, index, collection), collection); } } else { baseEach(collection, function(value, key, collection) { setter(result, value, callback(value, key, collection), collection); }); } return result; }; } /** * Creates a function that, when called, either curries or invokes `func` * with an optional `this` binding and partially applied arguments. * * @private * @param {Function|string} func The function or method name to reference. * @param {number} bitmask The bitmask of method flags to compose. * The bitmask may be composed of the following flags: * 1 - `_.bind` * 2 - `_.bindKey` * 4 - `_.curry` * 8 - `_.curry` (bound) * 16 - `_.partial` * 32 - `_.partialRight` * @param {Array} [partialArgs] An array of arguments to prepend to those * provided to the new function. * @param {Array} [partialRightArgs] An array of arguments to append to those * provided to the new function. * @param {*} [thisArg] The `this` binding of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new bound function. */ function createBound(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) { var isBind = bitmask & 1, isBindKey = bitmask & 2, isCurry = bitmask & 4, isCurryBound = bitmask & 8, isPartial = bitmask & 16, isPartialRight = bitmask & 32, key = func; if (!isBindKey && !isFunction(func)) { throw new TypeError; } if (isPartial && !partialArgs.length) { bitmask &= ~16; isPartial = partialArgs = false; } if (isPartialRight && !partialRightArgs.length) { bitmask &= ~32; isPartialRight = partialRightArgs = false; } // use `Function#bind` if it exists and is fast // (in V8 `Function#bind` is slower except when partially applied) if (isBind && !(isBindKey || isCurry || isPartialRight) && (support.fastBind || (nativeBind && isPartial))) { if (isPartial) { var args = [thisArg]; push.apply(args, partialArgs); } var bound = isPartial ? nativeBind.apply(func, args) : nativeBind.call(func, thisArg); } else { bound = function() { // `Function#bind` spec // http://es5.github.io/#x15.3.4.5 var args = arguments, thisBinding = isBind ? thisArg : this; if (isCurry || isPartial || isPartialRight) { args = nativeSlice.call(args); if (isPartial) { unshift.apply(args, partialArgs); } if (isPartialRight) { push.apply(args, partialRightArgs); } if (isCurry && args.length < arity) { bitmask |= 16 & ~32; return createBound(func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity); } } if (isBindKey) { func = thisBinding[key]; } if (this instanceof bound) { // ensure `new bound` is an instance of `func` thisBinding = createObject(func.prototype); // mimic the constructor's `return` behavior // http://es5.github.io/#x13.2.2 var result = func.apply(thisBinding, args); return isObject(result) ? result : thisBinding; } return func.apply(thisBinding, args); }; } return bound; } /** * Creates a new object with the specified `prototype`. * * @private * @param {Object} prototype The prototype object. * @returns {Object} Returns the new object. */ function createObject(prototype) { return isObject(prototype) ? nativeCreate(prototype) : {}; } // fallback for browsers without `Object.create` if (!nativeCreate) { createObject = function(prototype) { if (isObject(prototype)) { noop.prototype = prototype; var result = new noop; noop.prototype = null; } return result || {}; }; } /** * Used by `escape` to convert characters to HTML entities. * * @private * @param {string} match The matched character to escape. * @returns {string} Returns the escaped character. */ function escapeHtmlChar(match) { return htmlEscapes[match]; } /** * Gets the appropriate "indexOf" function. If the `_.indexOf` method is * customized, this method returns the custom method, otherwise it returns * the `baseIndexOf` function. * * @private * @returns {Function} Returns the "indexOf" function. */ function getIndexOf() { var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result; return result; } /** * A fallback implementation of `isPlainObject` which checks if a given value * is an object created by the `Object` constructor, assuming objects created * by the `Object` constructor have no inherited enumerable properties and that * there are no `Object.prototype` extensions. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. */ function shimIsPlainObject(value) { var ctor, result; // avoid non Object objects, `arguments` objects, and DOM elements if (!(value && toString.call(value) == objectClass) || (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor))) { return false; } // In most environments an object's own properties are iterated before // its inherited properties. If the last iterated property is an object's // own property then there are no inherited enumerable properties. forIn(value, function(value, key) { result = key; }); return typeof result == 'undefined' || hasOwnProperty.call(value, result); } /** * Used by `unescape` to convert HTML entities to characters. * * @private * @param {string} match The matched character to unescape. * @returns {string} Returns the unescaped character. */ function unescapeHtmlChar(match) { return htmlUnescapes[match]; } /*--------------------------------------------------------------------------*/ /** * Checks if `value` is an `arguments` object. * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`. * @example * * (function() { return _.isArguments(arguments); })(1, 2, 3); * // => true * * _.isArguments([1, 2, 3]); * // => false */ function isArguments(value) { return value && typeof value == 'object' && typeof value.length == 'number' && toString.call(value) == argsClass || false; } /** * Checks if `value` is an array. * * @static * @memberOf _ * @type Function * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is an array, else `false`. * @example * * (function() { return _.isArray(arguments); })(); * // => false * * _.isArray([1, 2, 3]); * // => true */ var isArray = nativeIsArray || function(value) { return value && typeof value == 'object' && typeof value.length == 'number' && toString.call(value) == arrayClass || false; }; /** * A fallback implementation of `Object.keys` which produces an array of the * given object's own enumerable property names. * * @private * @type Function * @param {Object} object The object to inspect. * @returns {Array} Returns an array of property names. */ var shimKeys = function(object) { var index, iterable = object, result = []; if (!iterable) return result; if (!(objectTypes[typeof object])) return result; var length = iterable.length; index = -1; if (length && isArguments(iterable)) { while (++index < length) { index += ''; result.push(index); } } else { var skipProto = typeof iterable == 'function'; for (index in iterable) { if (!(skipProto && index == "prototype") && hasOwnProperty.call(iterable, index)) { result.push(index); } } } return result }; /** * Creates an array composed of the own enumerable property names of an object. * * @static * @memberOf _ * @category Objects * @param {Object} object The object to inspect. * @returns {Array} Returns an array of property names. * @example * * _.keys({ 'one': 1, 'two': 2, 'three': 3 }); * // => ['one', 'two', 'three'] (property order is not guaranteed across environments) */ var keys = !nativeKeys ? shimKeys : function(object) { if (!isObject(object)) { return []; } if ((support.enumPrototypes && typeof object == 'function') || (support.nonEnumArgs && object.length && isArguments(object))) { return shimKeys(object); } return nativeKeys(object); }; /** * Used to convert characters to HTML entities: * * Though the `>` character is escaped for symmetry, characters like `>` and `/` * don't require escaping in HTML and have no special meaning unless they're part * of a tag or an unquoted attribute value. * http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact") */ var htmlEscapes = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }; /** Used to convert HTML entities to characters */ var htmlUnescapes = invert(htmlEscapes); /** Used to match HTML entities and HTML characters */ var reEscapedHtml = RegExp('(' + keys(htmlUnescapes).join('|') + ')', 'g'), reUnescapedHtml = RegExp('[' + keys(htmlEscapes).join('') + ']', 'g'); /** * A function compiled to iterate `arguments` objects, arrays, objects, and * strings consistenly across environments, executing the callback for each * element in the collection. The callback is bound to `thisArg` and invoked * with three arguments; (value, index|key, collection). Callbacks may exit * iteration early by explicitly returning `false`. * * @private * @type Function * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} [callback=identity] The function called per iteration. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Array|Object|string} Returns `collection`. */ var baseEach = function(collection, callback, thisArg) { var index, iterable = collection, result = iterable; if (!iterable) return result; callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); var length = iterable.length; index = -1; if (typeof length == 'number') { while (++index < length) { if (callback(iterable[index], index, collection) === false) return result; } } else { var skipProto = typeof iterable == 'function'; for (index in iterable) { if (!(skipProto && index == "prototype") && hasOwnProperty.call(iterable, index)) { if (callback(iterable[index], index, collection) === false) return result; } } } return result }; /*--------------------------------------------------------------------------*/ /** * Assigns own enumerable properties of source object(s) to the destination * object. Subsequent sources will overwrite property assignments of previous * sources. If a callback is provided it will be executed to produce the * assigned values. The callback is bound to `thisArg` and invoked with two * arguments; (objectValue, sourceValue). * * @static * @memberOf _ * @type Function * @alias extend * @category Objects * @param {Object} object The destination object. * @param {...Object} [source] The source objects. * @param {Function} [callback] The function to customize assigning values. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the destination object. * @example * * _.assign({ 'name': 'moe' }, { 'age': 40 }); * // => { 'name': 'moe', 'age': 40 } * * var defaults = _.partialRight(_.assign, function(a, b) { * return typeof a == 'undefined' ? b : a; * }); * * var food = { 'name': 'apple' }; * defaults(food, { 'name': 'banana', 'type': 'fruit' }); * // => { 'name': 'apple', 'type': 'fruit' } */ var assign = function(object, source, guard) { var index, iterable = object, result = iterable; if (!iterable) return result; var args = arguments, argsIndex = 0, argsLength = typeof guard == 'number' ? 2 : args.length; if (argsLength > 3 && typeof args[argsLength - 2] == 'function') { var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2); } else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') { callback = args[--argsLength]; } while (++argsIndex < argsLength) { iterable = args[argsIndex]; if (iterable && objectTypes[typeof iterable]) { var length = iterable.length; index = -1; if (length && isArguments(iterable)) { while (++index < length) { index += ''; result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]; } } else { var skipProto = typeof iterable == 'function'; for (index in iterable) { if (!(skipProto && index == "prototype") && hasOwnProperty.call(iterable, index)) { result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]; } } } } } return result }; /** * Creates a clone of `value`. If `deep` is `true` nested objects will also * be cloned, otherwise they will be assigned by reference. If a callback * is provided it will be executed to produce the cloned values. If the * callback returns `undefined` cloning will be handled by the method instead. * The callback is bound to `thisArg` and invoked with one argument; (value). * * @static * @memberOf _ * @category Objects * @param {*} value The value to clone. * @param {boolean} [deep=false] Specify a deep clone. * @param {Function} [callback] The function to customize cloning values. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {*} Returns the cloned `value`. * @example * * var stooges = [ * { 'name': 'moe', 'age': 40 }, * { 'name': 'larry', 'age': 50 } * ]; * * var shallow = _.clone(stooges); * shallow[0] === stooges[0]; * // => true * * var deep = _.clone(stooges, true); * deep[0] === stooges[0]; * // => false * * _.mixin({ * 'clone': _.partialRight(_.clone, function(value) { * return _.isElement(value) ? value.cloneNode(false) : undefined; * }) * }); * * var clone = _.clone(document.body); * clone.childNodes.length; * // => 0 */ function clone(value, deep, callback, thisArg) { // allows working with "Collections" methods without using their `index` // and `collection` arguments for `deep` and `callback` if (typeof deep != 'boolean' && deep != null) { thisArg = callback; callback = deep; deep = false; } return baseClone(value, deep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1)); } /** * Creates a deep clone of `value`. If a callback is provided it will be * executed to produce the cloned values. If the callback returns `undefined` * cloning will be handled by the method instead. The callback is bound to * `thisArg` and invoked with one argument; (value). * * Note: This method is loosely based on the structured clone algorithm. Functions * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and * objects created by constructors other than `Object` are cloned to plain `Object` objects. * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. * * @static * @memberOf _ * @category Objects * @param {*} value The value to deep clone. * @param {Function} [callback] The function to customize cloning values. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {*} Returns the deep cloned `value`. * @example * * var stooges = [ * { 'name': 'moe', 'age': 40 }, * { 'name': 'larry', 'age': 50 } * ]; * * var deep = _.cloneDeep(stooges); * deep[0] === stooges[0]; * // => false * * var view = { * 'label': 'docs', * 'node': element * }; * * var clone = _.cloneDeep(view, function(value) { * return _.isElement(value) ? value.cloneNode(true) : undefined; * }); * * clone.node == view.node; * // => false */ function cloneDeep(value, callback, thisArg) { return baseClone(value, true, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1)); } /** * Assigns own enumerable properties of source object(s) to the destination * object for all destination properties that resolve to `undefined`. Once a * property is set, additional defaults of the same property will be ignored. * * @static * @memberOf _ * @type Function * @category Objects * @param {Object} object The destination object. * @param {...Object} [source] The source objects. * @param- {Object} [guard] Allows working with `_.reduce` without using its * `key` and `object` arguments as sources. * @returns {Object} Returns the destination object. * @example * * var food = { 'name': 'apple' }; * _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); * // => { 'name': 'apple', 'type': 'fruit' } */ var defaults = function(object, source, guard) { var index, iterable = object, result = iterable; if (!iterable) return result; var args = arguments, argsIndex = 0, argsLength = typeof guard == 'number' ? 2 : args.length; while (++argsIndex < argsLength) { iterable = args[argsIndex]; if (iterable && objectTypes[typeof iterable]) { var length = iterable.length; index = -1; if (length && isArguments(iterable)) { while (++index < length) { index += ''; if (typeof result[index] == 'undefined') result[index] = iterable[index]; } } else { var skipProto = typeof iterable == 'function'; for (index in iterable) { if (!(skipProto && index == "prototype") && hasOwnProperty.call(iterable, index)) { if (typeof result[index] == 'undefined') result[index] = iterable[index]; } } } } } return result }; /** * This method is like `_.findIndex` except that it returns the key of the * first element that passes the callback check, instead of the element itself. * * @static * @memberOf _ * @category Objects * @param {Object} object The object to search. * @param {Function|Object|string} [callback=identity] The function called per * iteration. If a property name or object is provided it will be used to * create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {string|undefined} Returns the key of the found element, else `undefined`. * @example * * _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { * return num % 2 == 0; * }); * // => 'b' (property order is not guaranteed across environments) */ function findKey(object, callback, thisArg) { var result; callback = lodash.createCallback(callback, thisArg, 3); forOwn(object, function(value, key, object) { if (callback(value, key, object)) { result = key; return false; } }); return result; } /** * This method is like `_.findKey` except that it iterates over elements * of a `collection` in the opposite order. * * @static * @memberOf _ * @category Objects * @param {Object} object The object to search. * @param {Function|Object|string} [callback=identity] The function called per * iteration. If a property name or object is provided it will be used to * create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {string|undefined} Returns the key of the found element, else `undefined`. * @example * * _.findLastKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { * return num % 2 == 1; * }); * // => returns `c`, assuming `_.findKey` returns `a` */ function findLastKey(object, callback, thisArg) { var result; callback = lodash.createCallback(callback, thisArg, 3); forOwnRight(object, function(value, key, object) { if (callback(value, key, object)) { result = key; return false; } }); return result; } /** * Iterates over own and inherited enumerable properties of an object, * executing the callback for each property. The callback is bound to `thisArg` * and invoked with three arguments; (value, key, object). Callbacks may exit * iteration early by explicitly returning `false`. * * @static * @memberOf _ * @type Function * @category Objects * @param {Object} object The object to iterate over. * @param {Function} [callback=identity] The function called per iteration. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns `object`. * @example * * function Dog(name) { * this.name = name; * } * * Dog.prototype.bark = function() { * console.log('Woof, woof!'); * }; * * _.forIn(new Dog('Dagny'), function(value, key) { * console.log(key); * }); * // => logs 'bark' and 'name' (property order is not guaranteed across environments) */ var forIn = function(collection, callback, thisArg) { var index, iterable = collection, result = iterable; if (!iterable) return result; if (!objectTypes[typeof iterable]) return result; callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); var length = iterable.length; index = -1; if (length && isArguments(iterable)) { while (++index < length) { index += ''; if (callback(iterable[index], index, collection) === false) return result; } } else { var skipProto = typeof iterable == 'function'; for (index in iterable) { if (!(skipProto && index == "prototype")) { if (callback(iterable[index], index, collection) === false) return result; } } } return result }; /** * This method is like `_.forIn` except that it iterates over elements * of a `collection` in the opposite order. * * @static * @memberOf _ * @category Objects * @param {Object} object The object to iterate over. * @param {Function} [callback=identity] The function called per iteration. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns `object`. * @example * * function Dog(name) { * this.name = name; * } * * Dog.prototype.bark = function() { * console.log('Woof, woof!'); * }; * * _.forInRight(new Dog('Dagny'), function(value, key) { * console.log(key); * }); * // => logs 'name' and 'bark' assuming `_.forIn ` logs 'bark' and 'name' */ function forInRight(object, callback, thisArg) { var pairs = []; forIn(object, function(value, key) { pairs.push(key, value); }); var length = pairs.length; callback = baseCreateCallback(callback, thisArg, 3); while (length--) { if (callback(pairs[length--], pairs[length], object) === false) { break; } } return object; } /** * Iterates over own enumerable properties of an object, executing the callback * for each property. The callback is bound to `thisArg` and invoked with three * arguments; (value, key, object). Callbacks may exit iteration early by * explicitly returning `false`. * * @static * @memberOf _ * @type Function * @category Objects * @param {Object} object The object to iterate over. * @param {Function} [callback=identity] The function called per iteration. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns `object`. * @example * * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { * console.log(key); * }); * // => logs '0', '1', and 'length' (property order is not guaranteed across environments) */ var forOwn = function(collection, callback, thisArg) { var index, iterable = collection, result = iterable; if (!iterable) return result; if (!objectTypes[typeof iterable]) return result; callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); var length = iterable.length; index = -1; if (length && isArguments(iterable)) { while (++index < length) { index += ''; if (callback(iterable[index], index, collection) === false) return result; } } else { var skipProto = typeof iterable == 'function'; for (index in iterable) { if (!(skipProto && index == "prototype") && hasOwnProperty.call(iterable, index)) { if (callback(iterable[index], index, collection) === false) return result; } } } return result }; /** * This method is like `_.forOwn` except that it iterates over elements * of a `collection` in the opposite order. * * @static * @memberOf _ * @category Objects * @param {Object} object The object to iterate over. * @param {Function} [callback=identity] The function called per iteration. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns `object`. * @example * * _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { * console.log(key); * }); * // => logs 'length', '1', and '0' assuming `_.forOwn` logs '0', '1', and 'length' */ function forOwnRight(object, callback, thisArg) { var props = keys(object), length = props.length; callback = baseCreateCallback(callback, thisArg, 3); while (length--) { var key = props[length]; if (callback(object[key], key, object) === false) { break; } } return object; } /** * Creates a sorted array of property names of all enumerable properties, * own and inherited, of `object` that have function values. * * @static * @memberOf _ * @alias methods * @category Objects * @param {Object} object The object to inspect. * @returns {Array} Returns an array of property names that have function values. * @example * * _.functions(_); * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...] */ function functions(object) { var result = []; forIn(object, function(value, key) { if (isFunction(value)) { result.push(key); } }); return result.sort(); } /** * Checks if the specified object `property` exists and is a direct property, * instead of an inherited property. * * @static * @memberOf _ * @category Objects * @param {Object} object The object to check. * @param {string} property The property to check for. * @returns {boolean} Returns `true` if key is a direct property, else `false`. * @example * * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); * // => true */ function has(object, property) { return object ? hasOwnProperty.call(object, property) : false; } /** * Creates an object composed of the inverted keys and values of the given object. * * @static * @memberOf _ * @category Objects * @param {Object} object The object to invert. * @returns {Object} Returns the created inverted object. * @example * * _.invert({ 'first': 'moe', 'second': 'larry' }); * // => { 'moe': 'first', 'larry': 'second' } */ function invert(object) { var index = -1, props = keys(object), length = props.length, result = {}; while (++index < length) { var key = props[index]; result[object[key]] = key; } return result; } /** * Checks if `value` is a boolean value. * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is a boolean value, else `false`. * @example * * _.isBoolean(null); * // => false */ function isBoolean(value) { return value === true || value === false || toString.call(value) == boolClass; } /** * Checks if `value` is a date. * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is a date, else `false`. * @example * * _.isDate(new Date); * // => true */ function isDate(value) { return value ? (typeof value == 'object' && toString.call(value) == dateClass) : false; } /** * Checks if `value` is a DOM element. * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`. * @example * * _.isElement(document.body); * // => true */ function isElement(value) { return value ? value.nodeType === 1 : false; } /** * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a * length of `0` and objects with no own enumerable properties are considered * "empty". * * @static * @memberOf _ * @category Objects * @param {Array|Object|string} value The value to inspect. * @returns {boolean} Returns `true` if the `value` is empty, else `false`. * @example * * _.isEmpty([1, 2, 3]); * // => false * * _.isEmpty({}); * // => true * * _.isEmpty(''); * // => true */ function isEmpty(value) { var result = true; if (!value) { return result; } var className = toString.call(value), length = value.length; if ((className == arrayClass || className == stringClass || className == argsClass ) || (className == objectClass && typeof length == 'number' && isFunction(value.splice))) { return !length; } forOwn(value, function() { return (result = false); }); return result; } /** * Performs a deep comparison between two values to determine if they are * equivalent to each other. If a callback is provided it will be executed * to compare values. If the callback returns `undefined` comparisons will * be handled by the method instead. The callback is bound to `thisArg` and * invoked with two arguments; (a, b). * * @static * @memberOf _ * @category Objects * @param {*} a The value to compare. * @param {*} b The other value to compare. * @param {Function} [callback] The function to customize comparing values. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var moe = { 'name': 'moe', 'age': 40 }; * var copy = { 'name': 'moe', 'age': 40 }; * * moe == copy; * // => false * * _.isEqual(moe, copy); * // => true * * var words = ['hello', 'goodbye']; * var otherWords = ['hi', 'goodbye']; * * _.isEqual(words, otherWords, function(a, b) { * var reGreet = /^(?:hello|hi)$/i, * aGreet = _.isString(a) && reGreet.test(a), * bGreet = _.isString(b) && reGreet.test(b); * * return (aGreet || bGreet) ? (aGreet == bGreet) : undefined; * }); * // => true */ function isEqual(a, b, callback, thisArg) { return baseIsEqual(a, b, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 2)); } /** * Checks if `value` is, or can be coerced to, a finite number. * * Note: This is not the same as native `isFinite` which will return true for * booleans and empty strings. See http://es5.github.io/#x15.1.2.5. * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is finite, else `false`. * @example * * _.isFinite(-101); * // => true * * _.isFinite('10'); * // => true * * _.isFinite(true); * // => false * * _.isFinite(''); * // => false * * _.isFinite(Infinity); * // => false */ function isFinite(value) { return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value)); } /** * Checks if `value` is a function. * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true */ function isFunction(value) { return typeof value == 'function'; } // fallback for older versions of Chrome and Safari if (isFunction(/x/)) { isFunction = function(value) { return typeof value == 'function' && toString.call(value) == funcClass; }; } /** * Checks if `value` is the language type of Object. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(1); * // => false */ function isObject(value) { // check if the value is the ECMAScript language type of Object // http://es5.github.io/#x8 // and avoid a V8 bug // http://code.google.com/p/v8/issues/detail?id=2291 return !!(value && objectTypes[typeof value]); } /** * Checks if `value` is `NaN`. * * Note: This is not the same as native `isNaN` which will return `true` for * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4. * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is `NaN`, else `false`. * @example * * _.isNaN(NaN); * // => true * * _.isNaN(new Number(NaN)); * // => true * * isNaN(undefined); * // => true * * _.isNaN(undefined); * // => false */ function isNaN(value) { // `NaN` as a primitive is the only value that is not equal to itself // (perform the [[Class]] check first to avoid errors with some host objects in IE) return isNumber(value) && value != +value; } /** * Checks if `value` is `null`. * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is `null`, else `false`. * @example * * _.isNull(null); * // => true * * _.isNull(undefined); * // => false */ function isNull(value) { return value === null; } /** * Checks if `value` is a number. * * Note: `NaN` is considered a number. See http://es5.github.io/#x8.5. * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is a number, else `false`. * @example * * _.isNumber(8.4 * 5); * // => true */ function isNumber(value) { return typeof value == 'number' || toString.call(value) == numberClass; } /** * Checks if `value` is an object created by the `Object` constructor. * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Stooge(name, age) { * this.name = name; * this.age = age; * } * * _.isPlainObject(new Stooge('moe', 40)); * // => false * * _.isPlainObject([1, 2, 3]); * // => false * * _.isPlainObject({ 'name': 'moe', 'age': 40 }); * // => true */ var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { if (!(value && toString.call(value) == objectClass)) { return false; } var valueOf = value.valueOf, objProto = typeof valueOf == 'function' && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); return objProto ? (value == objProto || getPrototypeOf(value) == objProto) : shimIsPlainObject(value); }; /** * Checks if `value` is a regular expression. * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is a regular expression, else `false`. * @example * * _.isRegExp(/moe/); * // => true */ function isRegExp(value) { return (value && objectTypes[typeof value]) ? toString.call(value) == regexpClass : false; } /** * Checks if `value` is a string. * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is a string, else `false`. * @example * * _.isString('moe'); * // => true */ function isString(value) { return typeof value == 'string' || toString.call(value) == stringClass; } /** * Checks if `value` is `undefined`. * * @static * @memberOf _ * @category Objects * @param {*} value The value to check. * @returns {boolean} Returns `true` if the `value` is `undefined`, else `false`. * @example * * _.isUndefined(void 0); * // => true */ function isUndefined(value) { return typeof value == 'undefined'; } /** * Recursively merges own enumerable properties of the source object(s), that * don't resolve to `undefined` into the destination object. Subsequent sources * will overwrite property assignments of previous sources. If a callback is * provided it will be executed to produce the merged values of the destination * and source properties. If the callback returns `undefined` merging will * be handled by the method instead. The callback is bound to `thisArg` and * invoked with two arguments; (objectValue, sourceValue). * * @static * @memberOf _ * @category Objects * @param {Object} object The destination object. * @param {...Object} [source] The source objects. * @param {Function} [callback] The function to customize merging properties. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the destination object. * @example * * var names = { * 'stooges': [ * { 'name': 'moe' }, * { 'name': 'larry' } * ] * }; * * var ages = { * 'stooges': [ * { 'age': 40 }, * { 'age': 50 } * ] * }; * * _.merge(names, ages); * // => { 'stooges': [{ 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 }] } * * var food = { * 'fruits': ['apple'], * 'vegetables': ['beet'] * }; * * var otherFood = { * 'fruits': ['banana'], * 'vegetables': ['carrot'] * }; * * _.merge(food, otherFood, function(a, b) { * return _.isArray(a) ? a.concat(b) : undefined; * }); * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] } */ function merge(object) { var args = arguments, length = 2; if (!isObject(object)) { return object; } // allows working with `_.reduce` and `_.reduceRight` without using // their `index` and `collection` arguments if (typeof args[2] != 'number') { length = args.length; } if (length > 3 && typeof args[length - 2] == 'function') { var callback = baseCreateCallback(args[--length - 1], args[length--], 2); } else if (length > 2 && typeof args[length - 1] == 'function') { callback = args[--length]; } var sources = nativeSlice.call(arguments, 1, length), index = -1, stackA = getArray(), stackB = getArray(); while (++index < length) { baseMerge(object, sources[index], callback, stackA, stackB); } releaseArray(stackA); releaseArray(stackB); return object; } /** * Creates a shallow clone of `object` excluding the specified properties. * Property names may be specified as individual arguments or as arrays of * property names. If a callback is provided it will be executed for each * property of `object` omitting the properties the callback returns truey * for. The callback is bound to `thisArg` and invoked with three arguments; * (value, key, object). * * @static * @memberOf _ * @category Objects * @param {Object} object The source object. * @param {Function|...string|string[]} [callback] The properties to omit or the * function called per iteration. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns an object without the omitted properties. * @example * * _.omit({ 'name': 'moe', 'age': 40 }, 'age'); * // => { 'name': 'moe' } * * _.omit({ 'name': 'moe', 'age': 40 }, function(value) { * return typeof value == 'number'; * }); * // => { 'name': 'moe' } */ function omit(object, callback, thisArg) { var indexOf = getIndexOf(), isFunc = typeof callback == 'function', result = {}; if (isFunc) { callback = lodash.createCallback(callback, thisArg, 3); } else { var props = baseFlatten(arguments, true, false, 1); } forIn(object, function(value, key, object) { if (isFunc ? !callback(value, key, object) : indexOf(props, key) < 0 ) { result[key] = value; } }); return result; } /** * Creates a two dimensional array of an object's key-value pairs, * i.e. `[[key1, value1], [key2, value2]]`. * * @static * @memberOf _ * @category Objects * @param {Object} object The object to inspect. * @returns {Array} Returns new array of key-value pairs. * @example * * _.pairs({ 'moe': 30, 'larry': 40 }); * // => [['moe', 30], ['larry', 40]] (property order is not guaranteed across environments) */ function pairs(object) { var index = -1, props = keys(object), length = props.length, result = Array(length); while (++index < length) { var key = props[index]; result[index] = [key, object[key]]; } return result; } /** * Creates a shallow clone of `object` composed of the specified properties. * Property names may be specified as individual arguments or as arrays of * property names. If a callback is provided it will be executed for each * property of `object` picking the properties the callback returns truey * for. The callback is bound to `thisArg` and invoked with three arguments; * (value, key, object). * * @static * @memberOf _ * @category Objects * @param {Object} object The source object. * @param {Function|...string|string[]} [callback] The function called per * iteration or property names to pick, specified as individual property * names or arrays of property names. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns an object composed of the picked properties. * @example * * _.pick({ 'name': 'moe', '_userid': 'moe1' }, 'name'); * // => { 'name': 'moe' } * * _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { * return key.charAt(0) != '_'; * }); * // => { 'name': 'moe' } */ function pick(object, callback, thisArg) { var result = {}; if (typeof callback != 'function') { var index = -1, props = baseFlatten(arguments, true, false, 1), length = isObject(object) ? props.length : 0; while (++index < length) { var key = props[index]; if (key in object) { result[key] = object[key]; } } } else { callback = lodash.createCallback(callback, thisArg, 3); forIn(object, function(value, key, object) { if (callback(value, key, object)) { result[key] = value; } }); } return result; } /** * An alternative to `_.reduce` this method transforms `object` to a new * `accumulator` object which is the result of running each of its elements * through a callback, with each callback execution potentially mutating * the `accumulator` object. The callback is bound to `thisArg` and invoked * with four arguments; (accumulator, value, key, object). Callbacks may exit * iteration early by explicitly returning `false`. * * @static * @memberOf _ * @category Objects * @param {Array|Object} collection The collection to iterate over. * @param {Function} [callback=identity] The function called per iteration. * @param {*} [accumulator] The custom accumulator value. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {*} Returns the accumulated value. * @example * * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) { * num *= num; * if (num % 2) { * return result.push(num) < 3; * } * }); * // => [1, 9, 25] * * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { * result[key] = num * 3; * }); * // => { 'a': 3, 'b': 6, 'c': 9 } */ function transform(object, callback, accumulator, thisArg) { var isArr = isArray(object); callback = baseCreateCallback(callback, thisArg, 4); if (accumulator == null) { if (isArr) { accumulator = []; } else { var ctor = object && object.constructor, proto = ctor && ctor.prototype; accumulator = createObject(proto); } } (isArr ? baseEach : forOwn)(object, function(value, index, object) { return callback(accumulator, value, index, object); }); return accumulator; } /** * Creates an array composed of the own enumerable property values of `object`. * * @static * @memberOf _ * @category Objects * @param {Object} object The object to inspect. * @returns {Array} Returns an array of property values. * @example * * _.values({ 'one': 1, 'two': 2, 'three': 3 }); * // => [1, 2, 3] (property order is not guaranteed across environments) */ function values(object) { var index = -1, props = keys(object), length = props.length, result = Array(length); while (++index < length) { result[index] = object[props[index]]; } return result; } /*--------------------------------------------------------------------------*/ /** * Creates an array of elements from the specified indexes, or keys, of the * `collection`. Indexes may be specified as individual arguments or as arrays * of indexes. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {...(number|number[]|string|string[])} [index] The indexes of `collection` * to retrieve, specified as individual indexes or arrays of indexes. * @returns {Array} Returns a new array of elements corresponding to the * provided indexes. * @example * * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]); * // => ['a', 'c', 'e'] * * _.at(['moe', 'larry', 'curly'], 0, 2); * // => ['moe', 'curly'] */ function at(collection) { var args = arguments, index = -1, props = baseFlatten(args, true, false, 1), length = (args[2] && args[2][args[1]] === collection) ? 1 : props.length, result = Array(length); while(++index < length) { result[index] = collection[props[index]]; } return result; } /** * Checks if a given value is present in a collection using strict equality * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the * offset from the end of the collection. * * @static * @memberOf _ * @alias include * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {*} target The value to check for. * @param {number} [fromIndex=0] The index to search from. * @returns {boolean} Returns `true` if the `target` element is found, else `false`. * @example * * _.contains([1, 2, 3], 1); * // => true * * _.contains([1, 2, 3], 1, 2); * // => false * * _.contains({ 'name': 'moe', 'age': 40 }, 'moe'); * // => true * * _.contains('curly', 'ur'); * // => true */ function contains(collection, target, fromIndex) { var index = -1, indexOf = getIndexOf(), length = collection ? collection.length : 0, result = false; fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0; if (isArray(collection)) { result = indexOf(collection, target, fromIndex) > -1; } else if (typeof length == 'number') { result = (isString(collection) ? collection.indexOf(target, fromIndex) : indexOf(collection, target, fromIndex)) > -1; } else { baseEach(collection, function(value) { if (++index >= fromIndex) { return !(result = value === target); } }); } return result; } /** * Creates an object composed of keys generated from the results of running * each element of `collection` through the callback. The corresponding value * of each key is the number of times the key was returned by the callback. * The callback is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. * @example * * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); }); * // => { '4': 1, '6': 2 } * * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math); * // => { '4': 1, '6': 2 } * * _.countBy(['one', 'two', 'three'], 'length'); * // => { '3': 2, '5': 1 } */ var countBy = createAggregator(function(result, value, key) { (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1); }); /** * Checks if the given callback returns truey value for **all** elements of * a collection. The callback is bound to `thisArg` and invoked with three * arguments; (value, index|key, collection). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @alias all * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {boolean} Returns `true` if all elements passed the callback check, * else `false`. * @example * * _.every([true, 1, null, 'yes'], Boolean); * // => false * * var stooges = [ * { 'name': 'moe', 'age': 40 }, * { 'name': 'larry', 'age': 50 } * ]; * * // using "_.pluck" callback shorthand * _.every(stooges, 'age'); * // => true * * // using "_.where" callback shorthand * _.every(stooges, { 'age': 50 }); * // => false */ function every(collection, callback, thisArg) { var result = true; callback = lodash.createCallback(callback, thisArg, 3); if (isArray(collection)) { var index = -1, length = collection.length; while (++index < length) { if (!(result = !!callback(collection[index], index, collection))) { break; } } } else { baseEach(collection, function(value, index, collection) { return (result = !!callback(value, index, collection)); }); } return result; } /** * Iterates over elements of a collection, returning an array of all elements * the callback returns truey for. The callback is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @alias select * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of elements that passed the callback check. * @example * * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); * // => [2, 4, 6] * * var food = [ * { 'name': 'apple', 'organic': false, 'type': 'fruit' }, * { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } * ]; * * // using "_.pluck" callback shorthand * _.filter(food, 'organic'); * // => [{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }] * * // using "_.where" callback shorthand * _.filter(food, { 'type': 'fruit' }); * // => [{ 'name': 'apple', 'organic': false, 'type': 'fruit' }] */ function filter(collection, callback, thisArg) { var result = []; callback = lodash.createCallback(callback, thisArg, 3); if (isArray(collection)) { var index = -1, length = collection.length; while (++index < length) { var value = collection[index]; if (callback(value, index, collection)) { result.push(value); } } } else { baseEach(collection, function(value, index, collection) { if (callback(value, index, collection)) { result.push(value); } }); } return result; } /** * Iterates over elements of a collection, returning the first element that * the callback returns truey for. The callback is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @alias detect, findWhere * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {*} Returns the found element, else `undefined`. * @example * * _.find([1, 2, 3, 4], function(num) { * return num % 2 == 0; * }); * // => 2 * * var food = [ * { 'name': 'apple', 'organic': false, 'type': 'fruit' }, * { 'name': 'banana', 'organic': true, 'type': 'fruit' }, * { 'name': 'beet', 'organic': false, 'type': 'vegetable' } * ]; * * // using "_.where" callback shorthand * _.find(food, { 'type': 'vegetable' }); * // => { 'name': 'beet', 'organic': false, 'type': 'vegetable' } * * // using "_.pluck" callback shorthand * _.find(food, 'organic'); * // => { 'name': 'banana', 'organic': true, 'type': 'fruit' } */ function find(collection, callback, thisArg) { callback = lodash.createCallback(callback, thisArg, 3); if (isArray(collection)) { var index = -1, length = collection.length; while (++index < length) { var value = collection[index]; if (callback(value, index, collection)) { return value; } } } else { var result; baseEach(collection, function(value, index, collection) { if (callback(value, index, collection)) { result = value; return false; } }); return result; } } /** * This method is like `_.find` except that it iterates over elements * of a `collection` from right to left. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {*} Returns the found element, else `undefined`. * @example * * _.findLast([1, 2, 3, 4], function(num) { * return num % 2 == 1; * }); * // => 3 */ function findLast(collection, callback, thisArg) { var result; callback = lodash.createCallback(callback, thisArg, 3); forEachRight(collection, function(value, index, collection) { if (callback(value, index, collection)) { result = value; return false; } }); return result; } /** * Iterates over elements of a collection, executing the callback for each * element. The callback is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). Callbacks may exit iteration early by * explicitly returning `false`. * * @static * @memberOf _ * @alias each * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} [callback=identity] The function called per iteration. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Array|Object|string} Returns `collection`. * @example * * _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(','); * // => logs each number and returns '1,2,3' * * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); * // => logs each number and returns the object (property order is not guaranteed across environments) */ function forEach(collection, callback, thisArg) { if (callback && typeof thisArg == 'undefined' && isArray(collection)) { var index = -1, length = collection.length; while (++index < length) { if (callback(collection[index], index, collection) === false) { break; } } } else { baseEach(collection, callback, thisArg); } return collection; } /** * This method is like `_.forEach` except that it iterates over elements * of a `collection` from right to left. * * @static * @memberOf _ * @alias eachRight * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} [callback=identity] The function called per iteration. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Array|Object|string} Returns `collection`. * @example * * _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(','); * // => logs each number from right to left and returns '3,2,1' */ function forEachRight(collection, callback, thisArg) { var iterable = collection, length = collection ? collection.length : 0; callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); if (isArray(collection)) { while (length--) { if (callback(collection[length], length, collection) === false) { break; } } } else { if (typeof length != 'number') { var props = keys(collection); length = props.length; } else if (support.unindexedChars && isString(collection)) { iterable = collection.split(''); } baseEach(collection, function(value, key, collection) { key = props ? props[--length] : --length; return callback(iterable[key], key, collection); }); } return collection; } /** * Creates an object composed of keys generated from the results of running * each element of a collection through the callback. The corresponding value * of each key is an array of the elements responsible for generating the key. * The callback is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false` * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. * @example * * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); }); * // => { '4': [4.2], '6': [6.1, 6.4] } * * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math); * // => { '4': [4.2], '6': [6.1, 6.4] } * * // using "_.pluck" callback shorthand * _.groupBy(['one', 'two', 'three'], 'length'); * // => { '3': ['one', 'two'], '5': ['three'] } */ var groupBy = createAggregator(function(result, value, key) { (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value); }); /** * Creates an object composed of keys generated from the results of running * each element of the collection through the given callback. The corresponding * value of each key is the last element responsible for generating the key. * The callback is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. * @example * * var keys = [ * { 'dir': 'left', 'code': 97 }, * { 'dir': 'right', 'code': 100 } * ]; * * _.indexBy(keys, 'dir'); * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } * * _.indexBy(keys, function(key) { return String.fromCharCode(key.code); }); * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } * * _.indexBy(stooges, function(key) { this.fromCharCode(key.code); }, String); * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } */ var indexBy = createAggregator(function(result, value, key) { result[key] = value; }); /** * Invokes the method named by `methodName` on each element in the `collection` * returning an array of the results of each invoked method. Additional arguments * will be provided to each invoked method. If `methodName` is a function it * will be invoked for, and `this` bound to, each element in the `collection`. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|string} methodName The name of the method to invoke or * the function invoked per iteration. * @param {...*} [arg] Arguments to invoke the method with. * @returns {Array} Returns a new array of the results of each invoked method. * @example * * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); * // => [[1, 5, 7], [1, 2, 3]] * * _.invoke([123, 456], String.prototype.split, ''); * // => [['1', '2', '3'], ['4', '5', '6']] */ function invoke(collection, methodName) { var args = nativeSlice.call(arguments, 2), index = -1, isFunc = typeof methodName == 'function', length = collection ? collection.length : 0, result = Array(typeof length == 'number' ? length : 0); forEach(collection, function(value) { result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args); }); return result; } /** * Creates an array of values by running each element in the collection * through the callback. The callback is bound to `thisArg` and invoked with * three arguments; (value, index|key, collection). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @alias collect * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of the results of each `callback` execution. * @example * * _.map([1, 2, 3], function(num) { return num * 3; }); * // => [3, 6, 9] * * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); * // => [3, 6, 9] (property order is not guaranteed across environments) * * var stooges = [ * { 'name': 'moe', 'age': 40 }, * { 'name': 'larry', 'age': 50 } * ]; * * // using "_.pluck" callback shorthand * _.map(stooges, 'name'); * // => ['moe', 'larry'] */ function map(collection, callback, thisArg) { var index = -1, length = collection ? collection.length : 0, result = Array(typeof length == 'number' ? length : 0); callback = lodash.createCallback(callback, thisArg, 3); if (isArray(collection)) { while (++index < length) { result[index] = callback(collection[index], index, collection); } } else { baseEach(collection, function(value, key, collection) { result[++index] = callback(value, key, collection); }); } return result; } /** * Retrieves the maximum value of a collection. If the collection is empty or * falsey `-Infinity` is returned. If a callback is provided it will be executed * for each value in the collection to generate the criterion by which the value * is ranked. The callback is bound to `thisArg` and invoked with three * arguments; (value, index, collection). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {*} Returns the maximum value. * @example * * _.max([4, 2, 8, 6]); * // => 8 * * var stooges = [ * { 'name': 'moe', 'age': 40 }, * { 'name': 'larry', 'age': 50 } * ]; * * _.max(stooges, function(stooge) { return stooge.age; }); * // => { 'name': 'larry', 'age': 50 }; * * // using "_.pluck" callback shorthand * _.max(stooges, 'age'); * // => { 'name': 'larry', 'age': 50 }; */ function max(collection, callback, thisArg) { var computed = -Infinity, result = computed; if (!callback && isArray(collection)) { var index = -1, length = collection.length; while (++index < length) { var value = collection[index]; if (value > result) { result = value; } } } else { callback = (!callback && isString(collection)) ? charAtCallback : lodash.createCallback(callback, thisArg, 3); baseEach(collection, function(value, index, collection) { var current = callback(value, index, collection); if (current > computed) { computed = current; result = value; } }); } return result; } /** * Retrieves the minimum value of a collection. If the collection is empty or * falsey `Infinity` is returned. If a callback is provided it will be executed * for each value in the collection to generate the criterion by which the value * is ranked. The callback is bound to `thisArg` and invoked with three * arguments; (value, index, collection). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {*} Returns the minimum value. * @example * * _.min([4, 2, 8, 6]); * // => 2 * * var stooges = [ * { 'name': 'moe', 'age': 40 }, * { 'name': 'larry', 'age': 50 } * ]; * * _.min(stooges, function(stooge) { return stooge.age; }); * // => { 'name': 'moe', 'age': 40 }; * * // using "_.pluck" callback shorthand * _.min(stooges, 'age'); * // => { 'name': 'moe', 'age': 40 }; */ function min(collection, callback, thisArg) { var computed = Infinity, result = computed; if (!callback && isArray(collection)) { var index = -1, length = collection.length; while (++index < length) { var value = collection[index]; if (value < result) { result = value; } } } else { callback = (!callback && isString(collection)) ? charAtCallback : lodash.createCallback(callback, thisArg, 3); baseEach(collection, function(value, index, collection) { var current = callback(value, index, collection); if (current < computed) { computed = current; result = value; } }); } return result; } /** * Retrieves the value of a specified property from all elements in the `collection`. * * @static * @memberOf _ * @type Function * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {string} property The property to pluck. * @returns {Array} Returns a new array of property values. * @example * * var stooges = [ * { 'name': 'moe', 'age': 40 }, * { 'name': 'larry', 'age': 50 } * ]; * * _.pluck(stooges, 'name'); * // => ['moe', 'larry'] */ var pluck = map; /** * Reduces a collection to a value which is the accumulated result of running * each element in the collection through the callback, where each successive * callback execution consumes the return value of the previous execution. If * `accumulator` is not provided the first element of the collection will be * used as the initial `accumulator` value. The callback is bound to `thisArg` * and invoked with four arguments; (accumulator, value, index|key, collection). * * @static * @memberOf _ * @alias foldl, inject * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} [callback=identity] The function called per iteration. * @param {*} [accumulator] Initial value of the accumulator. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {*} Returns the accumulated value. * @example * * var sum = _.reduce([1, 2, 3], function(sum, num) { * return sum + num; * }); * // => 6 * * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { * result[key] = num * 3; * return result; * }, {}); * // => { 'a': 3, 'b': 6, 'c': 9 } */ function reduce(collection, callback, accumulator, thisArg) { var noaccum = arguments.length < 3; callback = baseCreateCallback(callback, thisArg, 4); if (isArray(collection)) { var index = -1, length = collection.length; if (noaccum) { accumulator = collection[++index]; } while (++index < length) { accumulator = callback(accumulator, collection[index], index, collection); } } else { baseEach(collection, function(value, index, collection) { accumulator = noaccum ? (noaccum = false, value) : callback(accumulator, value, index, collection) }); } return accumulator; } /** * This method is like `_.reduce` except that it iterates over elements * of a `collection` from right to left. * * @static * @memberOf _ * @alias foldr * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} [callback=identity] The function called per iteration. * @param {*} [accumulator] Initial value of the accumulator. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {*} Returns the accumulated value. * @example * * var list = [[0, 1], [2, 3], [4, 5]]; * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); * // => [4, 5, 2, 3, 0, 1] */ function reduceRight(collection, callback, accumulator, thisArg) { var noaccum = arguments.length < 3; callback = baseCreateCallback(callback, thisArg, 4); forEachRight(collection, function(value, index, collection) { accumulator = noaccum ? (noaccum = false, value) : callback(accumulator, value, index, collection); }); return accumulator; } /** * The opposite of `_.filter` this method returns the elements of a * collection that the callback does **not** return truey for. * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of elements that failed the callback check. * @example * * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); * // => [1, 3, 5] * * var food = [ * { 'name': 'apple', 'organic': false, 'type': 'fruit' }, * { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } * ]; * * // using "_.pluck" callback shorthand * _.reject(food, 'organic'); * // => [{ 'name': 'apple', 'organic': false, 'type': 'fruit' }] * * // using "_.where" callback shorthand * _.reject(food, { 'type': 'fruit' }); * // => [{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }] */ function reject(collection, callback, thisArg) { callback = lodash.createCallback(callback, thisArg, 3); return filter(collection, function(value, index, collection) { return !callback(value, index, collection); }); } /** * Retrieves a random element or `n` random elements from a collection. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to sample. * @param {number} [n] The number of elements to sample. * @param- {Object} [guard] Allows working with functions, like `_.map`, * without using their `key` and `object` arguments as sources. * @returns {Array} Returns the random sample(s) of `collection`. * @example * * _.sample([1, 2, 3, 4]); * // => 2 * * _.sample([1, 2, 3, 4], 2); * // => [3, 1] */ function sample(collection, n, guard) { var length = collection ? collection.length : 0; if (typeof length != 'number') { collection = values(collection); } if (n == null || guard) { return collection ? collection[random(length - 1)] : undefined; } var result = shuffle(collection); result.length = nativeMin(nativeMax(0, n), result.length); return result; } /** * Creates an array of shuffled values, using a version of the Fisher-Yates * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to shuffle. * @returns {Array} Returns a new shuffled collection. * @example * * _.shuffle([1, 2, 3, 4, 5, 6]); * // => [4, 1, 6, 3, 5, 2] */ function shuffle(collection) { var index = -1, length = collection ? collection.length : 0, result = Array(typeof length == 'number' ? length : 0); forEach(collection, function(value) { var rand = random(++index); result[index] = result[rand]; result[rand] = value; }); return result; } /** * Gets the size of the `collection` by returning `collection.length` for arrays * and array-like objects or the number of own enumerable properties for objects. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to inspect. * @returns {number} Returns `collection.length` or number of own enumerable properties. * @example * * _.size([1, 2]); * // => 2 * * _.size({ 'one': 1, 'two': 2, 'three': 3 }); * // => 3 * * _.size('curly'); * // => 5 */ function size(collection) { var length = collection ? collection.length : 0; return typeof length == 'number' ? length : keys(collection).length; } /** * Checks if the callback returns a truey value for **any** element of a * collection. The function returns as soon as it finds a passing value and * does not iterate over the entire collection. The callback is bound to * `thisArg` and invoked with three arguments; (value, index|key, collection). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @alias any * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {boolean} Returns `true` if any element passed the callback check, * else `false`. * @example * * _.some([null, 0, 'yes', false], Boolean); * // => true * * var food = [ * { 'name': 'apple', 'organic': false, 'type': 'fruit' }, * { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } * ]; * * // using "_.pluck" callback shorthand * _.some(food, 'organic'); * // => true * * // using "_.where" callback shorthand * _.some(food, { 'type': 'meat' }); * // => false */ function some(collection, callback, thisArg) { var result; callback = lodash.createCallback(callback, thisArg, 3); if (isArray(collection)) { var index = -1, length = collection.length; while (++index < length) { if ((result = callback(collection[index], index, collection))) { break; } } } else { baseEach(collection, function(value, index, collection) { return !(result = callback(value, index, collection)); }); } return !!result; } /** * Creates an array of elements, sorted in ascending order by the results of * running each element in a collection through the callback. This method * performs a stable sort, that is, it will preserve the original sort order * of equal elements. The callback is bound to `thisArg` and invoked with * three arguments; (value, index|key, collection). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of sorted elements. * @example * * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); }); * // => [3, 1, 2] * * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math); * // => [3, 1, 2] * * // using "_.pluck" callback shorthand * _.sortBy(['banana', 'strawberry', 'apple'], 'length'); * // => ['apple', 'banana', 'strawberry'] */ function sortBy(collection, callback, thisArg) { var index = -1, length = collection ? collection.length : 0, result = Array(typeof length == 'number' ? length : 0); callback = lodash.createCallback(callback, thisArg, 3); forEach(collection, function(value, key, collection) { var object = result[++index] = getObject(); object.criteria = callback(value, key, collection); object.index = index; object.value = value; }); length = result.length; result.sort(compareAscending); while (length--) { var object = result[length]; result[length] = object.value; releaseObject(object); } return result; } /** * Converts the `collection` to an array. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to convert. * @returns {Array} Returns the new converted array. * @example * * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4); * // => [2, 3, 4] */ function toArray(collection) { if (collection && typeof collection.length == 'number') { return slice(collection); } return values(collection); } /** * Performs a deep comparison of each element in a `collection` to the given * `properties` object, returning an array of all elements that have equivalent * property values. * * @static * @memberOf _ * @type Function * @category Collections * @param {Array|Object|string} collection The collection to iterate over. * @param {Object} properties The object of property values to filter by. * @returns {Array} Returns a new array of elements that have the given properties. * @example * * var stooges = [ * { 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, * { 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] } * ]; * * _.where(stooges, { 'age': 40 }); * // => [{ 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] }] * * _.where(stooges, { 'quotes': ['Poifect!'] }); * // => [{ 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }] */ var where = filter; /*--------------------------------------------------------------------------*/ /** * Creates an array with all falsey values removed. The values `false`, `null`, * `0`, `""`, `undefined`, and `NaN` are all falsey. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to compact. * @returns {Array} Returns a new array of filtered values. * @example * * _.compact([0, 1, false, 2, '', 3]); * // => [1, 2, 3] */ function compact(array) { var index = -1, length = array ? array.length : 0, result = []; while (++index < length) { var value = array[index]; if (value) { result.push(value); } } return result; } /** * Creates an array excluding all values of the provided arrays using strict * equality for comparisons, i.e. `===`. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to process. * @param {...Array} [array] The arrays of values to exclude. * @returns {Array} Returns a new array of filtered values. * @example * * _.difference([1, 2, 3, 4, 5], [5, 2, 10]); * // => [1, 3, 4] */ function difference(array) { var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, seen = baseFlatten(arguments, true, true, 1), result = []; var isLarge = length >= largeArraySize && indexOf === baseIndexOf; if (isLarge) { var cache = createCache(seen); if (cache) { indexOf = cacheIndexOf; seen = cache; } else { isLarge = false; } } while (++index < length) { var value = array[index]; if (indexOf(seen, value) < 0) { result.push(value); } } if (isLarge) { releaseObject(seen); } return result; } /** * This method is like `_.find` except that it returns the index of the first * element that passes the callback check, instead of the element itself. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to search. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {number} Returns the index of the found element, else `-1`. * @example * * _.findIndex(['apple', 'banana', 'beet'], function(food) { * return /^b/.test(food); * }); * // => 1 */ function findIndex(array, callback, thisArg) { var index = -1, length = array ? array.length : 0; callback = lodash.createCallback(callback, thisArg, 3); while (++index < length) { if (callback(array[index], index, array)) { return index; } } return -1; } /** * This method is like `_.findIndex` except that it iterates over elements * of a `collection` from right to left. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to search. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {number} Returns the index of the found element, else `-1`. * @example * * _.findLastIndex(['apple', 'banana', 'beet'], function(food) { * return /^b/.test(food); * }); * // => 2 */ function findLastIndex(array, callback, thisArg) { var length = array ? array.length : 0; callback = lodash.createCallback(callback, thisArg, 3); while (length--) { if (callback(array[length], length, array)) { return length; } } return -1; } /** * Gets the first element or first `n` elements of an array. If a callback * is provided elements at the beginning of the array are returned as long * as the callback returns truey. The callback is bound to `thisArg` and * invoked with three arguments; (value, index, array). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @alias head, take * @category Arrays * @param {Array} array The array to query. * @param {Function|Object|number|string} [callback] The function called * per element or the number of elements to return. If a property name or * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {*} Returns the first element(s) of `array`. * @example * * _.first([1, 2, 3]); * // => 1 * * _.first([1, 2, 3], 2); * // => [1, 2] * * _.first([1, 2, 3], function(num) { * return num < 3; * }); * // => [1, 2] * * var food = [ * { 'name': 'banana', 'organic': true }, * { 'name': 'beet', 'organic': false }, * ]; * * // using "_.pluck" callback shorthand * _.first(food, 'organic'); * // => [{ 'name': 'banana', 'organic': true }] * * var food = [ * { 'name': 'apple', 'type': 'fruit' }, * { 'name': 'banana', 'type': 'fruit' }, * { 'name': 'beet', 'type': 'vegetable' } * ]; * * // using "_.where" callback shorthand * _.first(food, { 'type': 'fruit' }); * // => [{ 'name': 'apple', 'type': 'fruit' }, { 'name': 'banana', 'type': 'fruit' }] */ function first(array, callback, thisArg) { var n = 0, length = array ? array.length : 0; if (typeof callback != 'number' && callback != null) { var index = -1; callback = lodash.createCallback(callback, thisArg, 3); while (++index < length && callback(array[index], index, array)) { n++; } } else { n = callback; if (n == null || thisArg) { return array ? array[0] : undefined; } } return slice(array, 0, nativeMin(nativeMax(0, n), length)); } /** * Flattens a nested array (the nesting can be to any depth). If `isShallow` * is truey, the array will only be flattened a single level. If a callback * is provided each element of the array is passed through the callback before * flattening. The callback is bound to `thisArg` and invoked with three * arguments; (value, index, array). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to flatten. * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new flattened array. * @example * * _.flatten([1, [2], [3, [[4]]]]); * // => [1, 2, 3, 4]; * * _.flatten([1, [2], [3, [[4]]]], true); * // => [1, 2, 3, [[4]]]; * * var stooges = [ * { 'name': 'curly', 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, * { 'name': 'moe', 'quotes': ['Spread out!', 'You knucklehead!'] } * ]; * * // using "_.pluck" callback shorthand * _.flatten(stooges, 'quotes'); * // => ['Oh, a wise guy, eh?', 'Poifect!', 'Spread out!', 'You knucklehead!'] */ function flatten(array, isShallow, callback, thisArg) { // juggle arguments if (typeof isShallow != 'boolean' && isShallow != null) { thisArg = callback; callback = !(thisArg && thisArg[isShallow] === array) ? isShallow : null; isShallow = false; } if (callback != null) { array = map(array, callback, thisArg); } return baseFlatten(array, isShallow); } /** * Gets the index at which the first occurrence of `value` is found using * strict equality for comparisons, i.e. `===`. If the array is already sorted * providing `true` for `fromIndex` will run a faster binary search. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to search. * @param {*} value The value to search for. * @param {boolean|number} [fromIndex=0] The index to search from or `true` * to perform a binary search on a sorted array. * @returns {number} Returns the index of the matched value or `-1`. * @example * * _.indexOf([1, 2, 3, 1, 2, 3], 2); * // => 1 * * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3); * // => 4 * * _.indexOf([1, 1, 2, 2, 3, 3], 2, true); * // => 2 */ function indexOf(array, value, fromIndex) { if (typeof fromIndex == 'number') { var length = array ? array.length : 0; fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0); } else if (fromIndex) { var index = sortedIndex(array, value); return array[index] === value ? index : -1; } return baseIndexOf(array, value, fromIndex); } /** * Gets all but the last element or last `n` elements of an array. If a * callback is provided elements at the end of the array are excluded from * the result as long as the callback returns truey. The callback is bound * to `thisArg` and invoked with three arguments; (value, index, array). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to query. * @param {Function|Object|number|string} [callback=1] The function called * per element or the number of elements to exclude. If a property name or * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a slice of `array`. * @example * * _.initial([1, 2, 3]); * // => [1, 2] * * _.initial([1, 2, 3], 2); * // => [1] * * _.initial([1, 2, 3], function(num) { * return num > 1; * }); * // => [1] * * var food = [ * { 'name': 'beet', 'organic': false }, * { 'name': 'carrot', 'organic': true } * ]; * * // using "_.pluck" callback shorthand * _.initial(food, 'organic'); * // => [{ 'name': 'beet', 'organic': false }] * * var food = [ * { 'name': 'banana', 'type': 'fruit' }, * { 'name': 'beet', 'type': 'vegetable' }, * { 'name': 'carrot', 'type': 'vegetable' } * ]; * * // using "_.where" callback shorthand * _.initial(food, { 'type': 'vegetable' }); * // => [{ 'name': 'banana', 'type': 'fruit' }] */ function initial(array, callback, thisArg) { var n = 0, length = array ? array.length : 0; if (typeof callback != 'number' && callback != null) { var index = length; callback = lodash.createCallback(callback, thisArg, 3); while (index-- && callback(array[index], index, array)) { n++; } } else { n = (callback == null || thisArg) ? 1 : callback || n; } return slice(array, 0, nativeMin(nativeMax(0, length - n), length)); } /** * Creates an array of unique values present in all provided arrays using * strict equality for comparisons, i.e. `===`. * * @static * @memberOf _ * @category Arrays * @param {...Array} [array] The arrays to inspect. * @returns {Array} Returns an array of composite values. * @example * * _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); * // => [1, 2] */ function intersection(array) { var args = arguments, argsLength = args.length, argsIndex = -1, caches = getArray(), index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, result = [], seen = getArray(); while (++argsIndex < argsLength) { var value = args[argsIndex]; caches[argsIndex] = indexOf === baseIndexOf && (value ? value.length : 0) >= largeArraySize && createCache(argsIndex ? args[argsIndex] : seen); } outer: while (++index < length) { var cache = caches[0]; value = array[index]; if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) { argsIndex = argsLength; (cache || seen).push(value); while (--argsIndex) { cache = caches[argsIndex]; if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { continue outer; } } result.push(value); } } while (argsLength--) { cache = caches[argsLength]; if (cache) { releaseObject(cache); } } releaseArray(caches); releaseArray(seen); return result; } /** * Gets the last element or last `n` elements of an array. If a callback is * provided elements at the end of the array are returned as long as the * callback returns truey. The callback is bound to `thisArg` and invoked * with three arguments; (value, index, array). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to query. * @param {Function|Object|number|string} [callback] The function called * per element or the number of elements to return. If a property name or * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {*} Returns the last element(s) of `array`. * @example * * _.last([1, 2, 3]); * // => 3 * * _.last([1, 2, 3], 2); * // => [2, 3] * * _.last([1, 2, 3], function(num) { * return num > 1; * }); * // => [2, 3] * * var food = [ * { 'name': 'beet', 'organic': false }, * { 'name': 'carrot', 'organic': true } * ]; * * // using "_.pluck" callback shorthand * _.last(food, 'organic'); * // => [{ 'name': 'carrot', 'organic': true }] * * var food = [ * { 'name': 'banana', 'type': 'fruit' }, * { 'name': 'beet', 'type': 'vegetable' }, * { 'name': 'carrot', 'type': 'vegetable' } * ]; * * // using "_.where" callback shorthand * _.last(food, { 'type': 'vegetable' }); * // => [{ 'name': 'beet', 'type': 'vegetable' }, { 'name': 'carrot', 'type': 'vegetable' }] */ function last(array, callback, thisArg) { var n = 0, length = array ? array.length : 0; if (typeof callback != 'number' && callback != null) { var index = length; callback = lodash.createCallback(callback, thisArg, 3); while (index-- && callback(array[index], index, array)) { n++; } } else { n = callback; if (n == null || thisArg) { return array ? array[length - 1] : undefined; } } return slice(array, nativeMax(0, length - n)); } /** * Gets the index at which the last occurrence of `value` is found using strict * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used * as the offset from the end of the collection. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to search. * @param {*} value The value to search for. * @param {number} [fromIndex=array.length-1] The index to search from. * @returns {number} Returns the index of the matched value or `-1`. * @example * * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); * // => 4 * * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); * // => 1 */ function lastIndexOf(array, value, fromIndex) { var index = array ? array.length : 0; if (typeof fromIndex == 'number') { index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1; } while (index--) { if (array[index] === value) { return index; } } return -1; } /** * Removes all provided values from the given array using strict equality for * comparisons, i.e. `===`. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to modify. * @param {...*} [value] The values to remove. * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3, 1, 2, 3]; * _.pull(array, 2, 3); * console.log(array); * // => [1, 1] */ function pull(array) { var args = arguments, argsIndex = 0, argsLength = args.length, length = array ? array.length : 0; while (++argsIndex < argsLength) { var index = -1, value = args[argsIndex]; while (++index < length) { if (array[index] === value) { splice.call(array, index--, 1); length--; } } } return array; } /** * Creates an array of numbers (positive and/or negative) progressing from * `start` up to but not including `end`. If `start` is less than `stop` a * zero-length range is created unless a negative `step` is specified. * * @static * @memberOf _ * @category Arrays * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @param {number} [step=1] The value to increment or decrement by. * @returns {Array} Returns a new range array. * @example * * _.range(10); * // => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] * * _.range(1, 11); * // => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] * * _.range(0, 30, 5); * // => [0, 5, 10, 15, 20, 25] * * _.range(0, -10, -1); * // => [0, -1, -2, -3, -4, -5, -6, -7, -8, -9] * * _.range(1, 4, 0); * // => [1, 1, 1] * * _.range(0); * // => [] */ function range(start, end, step) { start = +start || 0; step = typeof step == 'number' ? step : (+step || 1); if (end == null) { end = start; start = 0; } // use `Array(length)` so engines, like Chakra and V8, avoid slower modes // http://youtu.be/XAqIpGU8ZZk#t=17m25s var index = -1, length = nativeMax(0, ceil((end - start) / (step || 1))), result = Array(length); while (++index < length) { result[index] = start; start += step; } return result; } /** * Removes all elements from an array that the callback returns truey for * and returns an array of removed elements. The callback is bound to `thisArg` * and invoked with three arguments; (value, index, array). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to modify. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of removed elements. * @example * * var array = [1, 2, 3, 4, 5, 6]; * var evens = _.remove(array, function(num) { return num % 2 == 0; }); * * console.log(array); * // => [1, 3, 5] * * console.log(evens); * // => [2, 4, 6] */ function remove(array, callback, thisArg) { var index = -1, length = array ? array.length : 0, result = []; callback = lodash.createCallback(callback, thisArg, 3); while (++index < length) { var value = array[index]; if (callback(value, index, array)) { result.push(value); splice.call(array, index--, 1); length--; } } return result; } /** * The opposite of `_.initial` this method gets all but the first element or * first `n` elements of an array. If a callback function is provided elements * at the beginning of the array are excluded from the result as long as the * callback returns truey. The callback is bound to `thisArg` and invoked * with three arguments; (value, index, array). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @alias drop, tail * @category Arrays * @param {Array} array The array to query. * @param {Function|Object|number|string} [callback=1] The function called * per element or the number of elements to exclude. If a property name or * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a slice of `array`. * @example * * _.rest([1, 2, 3]); * // => [2, 3] * * _.rest([1, 2, 3], 2); * // => [3] * * _.rest([1, 2, 3], function(num) { * return num < 3; * }); * // => [3] * * var food = [ * { 'name': 'banana', 'organic': true }, * { 'name': 'beet', 'organic': false }, * ]; * * // using "_.pluck" callback shorthand * _.rest(food, 'organic'); * // => [{ 'name': 'beet', 'organic': false }] * * var food = [ * { 'name': 'apple', 'type': 'fruit' }, * { 'name': 'banana', 'type': 'fruit' }, * { 'name': 'beet', 'type': 'vegetable' } * ]; * * // using "_.where" callback shorthand * _.rest(food, { 'type': 'fruit' }); * // => [{ 'name': 'beet', 'type': 'vegetable' }] */ function rest(array, callback, thisArg) { if (typeof callback != 'number' && callback != null) { var n = 0, index = -1, length = array ? array.length : 0; callback = lodash.createCallback(callback, thisArg, 3); while (++index < length && callback(array[index], index, array)) { n++; } } else { n = (callback == null || thisArg) ? 1 : nativeMax(0, callback); } return slice(array, n); } /** * Uses a binary search to determine the smallest index at which a value * should be inserted into a given sorted array in order to maintain the sort * order of the array. If a callback is provided it will be executed for * `value` and each element of `array` to compute their sort ranking. The * callback is bound to `thisArg` and invoked with one argument; (value). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to inspect. * @param {*} value The value to evaluate. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {number} Returns the index at which `value` should be inserted * into `array`. * @example * * _.sortedIndex([20, 30, 50], 40); * // => 2 * * // using "_.pluck" callback shorthand * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); * // => 2 * * var dict = { * 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 } * }; * * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { * return dict.wordToNumber[word]; * }); * // => 2 * * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { * return this.wordToNumber[word]; * }, dict); * // => 2 */ function sortedIndex(array, value, callback, thisArg) { var low = 0, high = array ? array.length : low; // explicitly reference `identity` for better inlining in Firefox callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity; value = callback(value); while (low < high) { var mid = (low + high) >>> 1; (callback(array[mid]) < value) ? low = mid + 1 : high = mid; } return low; } /** * Creates an array of unique values, in order, of the provided arrays using * strict equality for comparisons, i.e. `===`. * * @static * @memberOf _ * @category Arrays * @param {...Array} [array] The arrays to inspect. * @returns {Array} Returns an array of composite values. * @example * * _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); * // => [1, 2, 3, 101, 10] */ function union(array) { return baseUniq(baseFlatten(arguments, true, true)); } /** * Creates a duplicate-value-free version of an array using strict equality * for comparisons, i.e. `===`. If the array is sorted, providing * `true` for `isSorted` will use a faster algorithm. If a callback is provided * each element of `array` is passed through the callback before uniqueness * is computed. The callback is bound to `thisArg` and invoked with three * arguments; (value, index, array). * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * * @static * @memberOf _ * @alias unique * @category Arrays * @param {Array} array The array to process. * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted. * @param {Function|Object|string} [callback=identity] The function called * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a duplicate-value-free array. * @example * * _.uniq([1, 2, 1, 3, 1]); * // => [1, 2, 3] * * _.uniq([1, 1, 2, 2, 3], true); * // => [1, 2, 3] * * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); }); * // => ['A', 'b', 'C'] * * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math); * // => [1, 2.5, 3] * * // using "_.pluck" callback shorthand * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ function uniq(array, isSorted, callback, thisArg) { // juggle arguments if (typeof isSorted != 'boolean' && isSorted != null) { thisArg = callback; callback = !(thisArg && thisArg[isSorted] === array) ? isSorted : null; isSorted = false; } if (callback != null) { callback = lodash.createCallback(callback, thisArg, 3); } return baseUniq(array, isSorted, callback); } /** * Creates an array excluding all provided values using strict equality for * comparisons, i.e. `===`. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to filter. * @param {...*} [value] The values to exclude. * @returns {Array} Returns a new array of filtered values. * @example * * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); * // => [2, 3, 4] */ function without(array) { return difference(array, nativeSlice.call(arguments, 1)); } /** * Creates an array of grouped elements, the first of which contains the first * elements of the given arrays, the second of which contains the second * elements of the given arrays, and so on. * * @static * @memberOf _ * @alias unzip * @category Arrays * @param {...Array} [array] Arrays to process. * @returns {Array} Returns a new array of grouped elements. * @example * * _.zip(['moe', 'larry'], [30, 40], [true, false]); * // => [['moe', 30, true], ['larry', 40, false]] */ function zip() { var array = arguments.length > 1 ? arguments : arguments[0], index = -1, length = array ? max(pluck(array, 'length')) : 0, result = Array(length < 0 ? 0 : length); while (++index < length) { result[index] = pluck(array, index); } return result; } /** * Creates an object composed from arrays of `keys` and `values`. Provide * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` * or two arrays, one of `keys` and one of corresponding `values`. * * @static * @memberOf _ * @alias object * @category Arrays * @param {Array} keys The array of keys. * @param {Array} [values=[]] The array of values. * @returns {Object} Returns an object composed of the given keys and * corresponding values. * @example * * _.zipObject(['moe', 'larry'], [30, 40]); * // => { 'moe': 30, 'larry': 40 } */ function zipObject(keys, values) { var index = -1, length = keys ? keys.length : 0, result = {}; while (++index < length) { var key = keys[index]; if (values) { result[key] = values[index]; } else if (key) { result[key[0]] = key[1]; } } return result; } /*--------------------------------------------------------------------------*/ /** * Creates a function that executes `func`, with the `this` binding and * arguments of the created function, only after being called `n` times. * * @static * @memberOf _ * @category Functions * @param {number} n The number of times the function must be called before * `func` is executed. * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * var saves = ['profile', 'settings']; * * var done = _.after(saves.length, function() { * console.log('Done saving!'); * }); * * _.forEach(saves, function(type) { * asyncSave({ 'type': type, 'complete': done }); * }); * // => logs 'Done saving!', after all saves have completed */ function after(n, func) { if (!isFunction(func)) { throw new TypeError; } return function() { if (--n < 1) { return func.apply(this, arguments); } }; } /** * Creates a function that, when called, invokes `func` with the `this` * binding of `thisArg` and prepends any additional `bind` arguments to those * provided to the bound function. * * @static * @memberOf _ * @category Functions * @param {Function} func The function to bind. * @param {*} [thisArg] The `this` binding of `func`. * @param {...*} [arg] Arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * * var func = function(greeting) { * return greeting + ' ' + this.name; * }; * * func = _.bind(func, { 'name': 'moe' }, 'hi'); * func(); * // => 'hi moe' */ function bind(func, thisArg) { return arguments.length > 2 ? createBound(func, 17, nativeSlice.call(arguments, 2), null, thisArg) : createBound(func, 1, null, null, thisArg); } /** * Binds methods of an object to the object itself, overwriting the existing * method. Method names may be specified as individual arguments or as arrays * of method names. If no method names are provided all the function properties * of `object` will be bound. * * @static * @memberOf _ * @category Functions * @param {Object} object The object to bind and assign the bound methods to. * @param {...string} [methodName] The object method names to * bind, specified as individual method names or arrays of method names. * @returns {Object} Returns `object`. * @example * * var view = { * 'label': 'docs', * 'onClick': function() { console.log('clicked ' + this.label); } * }; * * _.bindAll(view); * jQuery('#docs').on('click', view.onClick); * // => logs 'clicked docs', when the button is clicked */ function bindAll(object) { var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object), index = -1, length = funcs.length; while (++index < length) { var key = funcs[index]; object[key] = createBound(object[key], 1, null, null, object); } return object; } /** * Creates a function that, when called, invokes the method at `object[key]` * and prepends any additional `bindKey` arguments to those provided to the bound * function. This method differs from `_.bind` by allowing bound functions to * reference methods that will be redefined or don't yet exist. * See http://michaux.ca/articles/lazy-function-definition-pattern. * * @static * @memberOf _ * @category Functions * @param {Object} object The object the method belongs to. * @param {string} key The key of the method. * @param {...*} [arg] Arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * * var object = { * 'name': 'moe', * 'greet': function(greeting) { * return greeting + ' ' + this.name; * } * }; * * var func = _.bindKey(object, 'greet', 'hi'); * func(); * // => 'hi moe' * * object.greet = function(greeting) { * return greeting + ', ' + this.name + '!'; * }; * * func(); * // => 'hi, moe!' */ function bindKey(object, key) { return arguments.length > 2 ? createBound(key, 19, nativeSlice.call(arguments, 2), null, object) : createBound(key, 3, null, null, object); } /** * Creates a function that is the composition of the provided functions, * where each function consumes the return value of the function that follows. * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. * Each function is executed with the `this` binding of the composed function. * * @static * @memberOf _ * @category Functions * @param {...Function} [func] Functions to compose. * @returns {Function} Returns the new composed function. * @example * * var realNameMap = { * 'curly': 'jerome' * }; * * var format = function(name) { * name = realNameMap[name.toLowerCase()] || name; * return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase(); * }; * * var greet = function(formatted) { * return 'Hiya ' + formatted + '!'; * }; * * var welcome = _.compose(greet, format); * welcome('curly'); * // => 'Hiya Jerome!' */ function compose() { var funcs = arguments, length = funcs.length; while (length--) { if (!isFunction(funcs[length])) { throw new TypeError; } } return function() { var args = arguments, length = funcs.length; while (length--) { args = [funcs[length].apply(this, args)]; } return args[0]; }; } /** * Produces a callback bound to an optional `thisArg`. If `func` is a property * name the created callback will return the property value for a given element. * If `func` is an object the created callback will return `true` for elements * that contain the equivalent object properties, otherwise it will return `false`. * * @static * @memberOf _ * @category Functions * @param {*} [func=identity] The value to convert to a callback. * @param {*} [thisArg] The `this` binding of the created callback. * @param {number} [argCount] The number of arguments the callback accepts. * @returns {Function} Returns a callback function. * @example * * var stooges = [ * { 'name': 'moe', 'age': 40 }, * { 'name': 'larry', 'age': 50 } * ]; * * // wrap to create custom callback shorthands * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) { * var match = /^(.+?)__([gl]t)(.+)$/.exec(callback); * return !match ? func(callback, thisArg) : function(object) { * return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3]; * }; * }); * * _.filter(stooges, 'age__gt45'); * // => [{ 'name': 'larry', 'age': 50 }] */ function createCallback(func, thisArg, argCount) { var type = typeof func; if (func == null || type == 'function') { return baseCreateCallback(func, thisArg, argCount); } // handle "_.pluck" style callback shorthands if (type != 'object') { return function(object) { return object[func]; }; } var props = keys(func), key = props[0], a = func[key]; // handle "_.where" style callback shorthands if (props.length == 1 && a === a && !isObject(a)) { // fast path the common case of providing an object with a single // property containing a primitive value return function(object) { var b = object[key]; return a === b && (a !== 0 || (1 / a == 1 / b)); }; } return function(object) { var length = props.length, result = false; while (length--) { if (!(result = baseIsEqual(object[props[length]], func[props[length]], null, true))) { break; } } return result; }; } /** * Creates a function which accepts one or more arguments of `func` that when * invoked either executes `func` returning its result, if all `func` arguments * have been provided, or returns a function that accepts one or more of the * remaining `func` arguments, and so on. The arity of `func` can be specified * if `func.length` is not sufficient. * * @static * @memberOf _ * @category Functions * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. * @returns {Function} Returns the new curried function. * @example * * var curried = _.curry(function(a, b, c) { * console.log(a + b + c); * }); * * curried(1)(2)(3); * // => 6 * * curried(1, 2)(3); * // => 6 * * curried(1, 2, 3); * // => 6 */ function curry(func, arity) { arity = typeof arity == 'number' ? arity : (+arity || func.length); return createBound(func, 4, null, null, null, arity); } /** * Creates a function that will delay the execution of `func` until after * `wait` milliseconds have elapsed since the last time it was invoked. * Provide an options object to indicate that `func` should be invoked on * the leading and/or trailing edge of the `wait` timeout. Subsequent calls * to the debounced function will return the result of the last `func` call. * * Note: If `leading` and `trailing` options are `true` `func` will be called * on the trailing edge of the timeout only if the the debounced function is * invoked more than once during the `wait` timeout. * * @static * @memberOf _ * @category Functions * @param {Function} func The function to debounce. * @param {number} wait The number of milliseconds to delay. * @param {Object} [options] The options object. * @param {boolean} [options.leading=false] Specify execution on the leading edge of the timeout. * @param {number} [options.maxWait] The maximum time `func` is allowed to be delayed before it's called. * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example * * // avoid costly calculations while the window size is in flux * var lazyLayout = _.debounce(calculateLayout, 150); * jQuery(window).on('resize', lazyLayout); * * // execute `sendMail` when the click event is fired, debouncing subsequent calls * jQuery('#postbox').on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * }); * * // ensure `batchLog` is executed once after 1 second of debounced calls * var source = new EventSource('/stream'); * source.addEventListener('message', _.debounce(batchLog, 250, { * 'maxWait': 1000 * }, false); */ function debounce(func, wait, options) { var args, maxTimeoutId, result, stamp, thisArg, timeoutId, trailingCall, lastCalled = 0, maxWait = false, trailing = true; if (!isFunction(func)) { throw new TypeError; } wait = nativeMax(0, wait) || 0; if (options === true) { var leading = true; trailing = false; } else if (isObject(options)) { leading = options.leading; maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0); trailing = 'trailing' in options ? options.trailing : trailing; } var delayed = function() { var remaining = wait - (new Date - stamp); if (remaining <= 0) { if (maxTimeoutId) { clearTimeout(maxTimeoutId); } var isCalled = trailingCall; maxTimeoutId = timeoutId = trailingCall = undefined; if (isCalled) { lastCalled = +new Date; result = func.apply(thisArg, args); } } else { timeoutId = setTimeout(delayed, remaining); } }; var maxDelayed = function() { if (timeoutId) { clearTimeout(timeoutId); } maxTimeoutId = timeoutId = trailingCall = undefined; if (trailing || (maxWait !== wait)) { lastCalled = +new Date; result = func.apply(thisArg, args); } }; return function() { args = arguments; stamp = +new Date; thisArg = this; trailingCall = trailing && (timeoutId || !leading); if (maxWait === false) { var leadingCall = leading && !timeoutId; } else { if (!maxTimeoutId && !leading) { lastCalled = stamp; } var remaining = maxWait - (stamp - lastCalled); if (remaining <= 0) { if (maxTimeoutId) { maxTimeoutId = clearTimeout(maxTimeoutId); } lastCalled = stamp; result = func.apply(thisArg, args); } else if (!maxTimeoutId) { maxTimeoutId = setTimeout(maxDelayed, remaining); } } if (!timeoutId && wait !== maxWait) { timeoutId = setTimeout(delayed, wait); } if (leadingCall) { result = func.apply(thisArg, args); } return result; }; } /** * Defers executing the `func` function until the current call stack has cleared. * Additional arguments will be provided to `func` when it is invoked. * * @static * @memberOf _ * @category Functions * @param {Function} func The function to defer. * @param {...*} [arg] Arguments to invoke the function with. * @returns {number} Returns the timer id. * @example * * _.defer(function() { console.log('deferred'); }); * // returns from the function before 'deferred' is logged */ function defer(func) { if (!isFunction(func)) { throw new TypeError; } var args = nativeSlice.call(arguments, 1); return setTimeout(function() { func.apply(undefined, args); }, 1); } /** * Executes the `func` function after `wait` milliseconds. Additional arguments * will be provided to `func` when it is invoked. * * @static * @memberOf _ * @category Functions * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay execution. * @param {...*} [arg] Arguments to invoke the function with. * @returns {number} Returns the timer id. * @example * * var log = _.bind(console.log, console); * _.delay(log, 1000, 'logged later'); * // => 'logged later' (Appears after one second.) */ function delay(func, wait) { if (!isFunction(func)) { throw new TypeError; } var args = nativeSlice.call(arguments, 2); return setTimeout(function() { func.apply(undefined, args); }, wait); } /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided it will be used to determine the cache key for storing the result * based on the arguments provided to the memoized function. By default, the * first argument provided to the memoized function is used as the cache key. * The `func` is executed with the `this` binding of the memoized function. * The result cache is exposed as the `cache` property on the memoized function. * * @static * @memberOf _ * @category Functions * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] A function used to resolve the cache key. * @returns {Function} Returns the new memoizing function. * @example * * var fibonacci = _.memoize(function(n) { * return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); * }); * * var data = { * 'moe': { 'name': 'moe', 'age': 40 }, * 'curly': { 'name': 'curly', 'age': 60 } * }; * * // modifying the result cache * var stooge = _.memoize(function(name) { return data[name]; }, _.identity); * stooge('curly'); * // => { 'name': 'curly', 'age': 60 } * * stooge.cache.curly.name = 'jerome'; * stooge('curly'); * // => { 'name': 'jerome', 'age': 60 } */ function memoize(func, resolver) { if (!isFunction(func)) { throw new TypeError; } var memoized = function() { var cache = memoized.cache, key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0]; return hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = func.apply(this, arguments)); } memoized.cache = {}; return memoized; } /** * Creates a function that is restricted to execute `func` once. Repeat calls to * the function will return the value of the first call. The `func` is executed * with the `this` binding of the created function. * * @static * @memberOf _ * @category Functions * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * var initialize = _.once(createApplication); * initialize(); * initialize(); * // `initialize` executes `createApplication` once */ function once(func) { var ran, result; if (!isFunction(func)) { throw new TypeError; } return function() { if (ran) { return result; } ran = true; result = func.apply(this, arguments); // clear the `func` variable so the function may be garbage collected func = null; return result; }; } /** * Creates a function that, when called, invokes `func` with any additional * `partial` arguments prepended to those provided to the new function. This * method is similar to `_.bind` except it does **not** alter the `this` binding. * * @static * @memberOf _ * @category Functions * @param {Function} func The function to partially apply arguments to. * @param {...*} [arg] Arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * * var greet = function(greeting, name) { return greeting + ' ' + name; }; * var hi = _.partial(greet, 'hi'); * hi('moe'); * // => 'hi moe' */ function partial(func) { return createBound(func, 16, nativeSlice.call(arguments, 1)); } /** * This method is like `_.partial` except that `partial` arguments are * appended to those provided to the new function. * * @static * @memberOf _ * @category Functions * @param {Function} func The function to partially apply arguments to. * @param {...*} [arg] Arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * * var defaultsDeep = _.partialRight(_.merge, _.defaults); * * var options = { * 'variable': 'data', * 'imports': { 'jq': $ } * }; * * defaultsDeep(options, _.templateSettings); * * options.variable * // => 'data' * * options.imports * // => { '_': _, 'jq': $ } */ function partialRight(func) { return createBound(func, 32, null, nativeSlice.call(arguments, 1)); } /** * Creates a function that, when executed, will only call the `func` function * at most once per every `wait` milliseconds. Provide an options object to * indicate that `func` should be invoked on the leading and/or trailing edge * of the `wait` timeout. Subsequent calls to the throttled function will * return the result of the last `func` call. * * Note: If `leading` and `trailing` options are `true` `func` will be called * on the trailing edge of the timeout only if the the throttled function is * invoked more than once during the `wait` timeout. * * @static * @memberOf _ * @category Functions * @param {Function} func The function to throttle. * @param {number} wait The number of milliseconds to throttle executions to. * @param {Object} [options] The options object. * @param {boolean} [options.leading=true] Specify execution on the leading edge of the timeout. * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout. * @returns {Function} Returns the new throttled function. * @example * * // avoid excessively updating the position while scrolling * var throttled = _.throttle(updatePosition, 100); * jQuery(window).on('scroll', throttled); * * // execute `renewToken` when the click event is fired, but not more than once every 5 minutes * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { * 'trailing': false * })); */ function throttle(func, wait, options) { var leading = true, trailing = true; if (!isFunction(func)) { throw new TypeError; } if (options === false) { leading = false; } else if (isObject(options)) { leading = 'leading' in options ? options.leading : leading; trailing = 'trailing' in options ? options.trailing : trailing; } options = getObject(); options.leading = leading; options.maxWait = wait; options.trailing = trailing; var result = debounce(func, wait, options); releaseObject(options); return result; } /** * Creates a function that provides `value` to the wrapper function as its * first argument. Additional arguments provided to the function are appended * to those provided to the wrapper function. The wrapper is executed with * the `this` binding of the created function. * * @static * @memberOf _ * @category Functions * @param {*} value The value to wrap. * @param {Function} wrapper The wrapper function. * @returns {Function} Returns the new function. * @example * * var hello = function(name) { return 'hello ' + name; }; * hello = _.wrap(hello, function(func) { * return 'before, ' + func('moe') + ', after'; * }); * hello(); * // => 'before, hello moe, after' */ function wrap(value, wrapper) { if (!isFunction(wrapper)) { throw new TypeError; } return function() { var args = [value]; push.apply(args, arguments); return wrapper.apply(this, args); }; } /*--------------------------------------------------------------------------*/ /** * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their * corresponding HTML entities. * * @static * @memberOf _ * @category Utilities * @param {string} string The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escape('Moe, Larry & Curly'); * // => 'Moe, Larry &amp; Curly' */ function escape(string) { return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar); } /** * This method returns the first argument provided to it. * * @static * @memberOf _ * @category Utilities * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var moe = { 'name': 'moe' }; * moe === _.identity(moe); * // => true */ function identity(value) { return value; } /** * Adds function properties of a source object to the `lodash` function and * chainable wrapper. * * @static * @memberOf _ * @category Utilities * @param {Object} object The object of function properties to add to `lodash`. * @param {Object} object The object of function properties to add to `lodash`. * @example * * _.mixin({ * 'capitalize': function(string) { * return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); * } * }); * * _.capitalize('moe'); * // => 'Moe' * * _('moe').capitalize(); * // => 'Moe' */ function mixin(object, source) { var ctor = object, isFunc = !source || isFunction(ctor); if (!source) { ctor = lodashWrapper; source = object; object = lodash; } forEach(functions(source), function(methodName) { var func = object[methodName] = source[methodName]; if (isFunc) { ctor.prototype[methodName] = function() { var value = this.__wrapped__, args = [value]; push.apply(args, arguments); var result = func.apply(object, args); return (value && typeof value == 'object' && value === result) ? this : new ctor(result); }; } }); } /** * Reverts the '_' variable to its previous value and returns a reference to * the `lodash` function. * * @static * @memberOf _ * @category Utilities * @returns {Function} Returns the `lodash` function. * @example * * var lodash = _.noConflict(); */ function noConflict() { context._ = oldDash; return this; } /** * Converts the given value into an integer of the specified radix. * If `radix` is `undefined` or `0` a `radix` of `10` is used unless the * `value` is a hexadecimal, in which case a `radix` of `16` is used. * * Note: This method avoids differences in native ES3 and ES5 `parseInt` * implementations. See http://es5.github.io/#E. * * @static * @memberOf _ * @category Utilities * @param {string} value The value to parse. * @param {number} [radix] The radix used to interpret the value to parse. * @returns {number} Returns the new integer value. * @example * * _.parseInt('08'); * // => 8 */ var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) { // Firefox and Opera still follow the ES3 specified implementation of `parseInt` return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0); }; /** * Produces a random number between `min` and `max` (inclusive). If only one * argument is provided a number between `0` and the given number will be * returned. If `floating` is truey or either `min` or `max` are floats a * floating-point number will be returned instead of an integer. * * @static * @memberOf _ * @category Utilities * @param {number} [min=0] The minimum possible value. * @param {number} [max=1] The maximum possible value. * @param {boolean} [floating=false] Specify returning a floating-point number. * @returns {number} Returns a random number. * @example * * _.random(0, 5); * // => an integer between 0 and 5 * * _.random(5); * // => also an integer between 0 and 5 * * _.random(5, true); * // => a floating-point number between 0 and 5 * * _.random(1.2, 5.2); * // => a floating-point number between 1.2 and 5.2 */ function random(min, max, floating) { var noMin = min == null, noMax = max == null; if (floating == null) { if (typeof min == 'boolean' && noMax) { floating = min; min = 1; } else if (!noMax && typeof max == 'boolean') { floating = max; noMax = true; } } if (noMin && noMax) { max = 1; } min = +min || 0; if (noMax) { max = min; min = 0; } else { max = +max || 0; } var rand = nativeRandom(); return (floating || min % 1 || max % 1) ? min + nativeMin(rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1))), max) : min + floor(rand * (max - min + 1)); } /** * Resolves the value of `property` on `object`. If `property` is a function * it will be invoked with the `this` binding of `object` and its result returned, * else the property value is returned. If `object` is falsey then `undefined` * is returned. * * @static * @memberOf _ * @category Utilities * @param {Object} object The object to inspect. * @param {string} property The property to get the value of. * @returns {*} Returns the resolved value. * @example * * var object = { * 'cheese': 'crumpets', * 'stuff': function() { * return 'nonsense'; * } * }; * * _.result(object, 'cheese'); * // => 'crumpets' * * _.result(object, 'stuff'); * // => 'nonsense' */ function result(object, property) { if (object) { var value = object[property]; return isFunction(value) ? object[property]() : value; } } /** * A micro-templating method that handles arbitrary delimiters, preserves * whitespace, and correctly escapes quotes within interpolated code. * * Note: In the development build, `_.template` utilizes sourceURLs for easier * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl * * For more information on precompiling templates see: * http://lodash.com/#custom-builds * * For more information on Chrome extension sandboxes see: * http://developer.chrome.com/stable/extensions/sandboxingEval.html * * @static * @memberOf _ * @category Utilities * @param {string} text The template text. * @param {Object} data The data object used to populate the text. * @param {Object} [options] The options object. * @param {RegExp} [options.escape] The "escape" delimiter. * @param {RegExp} [options.evaluate] The "evaluate" delimiter. * @param {Object} [options.imports] An object to import into the template as local variables. * @param {RegExp} [options.interpolate] The "interpolate" delimiter. * @param {string} [sourceURL] The sourceURL of the template's compiled source. * @param {string} [variable] The data object variable name. * @returns {Function|string} Returns a compiled function when no `data` object * is given, else it returns the interpolated text. * @example * * // using the "interpolate" delimiter to create a compiled template * var compiled = _.template('hello <%= name %>'); * compiled({ 'name': 'moe' }); * // => 'hello moe' * * // using the "escape" delimiter to escape HTML in data property values * _.template('<b><%- value %></b>', { 'value': '<script>' }); * // => '<b>&lt;script&gt;</b>' * * // using the "evaluate" delimiter to generate HTML * var list = '<% _.forEach(people, function(name) { %><li><%- name %></li><% }); %>'; * _.template(list, { 'people': ['moe', 'larry'] }); * // => '<li>moe</li><li>larry</li>' * * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter * _.template('hello ${ name }', { 'name': 'curly' }); * // => 'hello curly' * * // using the internal `print` function in "evaluate" delimiters * _.template('<% print("hello " + name); %>!', { 'name': 'larry' }); * // => 'hello larry!' * * // using a custom template delimiters * _.templateSettings = { * 'interpolate': /{{([\s\S]+?)}}/g * }; * * _.template('hello {{ name }}!', { 'name': 'mustache' }); * // => 'hello mustache!' * * // using the `imports` option to import jQuery * var list = '<% $.each(people, function(name) { %><li><%- name %></li><% }); %>'; * _.template(list, { 'people': ['moe', 'larry'] }, { 'imports': { '$': jQuery } }); * // => '<li>moe</li><li>larry</li>' * * // using the `sourceURL` option to specify a custom sourceURL for the template * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' }); * compiled(data); * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector * * // using the `variable` option to ensure a with-statement isn't used in the compiled template * var compiled = _.template('hi <%= data.name %>!', null, { 'variable': 'data' }); * compiled.source; * // => function(data) { * var __t, __p = '', __e = _.escape; * __p += 'hi ' + ((__t = ( data.name )) == null ? '' : __t) + '!'; * return __p; * } * * // using the `source` property to inline compiled templates for meaningful * // line numbers in error messages and a stack trace * fs.writeFileSync(path.join(cwd, 'jst.js'), '\ * var JST = {\ * "main": ' + _.template(mainText).source + '\ * };\ * '); */ function template(text, data, options) { // based on John Resig's `tmpl` implementation // http://ejohn.org/blog/javascript-micro-templating/ // and Laura Doktorova's doT.js // https://github.com/olado/doT var settings = lodash.templateSettings; text || (text = ''); // avoid missing dependencies when `iteratorTemplate` is not defined options = defaults({}, options, settings); var imports = defaults({}, options.imports, settings.imports), importsKeys = keys(imports), importsValues = values(imports); var isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; // compile the regexp to match each delimiter var reDelimiters = RegExp( (options.escape || reNoMatch).source + '|' + interpolate.source + '|' + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' + (options.evaluate || reNoMatch).source + '|$' , 'g'); text.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { interpolateValue || (interpolateValue = esTemplateValue); // escape characters that cannot be included in string literals source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar); // replace delimiters with snippets if (escapeValue) { source += "' +\n__e(" + escapeValue + ") +\n'"; } if (evaluateValue) { isEvaluating = true; source += "';\n" + evaluateValue + ";\n__p += '"; } if (interpolateValue) { source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; } index = offset + match.length; // the JS engine embedded in Adobe products requires returning the `match` // string in order to produce the correct `offset` value return match; }); source += "';\n"; // if `variable` is not specified, wrap a with-statement around the generated // code to add the data object to the top of the scope chain var variable = options.variable, hasVariable = variable; if (!hasVariable) { variable = 'obj'; source = 'with (' + variable + ') {\n' + source + '\n}\n'; } // cleanup code by stripping empty strings source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) .replace(reEmptyStringMiddle, '$1') .replace(reEmptyStringTrailing, '$1;'); // frame code as the function body source = 'function(' + variable + ') {\n' + (hasVariable ? '' : variable + ' || (' + variable + ' = {});\n') + "var __t, __p = '', __e = _.escape" + (isEvaluating ? ', __j = Array.prototype.join;\n' + "function print() { __p += __j.call(arguments, '') }\n" : ';\n' ) + source + 'return __p\n}'; // Use a sourceURL for easier debugging. // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl var sourceURL = '\n/*\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/'; try { var result = Function(importsKeys, 'return ' + source + sourceURL).apply(undefined, importsValues); } catch(e) { e.source = source; throw e; } if (data) { return result(data); } // provide the compiled function's source by its `toString` method, in // supported environments, or the `source` property as a convenience for // inlining compiled templates during the build process result.source = source; return result; } /** * Executes the callback `n` times, returning an array of the results * of each callback execution. The callback is bound to `thisArg` and invoked * with one argument; (index). * * @static * @memberOf _ * @category Utilities * @param {number} n The number of times to execute the callback. * @param {Function} callback The function called per iteration. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns an array of the results of each `callback` execution. * @example * * var diceRolls = _.times(3, _.partial(_.random, 1, 6)); * // => [3, 6, 4] * * _.times(3, function(n) { mage.castSpell(n); }); * // => calls `mage.castSpell(n)` three times, passing `n` of `0`, `1`, and `2` respectively * * _.times(3, function(n) { this.cast(n); }, mage); * // => also calls `mage.castSpell(n)` three times */ function times(n, callback, thisArg) { n = (n = +n) > -1 ? n : 0; var index = -1, result = Array(n); callback = baseCreateCallback(callback, thisArg, 1); while (++index < n) { result[index] = callback(index); } return result; } /** * The inverse of `_.escape` this method converts the HTML entities * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their * corresponding characters. * * @static * @memberOf _ * @category Utilities * @param {string} string The string to unescape. * @returns {string} Returns the unescaped string. * @example * * _.unescape('Moe, Larry &amp; Curly'); * // => 'Moe, Larry & Curly' */ function unescape(string) { return string == null ? '' : String(string).replace(reEscapedHtml, unescapeHtmlChar); } /** * Generates a unique ID. If `prefix` is provided the ID will be appended to it. * * @static * @memberOf _ * @category Utilities * @param {string} [prefix] The value to prefix the ID with. * @returns {string} Returns the unique ID. * @example * * _.uniqueId('contact_'); * // => 'contact_104' * * _.uniqueId(); * // => '105' */ function uniqueId(prefix) { var id = ++idCounter; return String(prefix == null ? '' : prefix) + id; } /*--------------------------------------------------------------------------*/ /** * Creates a `lodash` object that wraps the given value. * * @static * @memberOf _ * @category Chaining * @param {*} value The value to wrap. * @returns {Object} Returns the wrapper object. * @example * * var stooges = [ * { 'name': 'moe', 'age': 40 }, * { 'name': 'larry', 'age': 50 }, * { 'name': 'curly', 'age': 60 } * ]; * * var youngest = _.chain(stooges) * .sortBy(function(stooge) { return stooge.age; }) * .map(function(stooge) { return stooge.name + ' is ' + stooge.age; }) * .first(); * // => 'moe is 40' */ function chain(value) { value = new lodashWrapper(value); value.__chain__ = true; return value; } /** * Invokes `interceptor` with the `value` as the first argument and then * returns `value`. The purpose of this method is to "tap into" a method * chain in order to perform operations on intermediate results within * the chain. * * @static * @memberOf _ * @category Chaining * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @returns {*} Returns `value`. * @example * * _([1, 2, 3, 4]) * .filter(function(num) { return num % 2 == 0; }) * .tap(function(array) { console.log(array); }) * .map(function(num) { return num * num; }) * .value(); * // => // [2, 4] (logged) * // => [4, 16] */ function tap(value, interceptor) { interceptor(value); return value; } /** * Enables method chaining on the wrapper object. * * @name chain * @memberOf _ * @category Chaining * @returns {*} Returns the wrapper object. * @example * * var sum = _([1, 2, 3]) * .chain() * .reduce(function(sum, num) { return sum + num; }) * .value() * // => 6` */ function wrapperChain() { this.__chain__ = true; return this; } /** * Produces the `toString` result of the wrapped value. * * @name toString * @memberOf _ * @category Chaining * @returns {string} Returns the string result. * @example * * _([1, 2, 3]).toString(); * // => '1,2,3' */ function wrapperToString() { return String(this.__wrapped__); } /** * Extracts the wrapped value. * * @name valueOf * @memberOf _ * @alias value * @category Chaining * @returns {*} Returns the wrapped value. * @example * * _([1, 2, 3]).valueOf(); * // => [1, 2, 3] */ function wrapperValueOf() { return this.__wrapped__; } /*--------------------------------------------------------------------------*/ // add functions that return wrapped values when chaining lodash.after = after; lodash.assign = assign; lodash.at = at; lodash.bind = bind; lodash.bindAll = bindAll; lodash.bindKey = bindKey; lodash.chain = chain; lodash.compact = compact; lodash.compose = compose; lodash.countBy = countBy; lodash.createCallback = createCallback; lodash.curry = curry; lodash.debounce = debounce; lodash.defaults = defaults; lodash.defer = defer; lodash.delay = delay; lodash.difference = difference; lodash.filter = filter; lodash.flatten = flatten; lodash.forEach = forEach; lodash.forEachRight = forEachRight; lodash.forIn = forIn; lodash.forInRight = forInRight; lodash.forOwn = forOwn; lodash.forOwnRight = forOwnRight; lodash.functions = functions; lodash.groupBy = groupBy; lodash.indexBy = indexBy; lodash.initial = initial; lodash.intersection = intersection; lodash.invert = invert; lodash.invoke = invoke; lodash.keys = keys; lodash.map = map; lodash.max = max; lodash.memoize = memoize; lodash.merge = merge; lodash.min = min; lodash.omit = omit; lodash.once = once; lodash.pairs = pairs; lodash.partial = partial; lodash.partialRight = partialRight; lodash.pick = pick; lodash.pluck = pluck; lodash.pull = pull; lodash.range = range; lodash.reject = reject; lodash.remove = remove; lodash.rest = rest; lodash.shuffle = shuffle; lodash.sortBy = sortBy; lodash.tap = tap; lodash.throttle = throttle; lodash.times = times; lodash.toArray = toArray; lodash.transform = transform; lodash.union = union; lodash.uniq = uniq; lodash.values = values; lodash.where = where; lodash.without = without; lodash.wrap = wrap; lodash.zip = zip; lodash.zipObject = zipObject; // add aliases lodash.collect = map; lodash.drop = rest; lodash.each = forEach; lodash.eachRight = forEachRight; lodash.extend = assign; lodash.methods = functions; lodash.object = zipObject; lodash.select = filter; lodash.tail = rest; lodash.unique = uniq; lodash.unzip = zip; // add functions to `lodash.prototype` mixin(lodash); /*--------------------------------------------------------------------------*/ // add functions that return unwrapped values when chaining lodash.clone = clone; lodash.cloneDeep = cloneDeep; lodash.contains = contains; lodash.escape = escape; lodash.every = every; lodash.find = find; lodash.findIndex = findIndex; lodash.findKey = findKey; lodash.findLast = findLast; lodash.findLastIndex = findLastIndex; lodash.findLastKey = findLastKey; lodash.has = has; lodash.identity = identity; lodash.indexOf = indexOf; lodash.isArguments = isArguments; lodash.isArray = isArray; lodash.isBoolean = isBoolean; lodash.isDate = isDate; lodash.isElement = isElement; lodash.isEmpty = isEmpty; lodash.isEqual = isEqual; lodash.isFinite = isFinite; lodash.isFunction = isFunction; lodash.isNaN = isNaN; lodash.isNull = isNull; lodash.isNumber = isNumber; lodash.isObject = isObject; lodash.isPlainObject = isPlainObject; lodash.isRegExp = isRegExp; lodash.isString = isString; lodash.isUndefined = isUndefined; lodash.lastIndexOf = lastIndexOf; lodash.mixin = mixin; lodash.noConflict = noConflict; lodash.parseInt = parseInt; lodash.random = random; lodash.reduce = reduce; lodash.reduceRight = reduceRight; lodash.result = result; lodash.runInContext = runInContext; lodash.size = size; lodash.some = some; lodash.sortedIndex = sortedIndex; lodash.template = template; lodash.unescape = unescape; lodash.uniqueId = uniqueId; // add aliases lodash.all = every; lodash.any = some; lodash.detect = find; lodash.findWhere = find; lodash.foldl = reduce; lodash.foldr = reduceRight; lodash.include = contains; lodash.inject = reduce; forOwn(lodash, function(func, methodName) { if (!lodash.prototype[methodName]) { lodash.prototype[methodName] = function() { var args = [this.__wrapped__], chainAll = this.__chain__; push.apply(args, arguments); var result = func.apply(lodash, args); return chainAll ? new lodashWrapper(result, chainAll) : result; }; } }); /*--------------------------------------------------------------------------*/ // add functions capable of returning wrapped and unwrapped values when chaining lodash.first = first; lodash.last = last; lodash.sample = sample; // add aliases lodash.take = first; lodash.head = first; forOwn(lodash, function(func, methodName) { var callbackable = methodName !== 'sample'; if (!lodash.prototype[methodName]) { lodash.prototype[methodName]= function(n, guard) { var chainAll = this.__chain__, result = func(this.__wrapped__, n, guard); return !chainAll && (n == null || (guard && !(callbackable && typeof n == 'function'))) ? result : new lodashWrapper(result, chainAll); }; } }); /*--------------------------------------------------------------------------*/ /** * The semantic version number. * * @static * @memberOf _ * @type string */ lodash.VERSION = '2.1.0'; // add "Chaining" functions to the wrapper lodash.prototype.chain = wrapperChain; lodash.prototype.toString = wrapperToString; lodash.prototype.value = wrapperValueOf; lodash.prototype.valueOf = wrapperValueOf; // add `Array` functions that return unwrapped values baseEach(['join', 'pop', 'shift'], function(methodName) { var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { var chainAll = this.__chain__, result = func.apply(this.__wrapped__, arguments); return chainAll ? new lodashWrapper(result, chainAll) : result; }; }); // add `Array` functions that return the wrapped value baseEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) { var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { func.apply(this.__wrapped__, arguments); return this; }; }); // add `Array` functions that return new wrapped values baseEach(['concat', 'slice', 'splice'], function(methodName) { var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { return new lodashWrapper(func.apply(this.__wrapped__, arguments), this.__chain__); }; }); return lodash; } /*--------------------------------------------------------------------------*/ // expose Lo-Dash var _ = runInContext(); // some AMD build optimizers, like r.js, check for condition patterns like the following: if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { // Expose Lo-Dash to the global object even when an AMD loader is present in // case Lo-Dash was injected by a third-party script and not intended to be // loaded as a module. The global assignment can be reverted in the Lo-Dash // module by its `noConflict()` method. root._ = _; // define as an anonymous module so, through path mapping, it can be // referenced as the "underscore" module define(function() { return _; }); } // check for `exports` after `define` in case a build optimizer adds an `exports` object else if (freeExports && freeModule) { // in Node.js or RingoJS if (moduleExports) { (freeModule.exports = _)._ = _; } // in Narwhal or Rhino -require else { freeExports._ = _; } } else { // in a browser or Rhino root._ = _; } }.call(this));
stefanneculai/cdnjs
ajax/libs/lodash.js/2.1.0/lodash.mobile.js
JavaScript
mit
216,188
<?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Monolog\Formatter\NormalizerFormatter; /** * Class to record a log on a NewRelic application. * Enabling New Relic High Security mode may prevent capture of useful information. * * @see https://docs.newrelic.com/docs/agents/php-agent * @see https://docs.newrelic.com/docs/accounts-partnerships/accounts/security/high-security */ class NewRelicHandler extends AbstractProcessingHandler { /** * Name of the New Relic application that will receive logs from this handler. * * @var string */ protected $appName; /** * Name of the current transaction * * @var string */ protected $transactionName; /** * Some context and extra data is passed into the handler as arrays of values. Do we send them as is * (useful if we are using the API), or explode them for display on the NewRelic RPM website? * * @var boolean */ protected $explodeArrays; /** * {@inheritDoc} * * @param string $appName * @param boolean $explodeArrays * @param string $transactionName */ public function __construct( $level = Logger::ERROR, $bubble = true, $appName = null, $explodeArrays = false, $transactionName = null ) { parent::__construct($level, $bubble); $this->appName = $appName; $this->explodeArrays = $explodeArrays; $this->transactionName = $transactionName; } /** * {@inheritDoc} */ protected function write(array $record) { if (!$this->isNewRelicEnabled()) { throw new MissingExtensionException('The newrelic PHP extension is required to use the NewRelicHandler'); } if ($appName = $this->getAppName($record['context'])) { $this->setNewRelicAppName($appName); } if ($transactionName = $this->getTransactionName($record['context'])) { $this->setNewRelicTransactionName($transactionName); unset($record['formatted']['context']['transaction_name']); } if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Exception) { newrelic_notice_error($record['message'], $record['context']['exception']); unset($record['formatted']['context']['exception']); } else { newrelic_notice_error($record['message']); } foreach ($record['formatted']['context'] as $key => $parameter) { if (is_array($parameter) && $this->explodeArrays) { foreach ($parameter as $paramKey => $paramValue) { $this->setNewRelicParameter('context_' . $key . '_' . $paramKey, $paramValue); } } else { $this->setNewRelicParameter('context_' . $key, $parameter); } } foreach ($record['formatted']['extra'] as $key => $parameter) { if (is_array($parameter) && $this->explodeArrays) { foreach ($parameter as $paramKey => $paramValue) { $this->setNewRelicParameter('extra_' . $key . '_' . $paramKey, $paramValue); } } else { $this->setNewRelicParameter('extra_' . $key, $parameter); } } } /** * Checks whether the NewRelic extension is enabled in the system. * * @return bool */ protected function isNewRelicEnabled() { return extension_loaded('newrelic'); } /** * Returns the appname where this log should be sent. Each log can override the default appname, set in this * handler's constructor, by providing the appname in it's context. * * @param array $context * @return null|string */ protected function getAppName(array $context) { if (isset($context['appname'])) { return $context['appname']; } return $this->appName; } /** * Returns the name of the current transaction. Each log can override the default transaction name, set in this * handler's constructor, by providing the transaction_name in it's context * * @param array $context * * @return null|string */ protected function getTransactionName(array $context) { if (isset($context['transaction_name'])) { return $context['transaction_name']; } return $this->transactionName; } /** * Sets the NewRelic application that should receive this log. * * @param string $appName */ protected function setNewRelicAppName($appName) { newrelic_set_appname($appName); } /** * Overwrites the name of the current transaction * * @param string $transactionName */ protected function setNewRelicTransactionName($transactionName) { newrelic_name_transaction($transactionName); } /** * @param string $key * @param mixed $value */ protected function setNewRelicParameter($key, $value) { if (null === $value || is_scalar($value)) { newrelic_add_custom_parameter($key, $value); } else { newrelic_add_custom_parameter($key, @json_encode($value)); } } /** * {@inheritDoc} */ protected function getDefaultFormatter() { return new NormalizerFormatter(); } }
absalan/Test
vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php
PHP
mit
5,735
(function(){function g(h){return h.type==CKEDITOR.NODE_TEXT&&0<h.getLength()&&(!e||!h.isReadOnly())}function c(h){return !(h.type==CKEDITOR.NODE_ELEMENT&&h.isBlockBoundary(CKEDITOR.tools.extend({},CKEDITOR.dtd.$empty,CKEDITOR.dtd.$nonEditable)))}var e,b=function(){return{textNode:this.textNode,offset:this.offset,character:this.textNode?this.textNode.getText().charAt(this.offset):null,hitMatchBoundary:this._.matchBoundary}},a=["find","replace"],d=[["txtFindFind","txtFindReplace"],["txtFindCaseChk","txtReplaceCaseChk"],["txtFindWordChk","txtReplaceWordChk"],["txtFindCyclic","txtReplaceCyclic"]],f=function(t,m){function j(n,l){var q=t.createRange();q.setStart(n.textNode,l?n.offset:n.offset+1);q.setEndAt(t.editable(),CKEDITOR.POSITION_BEFORE_END);return q}function i(n){var l=t.getSelection(),q=t.editable();l&&!n?(n=l.getRanges()[0].clone(),n.collapse(!0)):(n=t.createRange(),n.setStartAt(q,CKEDITOR.POSITION_AFTER_START));n.setEndAt(q,CKEDITOR.POSITION_BEFORE_END);return n}var A=new CKEDITOR.style(CKEDITOR.tools.extend({attributes:{"data-cke-highlight":1},fullMatch:1,ignoreReadonly:1,childRule:function(){return 0}},t.config.find_highlight,!0)),k=function(n,l){var q=this,r=new CKEDITOR.dom.walker(n);r.guard=l?c:function(v){!c(v)&&(q._.matchBoundary=!0)};r.evaluator=g;r.breakOnFalse=1;n.startContainer.type==CKEDITOR.NODE_TEXT&&(this.textNode=n.startContainer,this.offset=n.startOffset-1);this._={matchWord:l,walker:r,matchBoundary:!1}};k.prototype={next:function(){return this.move()},back:function(){return this.move(!0)},move:function(n){var l=this.textNode;if(null===l){return b.call(this)}this._.matchBoundary=!1;if(l&&n&&0<this.offset){this.offset--}else{if(l&&this.offset<l.getLength()-1){this.offset++}else{for(l=null;!l&&!(l=this._.walker[n?"previous":"next"].call(this._.walker),this._.matchWord&&!l||this._.walker._.end);){}this.offset=(this.textNode=l)?n?l.getLength()-1:0:0}}return b.call(this)}};var h=function(n,l){this._={walker:n,cursors:[],rangeLength:l,highlightRange:null,isMatched:0}};h.prototype={toDomRange:function(){var n=t.createRange(),l=this._.cursors;if(1>l.length){var q=this._.walker.textNode;if(q){n.setStartAfter(q)}else{return null}}else{q=l[0],l=l[l.length-1],n.setStart(q.textNode,q.offset),n.setEnd(l.textNode,l.offset+1)}return n},updateFromDomRange:function(n){var l=new k(n);this._.cursors=[];do{n=l.next(),n.character&&this._.cursors.push(n)}while(n.character);this._.rangeLength=this._.cursors.length},setMatched:function(){this._.isMatched=!0},clearMatched:function(){this._.isMatched=!1},isMatched:function(){return this._.isMatched},highlight:function(){if(!(1>this._.cursors.length)){this._.highlightRange&&this.removeHighlight();var n=this.toDomRange(),l=n.createBookmark();A.applyToRange(n);n.moveToBookmark(l);this._.highlightRange=n;l=n.startContainer;l.type!=CKEDITOR.NODE_ELEMENT&&(l=l.getParent());l.scrollIntoView();this.updateFromDomRange(n)}},removeHighlight:function(){if(this._.highlightRange){var l=this._.highlightRange.createBookmark();A.removeFromRange(this._.highlightRange);this._.highlightRange.moveToBookmark(l);this.updateFromDomRange(this._.highlightRange);this._.highlightRange=null}},isReadOnly:function(){return !this._.highlightRange?0:this._.highlightRange.startContainer.isReadOnly()},moveBack:function(){var n=this._.walker.back(),l=this._.cursors;n.hitMatchBoundary&&(this._.cursors=l=[]);l.unshift(n);l.length>this._.rangeLength&&l.pop();return n},moveNext:function(){var n=this._.walker.next(),l=this._.cursors;n.hitMatchBoundary&&(this._.cursors=l=[]);l.push(n);l.length>this._.rangeLength&&l.shift();return n},getEndCharacter:function(){var l=this._.cursors;return 1>l.length?null:l[l.length-1].character},getNextCharacterRange:function(n){var l,q;q=this._.cursors;q=(l=q[q.length-1])&&l.textNode?new k(j(l)):this._.walker;return new h(q,n)},getCursors:function(){return this._.cursors}};var y=function(n,l){var q=[-1];l&&(n=n.toLowerCase());for(var r=0;r<n.length;r++){for(q.push(q[r]+1);0<q[r+1]&&n.charAt(r)!=n.charAt(q[r+1]-1);){q[r+1]=q[q[r+1]-1]+1}}this._={overlap:q,state:0,ignoreCase:!!l,pattern:n}};y.prototype={feedCharacter:function(l){for(this._.ignoreCase&&(l=l.toLowerCase());;){if(l==this._.pattern.charAt(this._.state)){return this._.state++,this._.state==this._.pattern.length?(this._.state=0,2):1}if(this._.state){this._.state=this._.overlap[this._.state]}else{return 0}}return null},reset:function(){this._.state=0}};var s=/[.,"'?!;: \u0085\u00a0\u1680\u280e\u2028\u2029\u202f\u205f\u3000]/,u=function(n){if(!n){return !0}var l=n.charCodeAt(0);return 9<=l&&13>=l||8192<=l&&8202>=l||s.test(n)},p={searchRange:null,matchRange:null,find:function(E,D,C,z,B,l){this.matchRange?(this.matchRange.removeHighlight(),this.matchRange=this.matchRange.getNextCharacterRange(E.length)):this.matchRange=new h(new k(this.searchRange),E.length);for(var v=new y(E,!D),r=0,q="%";null!==q;){for(this.matchRange.moveNext();q=this.matchRange.getEndCharacter();){r=v.feedCharacter(q);if(2==r){break}this.matchRange.moveNext().hitMatchBoundary&&v.reset()}if(2==r){if(C){var w=this.matchRange.getCursors(),n=w[w.length-1],w=w[0],x=t.createRange();x.setStartAt(t.editable(),CKEDITOR.POSITION_AFTER_START);x.setEnd(w.textNode,w.offset);w=x;n=j(n);w.trim();n.trim();w=new k(w,!0);n=new k(n,!0);if(!u(w.back().character)||!u(n.next().character)){continue}}this.matchRange.setMatched();!1!==B&&this.matchRange.highlight();return !0}}this.matchRange.clearMatched();this.matchRange.removeHighlight();return z&&!l?(this.searchRange=i(1),this.matchRange=null,arguments.callee.apply(this,Array.prototype.slice.call(arguments).concat([!0]))):!1},replaceCounter:0,replace:function(n,l,z,w,x,v,r){e=1;n=0;if(this.matchRange&&this.matchRange.isMatched()&&!this.matchRange._.isReplaced&&!this.matchRange.isReadOnly()){this.matchRange.removeHighlight();l=this.matchRange.toDomRange();z=t.document.createText(z);if(!r){var q=t.getSelection();q.selectRanges([l]);t.fire("saveSnapshot")}l.deleteContents();l.insertNode(z);r||(q.selectRanges([l]),t.fire("saveSnapshot"));this.matchRange.updateFromDomRange(l);r||this.matchRange.highlight();this.matchRange._.isReplaced=!0;this.replaceCounter++;n=1}else{n=this.find(l,w,x,v,!r)}e=0;return n}},o=t.lang.find;return{title:o.title,resizable:CKEDITOR.DIALOG_RESIZE_NONE,minWidth:350,minHeight:170,buttons:[CKEDITOR.dialog.cancelButton(t,{label:t.lang.common.close})],contents:[{id:"find",label:o.find,title:o.find,accessKey:"",elements:[{type:"hbox",widths:["230px","90px"],children:[{type:"text",id:"txtFindFind",label:o.findWhat,isChanged:!1,labelLayout:"horizontal",accessKey:"F"},{type:"button",id:"btnFind",align:"left",style:"width:100%",label:o.find,onClick:function(){var l=this.getDialog();p.find(l.getValueOf("find","txtFindFind"),l.getValueOf("find","txtFindCaseChk"),l.getValueOf("find","txtFindWordChk"),l.getValueOf("find","txtFindCyclic"))||alert(o.notFoundMsg)}}]},{type:"fieldset",label:CKEDITOR.tools.htmlEncode(o.findOptions),style:"margin-top:29px",children:[{type:"vbox",padding:0,children:[{type:"checkbox",id:"txtFindCaseChk",isChanged:!1,label:o.matchCase},{type:"checkbox",id:"txtFindWordChk",isChanged:!1,label:o.matchWord},{type:"checkbox",id:"txtFindCyclic",isChanged:!1,"default":!0,label:o.matchCyclic}]}]}]},{id:"replace",label:o.replace,accessKey:"M",elements:[{type:"hbox",widths:["230px","90px"],children:[{type:"text",id:"txtFindReplace",label:o.findWhat,isChanged:!1,labelLayout:"horizontal",accessKey:"F"},{type:"button",id:"btnFindReplace",align:"left",style:"width:100%",label:o.replace,onClick:function(){var l=this.getDialog();p.replace(l,l.getValueOf("replace","txtFindReplace"),l.getValueOf("replace","txtReplace"),l.getValueOf("replace","txtReplaceCaseChk"),l.getValueOf("replace","txtReplaceWordChk"),l.getValueOf("replace","txtReplaceCyclic"))||alert(o.notFoundMsg)}}]},{type:"hbox",widths:["230px","90px"],children:[{type:"text",id:"txtReplace",label:o.replaceWith,isChanged:!1,labelLayout:"horizontal",accessKey:"R"},{type:"button",id:"btnReplaceAll",align:"left",style:"width:100%",label:o.replaceAll,isChanged:!1,onClick:function(){var l=this.getDialog();p.replaceCounter=0;p.searchRange=i(1);p.matchRange&&(p.matchRange.removeHighlight(),p.matchRange=null);for(t.fire("saveSnapshot");p.replace(l,l.getValueOf("replace","txtFindReplace"),l.getValueOf("replace","txtReplace"),l.getValueOf("replace","txtReplaceCaseChk"),l.getValueOf("replace","txtReplaceWordChk"),!1,!0);){}p.replaceCounter?(alert(o.replaceSuccessMsg.replace(/%1/,p.replaceCounter)),t.fire("saveSnapshot")):alert(o.notFoundMsg)}}]},{type:"fieldset",label:CKEDITOR.tools.htmlEncode(o.findOptions),children:[{type:"vbox",padding:0,children:[{type:"checkbox",id:"txtReplaceCaseChk",isChanged:!1,label:o.matchCase},{type:"checkbox",id:"txtReplaceWordChk",isChanged:!1,label:o.matchWord},{type:"checkbox",id:"txtReplaceCyclic",isChanged:!1,"default":!0,label:o.matchCyclic}]}]}]}],onLoad:function(){var n=this,l,q=0;this.on("hide",function(){q=0});this.on("show",function(){q=1});this.selectPage=CKEDITOR.tools.override(this.selectPage,function(r){return function(C){r.call(n,C);var B=n._.tabs[C],x;x="find"===C?"txtFindWordChk":"txtReplaceWordChk";l=n.getContentElement(C,"find"===C?"txtFindFind":"txtFindReplace");n.getContentElement(C,x);B.initialized||(CKEDITOR.document.getById(l._.inputId),B.initialized=!0);if(q){var w,C="find"===C?1:0,B=1-C,v,z=d.length;for(v=0;v<z;v++){x=this.getContentElement(a[C],d[v][C]),w=this.getContentElement(a[B],d[v][B]),w.setValue(x.getValue())}}}})},onShow:function(){p.searchRange=i();var n=this.getParentEditor().getSelection().getSelectedText(),l=this.getContentElement(m,"find"==m?"txtFindFind":"txtFindReplace");l.setValue(n);l.select();this.selectPage(m);this[("find"==m&&this._.editor.readOnly?"hide":"show")+"Page"]("replace")},onHide:function(){var l;p.matchRange&&p.matchRange.isMatched()&&(p.matchRange.removeHighlight(),t.focus(),(l=p.matchRange.toDomRange())&&t.getSelection().selectRanges([l]));delete p.matchRange},onFocus:function(){return"replace"==m?this.getContentElement("replace","txtFindReplace"):this.getContentElement("find","txtFindFind")}}};CKEDITOR.dialog.add("find",function(h){return f(h,"find")});CKEDITOR.dialog.add("replace",function(h){return f(h,"replace")})})();
kevinburke/cdnjs
ajax/libs/ckeditor/4.3.2/plugins/find/dialogs/find.min.js
JavaScript
mit
10,258
var fs = require('graceful-fs'); var path = require('path'); var mout = require('mout'); var Q = require('q'); var mkdirp = require('mkdirp'); var rimraf = require('rimraf'); var LRU = require('lru-cache'); var lockFile = require('lockfile'); var semver = require('../util/semver'); var readJson = require('../util/readJson'); var copy = require('../util/copy'); var md5 = require('../util/md5'); function ResolveCache(config) { // TODO: Make some config entries, such as: // - Max MB // - Max versions per source // - Max MB per source // - etc.. this._config = config; this._dir = this._config.storage.packages; this._lockDir = this._config.storage.packages; mkdirp.sync(this._lockDir); // Cache is stored/retrieved statically to ensure singularity // among instances this._cache = this.constructor._cache.get(this._dir); if (!this._cache) { this._cache = new LRU({ max: 100, maxAge: 60 * 5 * 1000 // 5 minutes }); this.constructor._cache.set(this._dir, this._cache); } // Ensure dir is created mkdirp.sync(this._dir); } // ----------------- ResolveCache.prototype.retrieve = function (source, target) { var sourceId = md5(source); var dir = path.join(this._dir, sourceId); var that = this; target = target || '*'; return this._getVersions(sourceId) .spread(function (versions) { var suitable; // If target is a semver, find a suitable version if (semver.validRange(target)) { suitable = semver.maxSatisfying(versions, target, true); if (suitable) { return suitable; } } // If target is '*' check if there's a cached '_wildcard' if (target === '*') { return mout.array.find(versions, function (version) { return version === '_wildcard'; }); } // Otherwise check if there's an exact match return mout.array.find(versions, function (version) { return version === target; }); }) .then(function (version) { var canonicalDir; if (!version) { return []; } // Resolve with canonical dir and package meta canonicalDir = path.join(dir, encodeURIComponent(version)); return that._readPkgMeta(canonicalDir) .then(function (pkgMeta) { return [canonicalDir, pkgMeta]; }, function () { // If there was an error, invalidate the in-memory cache, // delete the cached package and try again that._cache.del(sourceId); return Q.nfcall(rimraf, canonicalDir) .then(function () { return that.retrieve(source, target); }); }); }); }; ResolveCache.prototype.store = function (canonicalDir, pkgMeta) { var sourceId; var release; var dir; var pkgLock; var promise; var that = this; promise = pkgMeta ? Q.resolve(pkgMeta) : this._readPkgMeta(canonicalDir); return promise .then(function (pkgMeta) { sourceId = md5(pkgMeta._source); release = that._getPkgRelease(pkgMeta); dir = path.join(that._dir, sourceId, release); pkgLock = path.join(that._lockDir, sourceId + '-' + release + '.lock'); // Check if destination directory exists to prevent issuing lock at all times return Q.nfcall(fs.stat, dir) .fail(function (err) { var lockParams = { wait: 250, retries: 25, stale: 60000 }; return Q.nfcall(lockFile.lock, pkgLock, lockParams).then(function () { // Ensure other process didn't start copying files before lock was created return Q.nfcall(fs.stat, dir) .fail(function (err) { // If stat fails, it is expected to return ENOENT if (err.code !== 'ENOENT') { throw err; } // Create missing directory and copy files there return Q.nfcall(mkdirp, path.dirname(dir)).then(function () { return Q.nfcall(fs.rename, canonicalDir, dir) .fail(function (err) { // If error is EXDEV it means that we are trying to rename // across different drives, so we copy and remove it instead if (err.code !== 'EXDEV') { throw err; } return copy.copyDir(canonicalDir, dir); }); }); }); }).finally(function () { lockFile.unlockSync(pkgLock); }); }).finally(function () { // Ensure no tmp dir is left on disk. return Q.nfcall(rimraf, canonicalDir); }); }) .then(function () { var versions = that._cache.get(sourceId); // Add it to the in memory cache // and sort the versions afterwards if (versions && versions.indexOf(release) === -1) { versions.push(release); that._sortVersions(versions); } // Resolve with the final location return dir; }); }; ResolveCache.prototype.eliminate = function (pkgMeta) { var sourceId = md5(pkgMeta._source); var release = this._getPkgRelease(pkgMeta); var dir = path.join(this._dir, sourceId, release); var that = this; return Q.nfcall(rimraf, dir) .then(function () { var versions = that._cache.get(sourceId) || []; mout.array.remove(versions, release); // If this was the last package in the cache, // delete the parent folder (source) // For extra security, check against the file system // if this was really the last package if (!versions.length) { that._cache.del(sourceId); return that._getVersions(sourceId) .spread(function (versions) { if (!versions.length) { // Do not keep in-memory cache if it's completely // empty that._cache.del(sourceId); return Q.nfcall(rimraf, path.dirname(dir)); } }); } }); }; ResolveCache.prototype.clear = function () { return Q.nfcall(rimraf, this._dir) .then(function () { return Q.nfcall(fs.mkdir, this._dir); }.bind(this)) .then(function () { this._cache.reset(); }.bind(this)); }; ResolveCache.prototype.reset = function () { this._cache.reset(); return this; }; ResolveCache.prototype.versions = function (source) { var sourceId = md5(source); return this._getVersions(sourceId) .spread(function (versions) { return versions.filter(function (version) { return semver.valid(version); }); }); }; ResolveCache.prototype.list = function () { var promises; var dirs = []; var that = this; // Get the list of directories return Q.nfcall(fs.readdir, this._dir) .then(function (sourceIds) { promises = sourceIds.map(function (sourceId) { return Q.nfcall(fs.readdir, path.join(that._dir, sourceId)) .then(function (versions) { versions.forEach(function (version) { var dir = path.join(that._dir, sourceId, version); dirs.push(dir); }); }, function (err) { // Ignore lurking files, e.g.: .DS_Store if the user // has navigated throughout the cache if (err.code === 'ENOTDIR' && err.path) { return Q.nfcall(rimraf, err.path); } throw err; }); }); return Q.all(promises); }) // Read every package meta .then(function () { promises = dirs.map(function (dir) { return that._readPkgMeta(dir) .then(function (pkgMeta) { return { canonicalDir: dir, pkgMeta: pkgMeta }; }, function () { // If it fails to read, invalidate the in memory // cache for the source and delete the entry directory var sourceId = path.basename(path.dirname(dir)); that._cache.del(sourceId); return Q.nfcall(rimraf, dir); }); }); return Q.all(promises); }) // Sort by name ASC & release ASC .then(function (entries) { // Ignore falsy entries due to errors reading // package metas entries = entries.filter(function (entry) { return !!entry; }); return entries.sort(function (entry1, entry2) { var pkgMeta1 = entry1.pkgMeta; var pkgMeta2 = entry2.pkgMeta; var comp = pkgMeta1.name.localeCompare(pkgMeta2.name); // Sort by name if (comp) { return comp; } // Sort by version if (pkgMeta1.version && pkgMeta2.version) { return semver.compare(pkgMeta1.version, pkgMeta2.version); } if (pkgMeta1.version) { return -1; } if (pkgMeta2.version) { return 1; } // Sort by target return pkgMeta1._target.localeCompare(pkgMeta2._target); }); }); }; // ------------------------ ResolveCache.clearRuntimeCache = function () { // Note that _cache refers to the static _cache variable // that holds other caches per dir! // Do not confuse it with the instance cache // Clear cache of each directory this._cache.forEach(function (cache) { cache.reset(); }); // Clear root cache this._cache.reset(); }; // ------------------------ ResolveCache.prototype._getPkgRelease = function (pkgMeta) { var release = pkgMeta.version || (pkgMeta._target === '*' ? '_wildcard' : pkgMeta._target); // Encode some dangerous chars such as / and \ release = encodeURIComponent(release); return release; }; ResolveCache.prototype._readPkgMeta = function (dir) { var filename = path.join(dir, '.bower.json'); return readJson(filename) .spread(function (json) { return json; }); }; ResolveCache.prototype._getVersions = function (sourceId) { var dir; var versions = this._cache.get(sourceId); var that = this; if (versions) { return Q.resolve([versions, true]); } dir = path.join(this._dir, sourceId); return Q.nfcall(fs.readdir, dir) .then(function (versions) { // Sort and cache in memory that._sortVersions(versions); versions = versions.map(decodeURIComponent); that._cache.set(sourceId, versions); return [versions, false]; }, function (err) { // If the directory does not exists, resolve // as an empty array if (err.code === 'ENOENT') { versions = []; that._cache.set(sourceId, versions); return [versions, false]; } throw err; }); }; ResolveCache.prototype._sortVersions = function (versions) { // Sort DESC versions.sort(function (version1, version2) { var validSemver1 = semver.valid(version1); var validSemver2 = semver.valid(version2); // If both are semvers, compare them if (validSemver1 && validSemver2) { return semver.rcompare(version1, version2); } // If one of them are semvers, give higher priority if (validSemver1) { return -1; } if (validSemver2) { return 1; } // Otherwise they are considered equal return 0; }); }; // ------------------------ ResolveCache._cache = new LRU({ max: 5, maxAge: 60 * 30 * 1000 // 30 minutes }); module.exports = ResolveCache;
SrikumarChari/geminiui
node_modules/bower/lib/core/ResolveCache.js
JavaScript
mit
12,235
/** * React v0.13.3 */ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule React */ /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ 'use strict'; var EventPluginUtils = _dereq_(19); var ReactChildren = _dereq_(32); var ReactComponent = _dereq_(34); var ReactClass = _dereq_(33); var ReactContext = _dereq_(38); var ReactCurrentOwner = _dereq_(39); var ReactElement = _dereq_(57); var ReactElementValidator = _dereq_(58); var ReactDOM = _dereq_(40); var ReactDOMTextComponent = _dereq_(51); var ReactDefaultInjection = _dereq_(54); var ReactInstanceHandles = _dereq_(66); var ReactMount = _dereq_(70); var ReactPerf = _dereq_(75); var ReactPropTypes = _dereq_(78); var ReactReconciler = _dereq_(81); var ReactServerRendering = _dereq_(84); var assign = _dereq_(27); var findDOMNode = _dereq_(117); var onlyChild = _dereq_(144); ReactDefaultInjection.inject(); var createElement = ReactElement.createElement; var createFactory = ReactElement.createFactory; var cloneElement = ReactElement.cloneElement; if ("production" !== "development") { createElement = ReactElementValidator.createElement; createFactory = ReactElementValidator.createFactory; cloneElement = ReactElementValidator.cloneElement; } var render = ReactPerf.measure('React', 'render', ReactMount.render); var React = { Children: { map: ReactChildren.map, forEach: ReactChildren.forEach, count: ReactChildren.count, only: onlyChild }, Component: ReactComponent, DOM: ReactDOM, PropTypes: ReactPropTypes, initializeTouchEvents: function(shouldUseTouch) { EventPluginUtils.useTouchEvents = shouldUseTouch; }, createClass: ReactClass.createClass, createElement: createElement, cloneElement: cloneElement, createFactory: createFactory, createMixin: function(mixin) { // Currently a noop. Will be used to validate and trace mixins. return mixin; }, constructAndRenderComponent: ReactMount.constructAndRenderComponent, constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID, findDOMNode: findDOMNode, render: render, renderToString: ReactServerRendering.renderToString, renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup, unmountComponentAtNode: ReactMount.unmountComponentAtNode, isValidElement: ReactElement.isValidElement, withContext: ReactContext.withContext, // Hook for JSX spread, don't use this for anything else. __spread: assign }; // Inject the runtime into a devtools global hook regardless of browser. // Allows for debugging when the hook is injected on the page. if ( typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ CurrentOwner: ReactCurrentOwner, InstanceHandles: ReactInstanceHandles, Mount: ReactMount, Reconciler: ReactReconciler, TextComponent: ReactDOMTextComponent }); } if ("production" !== "development") { var ExecutionEnvironment = _dereq_(21); if (ExecutionEnvironment.canUseDOM && window.top === window.self) { // If we're in Chrome, look for the devtools marker and provide a download // link if not installed. if (navigator.userAgent.indexOf('Chrome') > -1) { if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { console.debug( 'Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools' ); } } var expectedFeatures = [ // shims Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim, // shams Object.create, Object.freeze ]; for (var i = 0; i < expectedFeatures.length; i++) { if (!expectedFeatures[i]) { console.error( 'One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills' ); break; } } } } React.version = '0.13.3'; module.exports = React; },{"117":117,"144":144,"19":19,"21":21,"27":27,"32":32,"33":33,"34":34,"38":38,"39":39,"40":40,"51":51,"54":54,"57":57,"58":58,"66":66,"70":70,"75":75,"78":78,"81":81,"84":84}],2:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule AutoFocusMixin * @typechecks static-only */ 'use strict'; var focusNode = _dereq_(119); var AutoFocusMixin = { componentDidMount: function() { if (this.props.autoFocus) { focusNode(this.getDOMNode()); } } }; module.exports = AutoFocusMixin; },{"119":119}],3:[function(_dereq_,module,exports){ /** * Copyright 2013-2015 Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule BeforeInputEventPlugin * @typechecks static-only */ 'use strict'; var EventConstants = _dereq_(15); var EventPropagators = _dereq_(20); var ExecutionEnvironment = _dereq_(21); var FallbackCompositionState = _dereq_(22); var SyntheticCompositionEvent = _dereq_(93); var SyntheticInputEvent = _dereq_(97); var keyOf = _dereq_(141); var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space var START_KEYCODE = 229; var canUseCompositionEvent = ( ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window ); var documentMode = null; if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { documentMode = document.documentMode; } // Webkit offers a very useful `textInput` event that can be used to // directly represent `beforeInput`. The IE `textinput` event is not as // useful, so we don't use it. var canUseTextInputEvent = ( ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto() ); // In IE9+, we have access to composition events, but the data supplied // by the native compositionend event may be incorrect. Japanese ideographic // spaces, for instance (\u3000) are not recorded correctly. var useFallbackCompositionData = ( ExecutionEnvironment.canUseDOM && ( (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11) ) ); /** * Opera <= 12 includes TextEvent in window, but does not fire * text input events. Rely on keypress instead. */ function isPresto() { var opera = window.opera; return ( typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12 ); } var SPACEBAR_CODE = 32; var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); var topLevelTypes = EventConstants.topLevelTypes; // Events and their corresponding property names. var eventTypes = { beforeInput: { phasedRegistrationNames: { bubbled: keyOf({onBeforeInput: null}), captured: keyOf({onBeforeInputCapture: null}) }, dependencies: [ topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste ] }, compositionEnd: { phasedRegistrationNames: { bubbled: keyOf({onCompositionEnd: null}), captured: keyOf({onCompositionEndCapture: null}) }, dependencies: [ topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown ] }, compositionStart: { phasedRegistrationNames: { bubbled: keyOf({onCompositionStart: null}), captured: keyOf({onCompositionStartCapture: null}) }, dependencies: [ topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown ] }, compositionUpdate: { phasedRegistrationNames: { bubbled: keyOf({onCompositionUpdate: null}), captured: keyOf({onCompositionUpdateCapture: null}) }, dependencies: [ topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown ] } }; // Track whether we've ever handled a keypress on the space key. var hasSpaceKeypress = false; /** * Return whether a native keypress event is assumed to be a command. * This is required because Firefox fires `keypress` events for key commands * (cut, copy, select-all, etc.) even though no character is inserted. */ function isKeypressCommand(nativeEvent) { return ( (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && // ctrlKey && altKey is equivalent to AltGr, and is not a command. !(nativeEvent.ctrlKey && nativeEvent.altKey) ); } /** * Translate native top level events into event types. * * @param {string} topLevelType * @return {object} */ function getCompositionEventType(topLevelType) { switch (topLevelType) { case topLevelTypes.topCompositionStart: return eventTypes.compositionStart; case topLevelTypes.topCompositionEnd: return eventTypes.compositionEnd; case topLevelTypes.topCompositionUpdate: return eventTypes.compositionUpdate; } } /** * Does our fallback best-guess model think this event signifies that * composition has begun? * * @param {string} topLevelType * @param {object} nativeEvent * @return {boolean} */ function isFallbackCompositionStart(topLevelType, nativeEvent) { return ( topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE ); } /** * Does our fallback mode think that this event is the end of composition? * * @param {string} topLevelType * @param {object} nativeEvent * @return {boolean} */ function isFallbackCompositionEnd(topLevelType, nativeEvent) { switch (topLevelType) { case topLevelTypes.topKeyUp: // Command keys insert or clear IME input. return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1); case topLevelTypes.topKeyDown: // Expect IME keyCode on each keydown. If we get any other // code we must have exited earlier. return (nativeEvent.keyCode !== START_KEYCODE); case topLevelTypes.topKeyPress: case topLevelTypes.topMouseDown: case topLevelTypes.topBlur: // Events are not possible without cancelling IME. return true; default: return false; } } /** * Google Input Tools provides composition data via a CustomEvent, * with the `data` property populated in the `detail` object. If this * is available on the event object, use it. If not, this is a plain * composition event and we have nothing special to extract. * * @param {object} nativeEvent * @return {?string} */ function getDataFromCustomEvent(nativeEvent) { var detail = nativeEvent.detail; if (typeof detail === 'object' && 'data' in detail) { return detail.data; } return null; } // Track the current IME composition fallback object, if any. var currentComposition = null; /** * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {?object} A SyntheticCompositionEvent. */ function extractCompositionEvent( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent ) { var eventType; var fallbackData; if (canUseCompositionEvent) { eventType = getCompositionEventType(topLevelType); } else if (!currentComposition) { if (isFallbackCompositionStart(topLevelType, nativeEvent)) { eventType = eventTypes.compositionStart; } } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { eventType = eventTypes.compositionEnd; } if (!eventType) { return null; } if (useFallbackCompositionData) { // The current composition is stored statically and must not be // overwritten while composition continues. if (!currentComposition && eventType === eventTypes.compositionStart) { currentComposition = FallbackCompositionState.getPooled(topLevelTarget); } else if (eventType === eventTypes.compositionEnd) { if (currentComposition) { fallbackData = currentComposition.getData(); } } } var event = SyntheticCompositionEvent.getPooled( eventType, topLevelTargetID, nativeEvent ); if (fallbackData) { // Inject data generated from fallback path into the synthetic event. // This matches the property of native CompositionEventInterface. event.data = fallbackData; } else { var customData = getDataFromCustomEvent(nativeEvent); if (customData !== null) { event.data = customData; } } EventPropagators.accumulateTwoPhaseDispatches(event); return event; } /** * @param {string} topLevelType Record from `EventConstants`. * @param {object} nativeEvent Native browser event. * @return {?string} The string corresponding to this `beforeInput` event. */ function getNativeBeforeInputChars(topLevelType, nativeEvent) { switch (topLevelType) { case topLevelTypes.topCompositionEnd: return getDataFromCustomEvent(nativeEvent); case topLevelTypes.topKeyPress: /** * If native `textInput` events are available, our goal is to make * use of them. However, there is a special case: the spacebar key. * In Webkit, preventing default on a spacebar `textInput` event * cancels character insertion, but it *also* causes the browser * to fall back to its default spacebar behavior of scrolling the * page. * * Tracking at: * https://code.google.com/p/chromium/issues/detail?id=355103 * * To avoid this issue, use the keypress event as if no `textInput` * event is available. */ var which = nativeEvent.which; if (which !== SPACEBAR_CODE) { return null; } hasSpaceKeypress = true; return SPACEBAR_CHAR; case topLevelTypes.topTextInput: // Record the characters to be added to the DOM. var chars = nativeEvent.data; // If it's a spacebar character, assume that we have already handled // it at the keypress level and bail immediately. Android Chrome // doesn't give us keycodes, so we need to blacklist it. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { return null; } return chars; default: // For other native event types, do nothing. return null; } } /** * For browsers that do not provide the `textInput` event, extract the * appropriate string to use for SyntheticInputEvent. * * @param {string} topLevelType Record from `EventConstants`. * @param {object} nativeEvent Native browser event. * @return {?string} The fallback string for this `beforeInput` event. */ function getFallbackBeforeInputChars(topLevelType, nativeEvent) { // If we are currently composing (IME) and using a fallback to do so, // try to extract the composed characters from the fallback object. if (currentComposition) { if ( topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent) ) { var chars = currentComposition.getData(); FallbackCompositionState.release(currentComposition); currentComposition = null; return chars; } return null; } switch (topLevelType) { case topLevelTypes.topPaste: // If a paste event occurs after a keypress, throw out the input // chars. Paste events should not lead to BeforeInput events. return null; case topLevelTypes.topKeyPress: /** * As of v27, Firefox may fire keypress events even when no character * will be inserted. A few possibilities: * * - `which` is `0`. Arrow keys, Esc key, etc. * * - `which` is the pressed key code, but no char is available. * Ex: 'AltGr + d` in Polish. There is no modified character for * this key combination and no character is inserted into the * document, but FF fires the keypress for char code `100` anyway. * No `input` event will occur. * * - `which` is the pressed key code, but a command combination is * being used. Ex: `Cmd+C`. No character is inserted, and no * `input` event will occur. */ if (nativeEvent.which && !isKeypressCommand(nativeEvent)) { return String.fromCharCode(nativeEvent.which); } return null; case topLevelTypes.topCompositionEnd: return useFallbackCompositionData ? null : nativeEvent.data; default: return null; } } /** * Extract a SyntheticInputEvent for `beforeInput`, based on either native * `textInput` or fallback behavior. * * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {?object} A SyntheticInputEvent. */ function extractBeforeInputEvent( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent ) { var chars; if (canUseTextInputEvent) { chars = getNativeBeforeInputChars(topLevelType, nativeEvent); } else { chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); } // If no characters are being inserted, no BeforeInput event should // be fired. if (!chars) { return null; } var event = SyntheticInputEvent.getPooled( eventTypes.beforeInput, topLevelTargetID, nativeEvent ); event.data = chars; EventPropagators.accumulateTwoPhaseDispatches(event); return event; } /** * Create an `onBeforeInput` event to match * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. * * This event plugin is based on the native `textInput` event * available in Chrome, Safari, Opera, and IE. This event fires after * `onKeyPress` and `onCompositionEnd`, but before `onInput`. * * `beforeInput` is spec'd but not implemented in any browsers, and * the `input` event does not provide any useful information about what has * actually been added, contrary to the spec. Thus, `textInput` is the best * available event to identify the characters that have actually been inserted * into the target node. * * This plugin is also responsible for emitting `composition` events, thus * allowing us to share composition fallback code for both `beforeInput` and * `composition` event types. */ var BeforeInputEventPlugin = { eventTypes: eventTypes, /** * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @see {EventPluginHub.extractEvents} */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent ) { return [ extractCompositionEvent( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent ), extractBeforeInputEvent( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent ) ]; } }; module.exports = BeforeInputEventPlugin; },{"141":141,"15":15,"20":20,"21":21,"22":22,"93":93,"97":97}],4:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule CSSProperty */ 'use strict'; /** * CSS properties which accept numbers but are not in units of "px". */ var isUnitlessNumber = { boxFlex: true, boxFlexGroup: true, columnCount: true, flex: true, flexGrow: true, flexPositive: true, flexShrink: true, flexNegative: true, fontWeight: true, lineClamp: true, lineHeight: true, opacity: true, order: true, orphans: true, widows: true, zIndex: true, zoom: true, // SVG-related properties fillOpacity: true, strokeDashoffset: true, strokeOpacity: true, strokeWidth: true }; /** * @param {string} prefix vendor-specific prefix, eg: Webkit * @param {string} key style name, eg: transitionDuration * @return {string} style name prefixed with `prefix`, properly camelCased, eg: * WebkitTransitionDuration */ function prefixKey(prefix, key) { return prefix + key.charAt(0).toUpperCase() + key.substring(1); } /** * Support style names that may come passed in prefixed by adding permutations * of vendor prefixes. */ var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an // infinite loop, because it iterates over the newly added props too. Object.keys(isUnitlessNumber).forEach(function(prop) { prefixes.forEach(function(prefix) { isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; }); }); /** * Most style properties can be unset by doing .style[prop] = '' but IE8 * doesn't like doing that with shorthand properties so for the properties that * IE8 breaks on, which are listed here, we instead unset each of the * individual properties. See http://bugs.jquery.com/ticket/12385. * The 4-value 'clock' properties like margin, padding, border-width seem to * behave without any problems. Curiously, list-style works too without any * special prodding. */ var shorthandPropertyExpansions = { background: { backgroundImage: true, backgroundPosition: true, backgroundRepeat: true, backgroundColor: true }, border: { borderWidth: true, borderStyle: true, borderColor: true }, borderBottom: { borderBottomWidth: true, borderBottomStyle: true, borderBottomColor: true }, borderLeft: { borderLeftWidth: true, borderLeftStyle: true, borderLeftColor: true }, borderRight: { borderRightWidth: true, borderRightStyle: true, borderRightColor: true }, borderTop: { borderTopWidth: true, borderTopStyle: true, borderTopColor: true }, font: { fontStyle: true, fontVariant: true, fontWeight: true, fontSize: true, lineHeight: true, fontFamily: true } }; var CSSProperty = { isUnitlessNumber: isUnitlessNumber, shorthandPropertyExpansions: shorthandPropertyExpansions }; module.exports = CSSProperty; },{}],5:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule CSSPropertyOperations * @typechecks static-only */ 'use strict'; var CSSProperty = _dereq_(4); var ExecutionEnvironment = _dereq_(21); var camelizeStyleName = _dereq_(108); var dangerousStyleValue = _dereq_(113); var hyphenateStyleName = _dereq_(133); var memoizeStringOnly = _dereq_(143); var warning = _dereq_(154); var processStyleName = memoizeStringOnly(function(styleName) { return hyphenateStyleName(styleName); }); var styleFloatAccessor = 'cssFloat'; if (ExecutionEnvironment.canUseDOM) { // IE8 only supports accessing cssFloat (standard) as styleFloat if (document.documentElement.style.cssFloat === undefined) { styleFloatAccessor = 'styleFloat'; } } if ("production" !== "development") { // 'msTransform' is correct, but the other prefixes should be capitalized var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/; // style values shouldn't contain a semicolon var badStyleValueWithSemicolonPattern = /;\s*$/; var warnedStyleNames = {}; var warnedStyleValues = {}; var warnHyphenatedStyleName = function(name) { if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { return; } warnedStyleNames[name] = true; ("production" !== "development" ? warning( false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name) ) : null); }; var warnBadVendoredStyleName = function(name) { if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { return; } warnedStyleNames[name] = true; ("production" !== "development" ? warning( false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1) ) : null); }; var warnStyleValueWithSemicolon = function(name, value) { if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { return; } warnedStyleValues[value] = true; ("production" !== "development" ? warning( false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '') ) : null); }; /** * @param {string} name * @param {*} value */ var warnValidStyle = function(name, value) { if (name.indexOf('-') > -1) { warnHyphenatedStyleName(name); } else if (badVendoredStyleNamePattern.test(name)) { warnBadVendoredStyleName(name); } else if (badStyleValueWithSemicolonPattern.test(value)) { warnStyleValueWithSemicolon(name, value); } }; } /** * Operations for dealing with CSS properties. */ var CSSPropertyOperations = { /** * Serializes a mapping of style properties for use as inline styles: * * > createMarkupForStyles({width: '200px', height: 0}) * "width:200px;height:0;" * * Undefined values are ignored so that declarative programming is easier. * The result should be HTML-escaped before insertion into the DOM. * * @param {object} styles * @return {?string} */ createMarkupForStyles: function(styles) { var serialized = ''; for (var styleName in styles) { if (!styles.hasOwnProperty(styleName)) { continue; } var styleValue = styles[styleName]; if ("production" !== "development") { warnValidStyle(styleName, styleValue); } if (styleValue != null) { serialized += processStyleName(styleName) + ':'; serialized += dangerousStyleValue(styleName, styleValue) + ';'; } } return serialized || null; }, /** * Sets the value for multiple styles on a node. If a value is specified as * '' (empty string), the corresponding style property will be unset. * * @param {DOMElement} node * @param {object} styles */ setValueForStyles: function(node, styles) { var style = node.style; for (var styleName in styles) { if (!styles.hasOwnProperty(styleName)) { continue; } if ("production" !== "development") { warnValidStyle(styleName, styles[styleName]); } var styleValue = dangerousStyleValue(styleName, styles[styleName]); if (styleName === 'float') { styleName = styleFloatAccessor; } if (styleValue) { style[styleName] = styleValue; } else { var expansion = CSSProperty.shorthandPropertyExpansions[styleName]; if (expansion) { // Shorthand property that IE8 won't like unsetting, so unset each // component to placate it for (var individualStyleName in expansion) { style[individualStyleName] = ''; } } else { style[styleName] = ''; } } } } }; module.exports = CSSPropertyOperations; },{"108":108,"113":113,"133":133,"143":143,"154":154,"21":21,"4":4}],6:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule CallbackQueue */ 'use strict'; var PooledClass = _dereq_(28); var assign = _dereq_(27); var invariant = _dereq_(135); /** * A specialized pseudo-event module to help keep track of components waiting to * be notified when their DOM representations are available for use. * * This implements `PooledClass`, so you should never need to instantiate this. * Instead, use `CallbackQueue.getPooled()`. * * @class ReactMountReady * @implements PooledClass * @internal */ function CallbackQueue() { this._callbacks = null; this._contexts = null; } assign(CallbackQueue.prototype, { /** * Enqueues a callback to be invoked when `notifyAll` is invoked. * * @param {function} callback Invoked when `notifyAll` is invoked. * @param {?object} context Context to call `callback` with. * @internal */ enqueue: function(callback, context) { this._callbacks = this._callbacks || []; this._contexts = this._contexts || []; this._callbacks.push(callback); this._contexts.push(context); }, /** * Invokes all enqueued callbacks and clears the queue. This is invoked after * the DOM representation of a component has been created or updated. * * @internal */ notifyAll: function() { var callbacks = this._callbacks; var contexts = this._contexts; if (callbacks) { ("production" !== "development" ? invariant( callbacks.length === contexts.length, 'Mismatched list of contexts in callback queue' ) : invariant(callbacks.length === contexts.length)); this._callbacks = null; this._contexts = null; for (var i = 0, l = callbacks.length; i < l; i++) { callbacks[i].call(contexts[i]); } callbacks.length = 0; contexts.length = 0; } }, /** * Resets the internal queue. * * @internal */ reset: function() { this._callbacks = null; this._contexts = null; }, /** * `PooledClass` looks for this. */ destructor: function() { this.reset(); } }); PooledClass.addPoolingTo(CallbackQueue); module.exports = CallbackQueue; },{"135":135,"27":27,"28":28}],7:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ChangeEventPlugin */ 'use strict'; var EventConstants = _dereq_(15); var EventPluginHub = _dereq_(17); var EventPropagators = _dereq_(20); var ExecutionEnvironment = _dereq_(21); var ReactUpdates = _dereq_(87); var SyntheticEvent = _dereq_(95); var isEventSupported = _dereq_(136); var isTextInputElement = _dereq_(138); var keyOf = _dereq_(141); var topLevelTypes = EventConstants.topLevelTypes; var eventTypes = { change: { phasedRegistrationNames: { bubbled: keyOf({onChange: null}), captured: keyOf({onChangeCapture: null}) }, dependencies: [ topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange ] } }; /** * For IE shims */ var activeElement = null; var activeElementID = null; var activeElementValue = null; var activeElementValueProp = null; /** * SECTION: handle `change` event */ function shouldUseChangeEvent(elem) { return ( elem.nodeName === 'SELECT' || (elem.nodeName === 'INPUT' && elem.type === 'file') ); } var doesChangeEventBubble = false; if (ExecutionEnvironment.canUseDOM) { // See `handleChange` comment below doesChangeEventBubble = isEventSupported('change') && ( (!('documentMode' in document) || document.documentMode > 8) ); } function manualDispatchChangeEvent(nativeEvent) { var event = SyntheticEvent.getPooled( eventTypes.change, activeElementID, nativeEvent ); EventPropagators.accumulateTwoPhaseDispatches(event); // If change and propertychange bubbled, we'd just bind to it like all the // other events and have it go through ReactBrowserEventEmitter. Since it // doesn't, we manually listen for the events and so we have to enqueue and // process the abstract event manually. // // Batching is necessary here in order to ensure that all event handlers run // before the next rerender (including event handlers attached to ancestor // elements instead of directly on the input). Without this, controlled // components don't work properly in conjunction with event bubbling because // the component is rerendered and the value reverted before all the event // handlers can run. See https://github.com/facebook/react/issues/708. ReactUpdates.batchedUpdates(runEventInBatch, event); } function runEventInBatch(event) { EventPluginHub.enqueueEvents(event); EventPluginHub.processEventQueue(); } function startWatchingForChangeEventIE8(target, targetID) { activeElement = target; activeElementID = targetID; activeElement.attachEvent('onchange', manualDispatchChangeEvent); } function stopWatchingForChangeEventIE8() { if (!activeElement) { return; } activeElement.detachEvent('onchange', manualDispatchChangeEvent); activeElement = null; activeElementID = null; } function getTargetIDForChangeEvent( topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topChange) { return topLevelTargetID; } } function handleEventsForChangeEventIE8( topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topFocus) { // stopWatching() should be a noop here but we call it just in case we // missed a blur event somehow. stopWatchingForChangeEventIE8(); startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID); } else if (topLevelType === topLevelTypes.topBlur) { stopWatchingForChangeEventIE8(); } } /** * SECTION: handle `input` event */ var isInputEventSupported = false; if (ExecutionEnvironment.canUseDOM) { // IE9 claims to support the input event but fails to trigger it when // deleting text, so we ignore its input events isInputEventSupported = isEventSupported('input') && ( (!('documentMode' in document) || document.documentMode > 9) ); } /** * (For old IE.) Replacement getter/setter for the `value` property that gets * set on the active element. */ var newValueProp = { get: function() { return activeElementValueProp.get.call(this); }, set: function(val) { // Cast to a string so we can do equality checks. activeElementValue = '' + val; activeElementValueProp.set.call(this, val); } }; /** * (For old IE.) Starts tracking propertychange events on the passed-in element * and override the value property so that we can distinguish user events from * value changes in JS. */ function startWatchingForValueChange(target, targetID) { activeElement = target; activeElementID = targetID; activeElementValue = target.value; activeElementValueProp = Object.getOwnPropertyDescriptor( target.constructor.prototype, 'value' ); Object.defineProperty(activeElement, 'value', newValueProp); activeElement.attachEvent('onpropertychange', handlePropertyChange); } /** * (For old IE.) Removes the event listeners from the currently-tracked element, * if any exists. */ function stopWatchingForValueChange() { if (!activeElement) { return; } // delete restores the original property definition delete activeElement.value; activeElement.detachEvent('onpropertychange', handlePropertyChange); activeElement = null; activeElementID = null; activeElementValue = null; activeElementValueProp = null; } /** * (For old IE.) Handles a propertychange event, sending a `change` event if * the value of the active element has changed. */ function handlePropertyChange(nativeEvent) { if (nativeEvent.propertyName !== 'value') { return; } var value = nativeEvent.srcElement.value; if (value === activeElementValue) { return; } activeElementValue = value; manualDispatchChangeEvent(nativeEvent); } /** * If a `change` event should be fired, returns the target's ID. */ function getTargetIDForInputEvent( topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topInput) { // In modern browsers (i.e., not IE8 or IE9), the input event is exactly // what we want so fall through here and trigger an abstract event return topLevelTargetID; } } // For IE8 and IE9. function handleEventsForInputEventIE( topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topFocus) { // In IE8, we can capture almost all .value changes by adding a // propertychange handler and looking for events with propertyName // equal to 'value' // In IE9, propertychange fires for most input events but is buggy and // doesn't fire when text is deleted, but conveniently, selectionchange // appears to fire in all of the remaining cases so we catch those and // forward the event if the value has changed // In either case, we don't want to call the event handler if the value // is changed from JS so we redefine a setter for `.value` that updates // our activeElementValue variable, allowing us to ignore those changes // // stopWatching() should be a noop here but we call it just in case we // missed a blur event somehow. stopWatchingForValueChange(); startWatchingForValueChange(topLevelTarget, topLevelTargetID); } else if (topLevelType === topLevelTypes.topBlur) { stopWatchingForValueChange(); } } // For IE8 and IE9. function getTargetIDForInputEventIE( topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) { // On the selectionchange event, the target is just document which isn't // helpful for us so just check activeElement instead. // // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire // propertychange on the first input event after setting `value` from a // script and fires only keydown, keypress, keyup. Catching keyup usually // gets it and catching keydown lets us fire an event for the first // keystroke if user does a key repeat (it'll be a little delayed: right // before the second keystroke). Other input methods (e.g., paste) seem to // fire selectionchange normally. if (activeElement && activeElement.value !== activeElementValue) { activeElementValue = activeElement.value; return activeElementID; } } } /** * SECTION: handle `click` event */ function shouldUseClickEvent(elem) { // Use the `click` event to detect changes to checkbox and radio inputs. // This approach works across all browsers, whereas `change` does not fire // until `blur` in IE8. return ( elem.nodeName === 'INPUT' && (elem.type === 'checkbox' || elem.type === 'radio') ); } function getTargetIDForClickEvent( topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topClick) { return topLevelTargetID; } } /** * This plugin creates an `onChange` event that normalizes change events * across form elements. This event fires at a time when it's possible to * change the element's value without seeing a flicker. * * Supported elements are: * - input (see `isTextInputElement`) * - textarea * - select */ var ChangeEventPlugin = { eventTypes: eventTypes, /** * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @see {EventPluginHub.extractEvents} */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { var getTargetIDFunc, handleEventFunc; if (shouldUseChangeEvent(topLevelTarget)) { if (doesChangeEventBubble) { getTargetIDFunc = getTargetIDForChangeEvent; } else { handleEventFunc = handleEventsForChangeEventIE8; } } else if (isTextInputElement(topLevelTarget)) { if (isInputEventSupported) { getTargetIDFunc = getTargetIDForInputEvent; } else { getTargetIDFunc = getTargetIDForInputEventIE; handleEventFunc = handleEventsForInputEventIE; } } else if (shouldUseClickEvent(topLevelTarget)) { getTargetIDFunc = getTargetIDForClickEvent; } if (getTargetIDFunc) { var targetID = getTargetIDFunc( topLevelType, topLevelTarget, topLevelTargetID ); if (targetID) { var event = SyntheticEvent.getPooled( eventTypes.change, targetID, nativeEvent ); EventPropagators.accumulateTwoPhaseDispatches(event); return event; } } if (handleEventFunc) { handleEventFunc( topLevelType, topLevelTarget, topLevelTargetID ); } } }; module.exports = ChangeEventPlugin; },{"136":136,"138":138,"141":141,"15":15,"17":17,"20":20,"21":21,"87":87,"95":95}],8:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ClientReactRootIndex * @typechecks */ 'use strict'; var nextReactRootIndex = 0; var ClientReactRootIndex = { createReactRootIndex: function() { return nextReactRootIndex++; } }; module.exports = ClientReactRootIndex; },{}],9:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DOMChildrenOperations * @typechecks static-only */ 'use strict'; var Danger = _dereq_(12); var ReactMultiChildUpdateTypes = _dereq_(72); var setTextContent = _dereq_(149); var invariant = _dereq_(135); /** * Inserts `childNode` as a child of `parentNode` at the `index`. * * @param {DOMElement} parentNode Parent node in which to insert. * @param {DOMElement} childNode Child node to insert. * @param {number} index Index at which to insert the child. * @internal */ function insertChildAt(parentNode, childNode, index) { // By exploiting arrays returning `undefined` for an undefined index, we can // rely exclusively on `insertBefore(node, null)` instead of also using // `appendChild(node)`. However, using `undefined` is not allowed by all // browsers so we must replace it with `null`. parentNode.insertBefore( childNode, parentNode.childNodes[index] || null ); } /** * Operations for updating with DOM children. */ var DOMChildrenOperations = { dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup, updateTextContent: setTextContent, /** * Updates a component's children by processing a series of updates. The * update configurations are each expected to have a `parentNode` property. * * @param {array<object>} updates List of update configurations. * @param {array<string>} markupList List of markup strings. * @internal */ processUpdates: function(updates, markupList) { var update; // Mapping from parent IDs to initial child orderings. var initialChildren = null; // List of children that will be moved or removed. var updatedChildren = null; for (var i = 0; i < updates.length; i++) { update = updates[i]; if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) { var updatedIndex = update.fromIndex; var updatedChild = update.parentNode.childNodes[updatedIndex]; var parentID = update.parentID; ("production" !== "development" ? invariant( updatedChild, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID ) : invariant(updatedChild)); initialChildren = initialChildren || {}; initialChildren[parentID] = initialChildren[parentID] || []; initialChildren[parentID][updatedIndex] = updatedChild; updatedChildren = updatedChildren || []; updatedChildren.push(updatedChild); } } var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList); // Remove updated children first so that `toIndex` is consistent. if (updatedChildren) { for (var j = 0; j < updatedChildren.length; j++) { updatedChildren[j].parentNode.removeChild(updatedChildren[j]); } } for (var k = 0; k < updates.length; k++) { update = updates[k]; switch (update.type) { case ReactMultiChildUpdateTypes.INSERT_MARKUP: insertChildAt( update.parentNode, renderedMarkup[update.markupIndex], update.toIndex ); break; case ReactMultiChildUpdateTypes.MOVE_EXISTING: insertChildAt( update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex ); break; case ReactMultiChildUpdateTypes.TEXT_CONTENT: setTextContent( update.parentNode, update.textContent ); break; case ReactMultiChildUpdateTypes.REMOVE_NODE: // Already removed by the for-loop above. break; } } } }; module.exports = DOMChildrenOperations; },{"12":12,"135":135,"149":149,"72":72}],10:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DOMProperty * @typechecks static-only */ /*jslint bitwise: true */ 'use strict'; var invariant = _dereq_(135); function checkMask(value, bitmask) { return (value & bitmask) === bitmask; } var DOMPropertyInjection = { /** * Mapping from normalized, camelcased property names to a configuration that * specifies how the associated DOM property should be accessed or rendered. */ MUST_USE_ATTRIBUTE: 0x1, MUST_USE_PROPERTY: 0x2, HAS_SIDE_EFFECTS: 0x4, HAS_BOOLEAN_VALUE: 0x8, HAS_NUMERIC_VALUE: 0x10, HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10, HAS_OVERLOADED_BOOLEAN_VALUE: 0x40, /** * Inject some specialized knowledge about the DOM. This takes a config object * with the following properties: * * isCustomAttribute: function that given an attribute name will return true * if it can be inserted into the DOM verbatim. Useful for data-* or aria-* * attributes where it's impossible to enumerate all of the possible * attribute names, * * Properties: object mapping DOM property name to one of the * DOMPropertyInjection constants or null. If your attribute isn't in here, * it won't get written to the DOM. * * DOMAttributeNames: object mapping React attribute name to the DOM * attribute name. Attribute names not specified use the **lowercase** * normalized name. * * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. * Property names not specified use the normalized name. * * DOMMutationMethods: Properties that require special mutation methods. If * `value` is undefined, the mutation method should unset the property. * * @param {object} domPropertyConfig the config as described above. */ injectDOMPropertyConfig: function(domPropertyConfig) { var Properties = domPropertyConfig.Properties || {}; var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; if (domPropertyConfig.isCustomAttribute) { DOMProperty._isCustomAttributeFunctions.push( domPropertyConfig.isCustomAttribute ); } for (var propName in Properties) { ("production" !== "development" ? invariant( !DOMProperty.isStandardName.hasOwnProperty(propName), 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName ) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName))); DOMProperty.isStandardName[propName] = true; var lowerCased = propName.toLowerCase(); DOMProperty.getPossibleStandardName[lowerCased] = propName; if (DOMAttributeNames.hasOwnProperty(propName)) { var attributeName = DOMAttributeNames[propName]; DOMProperty.getPossibleStandardName[attributeName] = propName; DOMProperty.getAttributeName[propName] = attributeName; } else { DOMProperty.getAttributeName[propName] = lowerCased; } DOMProperty.getPropertyName[propName] = DOMPropertyNames.hasOwnProperty(propName) ? DOMPropertyNames[propName] : propName; if (DOMMutationMethods.hasOwnProperty(propName)) { DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName]; } else { DOMProperty.getMutationMethod[propName] = null; } var propConfig = Properties[propName]; DOMProperty.mustUseAttribute[propName] = checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE); DOMProperty.mustUseProperty[propName] = checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY); DOMProperty.hasSideEffects[propName] = checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS); DOMProperty.hasBooleanValue[propName] = checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE); DOMProperty.hasNumericValue[propName] = checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE); DOMProperty.hasPositiveNumericValue[propName] = checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE); DOMProperty.hasOverloadedBooleanValue[propName] = checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE); ("production" !== "development" ? invariant( !DOMProperty.mustUseAttribute[propName] || !DOMProperty.mustUseProperty[propName], 'DOMProperty: Cannot require using both attribute and property: %s', propName ) : invariant(!DOMProperty.mustUseAttribute[propName] || !DOMProperty.mustUseProperty[propName])); ("production" !== "development" ? invariant( DOMProperty.mustUseProperty[propName] || !DOMProperty.hasSideEffects[propName], 'DOMProperty: Properties that have side effects must use property: %s', propName ) : invariant(DOMProperty.mustUseProperty[propName] || !DOMProperty.hasSideEffects[propName])); ("production" !== "development" ? invariant( !!DOMProperty.hasBooleanValue[propName] + !!DOMProperty.hasNumericValue[propName] + !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName ) : invariant(!!DOMProperty.hasBooleanValue[propName] + !!DOMProperty.hasNumericValue[propName] + !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1)); } } }; var defaultValueCache = {}; /** * DOMProperty exports lookup objects that can be used like functions: * * > DOMProperty.isValid['id'] * true * > DOMProperty.isValid['foobar'] * undefined * * Although this may be confusing, it performs better in general. * * @see http://jsperf.com/key-exists * @see http://jsperf.com/key-missing */ var DOMProperty = { ID_ATTRIBUTE_NAME: 'data-reactid', /** * Checks whether a property name is a standard property. * @type {Object} */ isStandardName: {}, /** * Mapping from lowercase property names to the properly cased version, used * to warn in the case of missing properties. * @type {Object} */ getPossibleStandardName: {}, /** * Mapping from normalized names to attribute names that differ. Attribute * names are used when rendering markup or with `*Attribute()`. * @type {Object} */ getAttributeName: {}, /** * Mapping from normalized names to properties on DOM node instances. * (This includes properties that mutate due to external factors.) * @type {Object} */ getPropertyName: {}, /** * Mapping from normalized names to mutation methods. This will only exist if * mutation cannot be set simply by the property or `setAttribute()`. * @type {Object} */ getMutationMethod: {}, /** * Whether the property must be accessed and mutated as an object property. * @type {Object} */ mustUseAttribute: {}, /** * Whether the property must be accessed and mutated using `*Attribute()`. * (This includes anything that fails `<propName> in <element>`.) * @type {Object} */ mustUseProperty: {}, /** * Whether or not setting a value causes side effects such as triggering * resources to be loaded or text selection changes. We must ensure that * the value is only set if it has changed. * @type {Object} */ hasSideEffects: {}, /** * Whether the property should be removed when set to a falsey value. * @type {Object} */ hasBooleanValue: {}, /** * Whether the property must be numeric or parse as a * numeric and should be removed when set to a falsey value. * @type {Object} */ hasNumericValue: {}, /** * Whether the property must be positive numeric or parse as a positive * numeric and should be removed when set to a falsey value. * @type {Object} */ hasPositiveNumericValue: {}, /** * Whether the property can be used as a flag as well as with a value. Removed * when strictly equal to false; present without a value when strictly equal * to true; present with a value otherwise. * @type {Object} */ hasOverloadedBooleanValue: {}, /** * All of the isCustomAttribute() functions that have been injected. */ _isCustomAttributeFunctions: [], /** * Checks whether a property name is a custom attribute. * @method */ isCustomAttribute: function(attributeName) { for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) { var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i]; if (isCustomAttributeFn(attributeName)) { return true; } } return false; }, /** * Returns the default property value for a DOM property (i.e., not an * attribute). Most default values are '' or false, but not all. Worse yet, * some (in particular, `type`) vary depending on the type of element. * * TODO: Is it better to grab all the possible properties when creating an * element to avoid having to create the same element twice? */ getDefaultValueForProperty: function(nodeName, prop) { var nodeDefaults = defaultValueCache[nodeName]; var testElement; if (!nodeDefaults) { defaultValueCache[nodeName] = nodeDefaults = {}; } if (!(prop in nodeDefaults)) { testElement = document.createElement(nodeName); nodeDefaults[prop] = testElement[prop]; } return nodeDefaults[prop]; }, injection: DOMPropertyInjection }; module.exports = DOMProperty; },{"135":135}],11:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DOMPropertyOperations * @typechecks static-only */ 'use strict'; var DOMProperty = _dereq_(10); var quoteAttributeValueForBrowser = _dereq_(147); var warning = _dereq_(154); function shouldIgnoreValue(name, value) { return value == null || (DOMProperty.hasBooleanValue[name] && !value) || (DOMProperty.hasNumericValue[name] && isNaN(value)) || (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) || (DOMProperty.hasOverloadedBooleanValue[name] && value === false); } if ("production" !== "development") { var reactProps = { children: true, dangerouslySetInnerHTML: true, key: true, ref: true }; var warnedProperties = {}; var warnUnknownProperty = function(name) { if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { return; } warnedProperties[name] = true; var lowerCasedName = name.toLowerCase(); // data-* attributes should be lowercase; suggest the lowercase version var standardName = ( DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null ); // For now, only warn when we have a suggested correction. This prevents // logging too much when using transferPropsTo. ("production" !== "development" ? warning( standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName ) : null); }; } /** * Operations for dealing with DOM properties. */ var DOMPropertyOperations = { /** * Creates markup for the ID property. * * @param {string} id Unescaped ID. * @return {string} Markup string. */ createMarkupForID: function(id) { return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id); }, /** * Creates markup for a property. * * @param {string} name * @param {*} value * @return {?string} Markup string, or null if the property was invalid. */ createMarkupForProperty: function(name, value) { if (DOMProperty.isStandardName.hasOwnProperty(name) && DOMProperty.isStandardName[name]) { if (shouldIgnoreValue(name, value)) { return ''; } var attributeName = DOMProperty.getAttributeName[name]; if (DOMProperty.hasBooleanValue[name] || (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) { return attributeName; } return attributeName + '=' + quoteAttributeValueForBrowser(value); } else if (DOMProperty.isCustomAttribute(name)) { if (value == null) { return ''; } return name + '=' + quoteAttributeValueForBrowser(value); } else if ("production" !== "development") { warnUnknownProperty(name); } return null; }, /** * Sets the value for a property on a node. * * @param {DOMElement} node * @param {string} name * @param {*} value */ setValueForProperty: function(node, name, value) { if (DOMProperty.isStandardName.hasOwnProperty(name) && DOMProperty.isStandardName[name]) { var mutationMethod = DOMProperty.getMutationMethod[name]; if (mutationMethod) { mutationMethod(node, value); } else if (shouldIgnoreValue(name, value)) { this.deleteValueForProperty(node, name); } else if (DOMProperty.mustUseAttribute[name]) { // `setAttribute` with objects becomes only `[object]` in IE8/9, // ('' + value) makes it output the correct toString()-value. node.setAttribute(DOMProperty.getAttributeName[name], '' + value); } else { var propName = DOMProperty.getPropertyName[name]; // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the // property type before comparing; only `value` does and is string. if (!DOMProperty.hasSideEffects[name] || ('' + node[propName]) !== ('' + value)) { // Contrary to `setAttribute`, object properties are properly // `toString`ed by IE8/9. node[propName] = value; } } } else if (DOMProperty.isCustomAttribute(name)) { if (value == null) { node.removeAttribute(name); } else { node.setAttribute(name, '' + value); } } else if ("production" !== "development") { warnUnknownProperty(name); } }, /** * Deletes the value for a property on a node. * * @param {DOMElement} node * @param {string} name */ deleteValueForProperty: function(node, name) { if (DOMProperty.isStandardName.hasOwnProperty(name) && DOMProperty.isStandardName[name]) { var mutationMethod = DOMProperty.getMutationMethod[name]; if (mutationMethod) { mutationMethod(node, undefined); } else if (DOMProperty.mustUseAttribute[name]) { node.removeAttribute(DOMProperty.getAttributeName[name]); } else { var propName = DOMProperty.getPropertyName[name]; var defaultValue = DOMProperty.getDefaultValueForProperty( node.nodeName, propName ); if (!DOMProperty.hasSideEffects[name] || ('' + node[propName]) !== defaultValue) { node[propName] = defaultValue; } } } else if (DOMProperty.isCustomAttribute(name)) { node.removeAttribute(name); } else if ("production" !== "development") { warnUnknownProperty(name); } } }; module.exports = DOMPropertyOperations; },{"10":10,"147":147,"154":154}],12:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule Danger * @typechecks static-only */ /*jslint evil: true, sub: true */ 'use strict'; var ExecutionEnvironment = _dereq_(21); var createNodesFromMarkup = _dereq_(112); var emptyFunction = _dereq_(114); var getMarkupWrap = _dereq_(127); var invariant = _dereq_(135); var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/; var RESULT_INDEX_ATTR = 'data-danger-index'; /** * Extracts the `nodeName` from a string of markup. * * NOTE: Extracting the `nodeName` does not require a regular expression match * because we make assumptions about React-generated markup (i.e. there are no * spaces surrounding the opening tag and there is at least one attribute). * * @param {string} markup String of markup. * @return {string} Node name of the supplied markup. * @see http://jsperf.com/extract-nodename */ function getNodeName(markup) { return markup.substring(1, markup.indexOf(' ')); } var Danger = { /** * Renders markup into an array of nodes. The markup is expected to render * into a list of root nodes. Also, the length of `resultList` and * `markupList` should be the same. * * @param {array<string>} markupList List of markup strings to render. * @return {array<DOMElement>} List of rendered nodes. * @internal */ dangerouslyRenderMarkup: function(markupList) { ("production" !== "development" ? invariant( ExecutionEnvironment.canUseDOM, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'React.renderToString for server rendering.' ) : invariant(ExecutionEnvironment.canUseDOM)); var nodeName; var markupByNodeName = {}; // Group markup by `nodeName` if a wrap is necessary, else by '*'. for (var i = 0; i < markupList.length; i++) { ("production" !== "development" ? invariant( markupList[i], 'dangerouslyRenderMarkup(...): Missing markup.' ) : invariant(markupList[i])); nodeName = getNodeName(markupList[i]); nodeName = getMarkupWrap(nodeName) ? nodeName : '*'; markupByNodeName[nodeName] = markupByNodeName[nodeName] || []; markupByNodeName[nodeName][i] = markupList[i]; } var resultList = []; var resultListAssignmentCount = 0; for (nodeName in markupByNodeName) { if (!markupByNodeName.hasOwnProperty(nodeName)) { continue; } var markupListByNodeName = markupByNodeName[nodeName]; // This for-in loop skips the holes of the sparse array. The order of // iteration should follow the order of assignment, which happens to match // numerical index order, but we don't rely on that. var resultIndex; for (resultIndex in markupListByNodeName) { if (markupListByNodeName.hasOwnProperty(resultIndex)) { var markup = markupListByNodeName[resultIndex]; // Push the requested markup with an additional RESULT_INDEX_ATTR // attribute. If the markup does not start with a < character, it // will be discarded below (with an appropriate console.error). markupListByNodeName[resultIndex] = markup.replace( OPEN_TAG_NAME_EXP, // This index will be parsed back out below. '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ' ); } } // Render each group of markup with similar wrapping `nodeName`. var renderNodes = createNodesFromMarkup( markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags. ); for (var j = 0; j < renderNodes.length; ++j) { var renderNode = renderNodes[j]; if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) { resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR); renderNode.removeAttribute(RESULT_INDEX_ATTR); ("production" !== "development" ? invariant( !resultList.hasOwnProperty(resultIndex), 'Danger: Assigning to an already-occupied result index.' ) : invariant(!resultList.hasOwnProperty(resultIndex))); resultList[resultIndex] = renderNode; // This should match resultList.length and markupList.length when // we're done. resultListAssignmentCount += 1; } else if ("production" !== "development") { console.error( 'Danger: Discarding unexpected node:', renderNode ); } } } // Although resultList was populated out of order, it should now be a dense // array. ("production" !== "development" ? invariant( resultListAssignmentCount === resultList.length, 'Danger: Did not assign to every index of resultList.' ) : invariant(resultListAssignmentCount === resultList.length)); ("production" !== "development" ? invariant( resultList.length === markupList.length, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length ) : invariant(resultList.length === markupList.length)); return resultList; }, /** * Replaces a node with a string of markup at its current position within its * parent. The markup must render into a single root node. * * @param {DOMElement} oldChild Child node to replace. * @param {string} markup Markup to render in place of the child node. * @internal */ dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) { ("production" !== "development" ? invariant( ExecutionEnvironment.canUseDOM, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'React.renderToString for server rendering.' ) : invariant(ExecutionEnvironment.canUseDOM)); ("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup)); ("production" !== "development" ? invariant( oldChild.tagName.toLowerCase() !== 'html', 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See React.renderToString().' ) : invariant(oldChild.tagName.toLowerCase() !== 'html')); var newChild = createNodesFromMarkup(markup, emptyFunction)[0]; oldChild.parentNode.replaceChild(newChild, oldChild); } }; module.exports = Danger; },{"112":112,"114":114,"127":127,"135":135,"21":21}],13:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DefaultEventPluginOrder */ 'use strict'; var keyOf = _dereq_(141); /** * Module that is injectable into `EventPluginHub`, that specifies a * deterministic ordering of `EventPlugin`s. A convenient way to reason about * plugins, without having to package every one of them. This is better than * having plugins be ordered in the same order that they are injected because * that ordering would be influenced by the packaging order. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that * preventing default on events is convenient in `SimpleEventPlugin` handlers. */ var DefaultEventPluginOrder = [ keyOf({ResponderEventPlugin: null}), keyOf({SimpleEventPlugin: null}), keyOf({TapEventPlugin: null}), keyOf({EnterLeaveEventPlugin: null}), keyOf({ChangeEventPlugin: null}), keyOf({SelectEventPlugin: null}), keyOf({BeforeInputEventPlugin: null}), keyOf({AnalyticsEventPlugin: null}), keyOf({MobileSafariClickEventPlugin: null}) ]; module.exports = DefaultEventPluginOrder; },{"141":141}],14:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EnterLeaveEventPlugin * @typechecks static-only */ 'use strict'; var EventConstants = _dereq_(15); var EventPropagators = _dereq_(20); var SyntheticMouseEvent = _dereq_(99); var ReactMount = _dereq_(70); var keyOf = _dereq_(141); var topLevelTypes = EventConstants.topLevelTypes; var getFirstReactDOM = ReactMount.getFirstReactDOM; var eventTypes = { mouseEnter: { registrationName: keyOf({onMouseEnter: null}), dependencies: [ topLevelTypes.topMouseOut, topLevelTypes.topMouseOver ] }, mouseLeave: { registrationName: keyOf({onMouseLeave: null}), dependencies: [ topLevelTypes.topMouseOut, topLevelTypes.topMouseOver ] } }; var extractedEvents = [null, null]; var EnterLeaveEventPlugin = { eventTypes: eventTypes, /** * For almost every interaction we care about, there will be both a top-level * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that * we do not extract duplicate events. However, moving the mouse into the * browser from outside will not fire a `mouseout` event. In this case, we use * the `mouseover` top-level event. * * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @see {EventPluginHub.extractEvents} */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { return null; } if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) { // Must not be a mouse in or mouse out - ignoring. return null; } var win; if (topLevelTarget.window === topLevelTarget) { // `topLevelTarget` is probably a window object. win = topLevelTarget; } else { // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. var doc = topLevelTarget.ownerDocument; if (doc) { win = doc.defaultView || doc.parentWindow; } else { win = window; } } var from, to; if (topLevelType === topLevelTypes.topMouseOut) { from = topLevelTarget; to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) || win; } else { from = win; to = topLevelTarget; } if (from === to) { // Nothing pertains to our managed components. return null; } var fromID = from ? ReactMount.getID(from) : ''; var toID = to ? ReactMount.getID(to) : ''; var leave = SyntheticMouseEvent.getPooled( eventTypes.mouseLeave, fromID, nativeEvent ); leave.type = 'mouseleave'; leave.target = from; leave.relatedTarget = to; var enter = SyntheticMouseEvent.getPooled( eventTypes.mouseEnter, toID, nativeEvent ); enter.type = 'mouseenter'; enter.target = to; enter.relatedTarget = from; EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID); extractedEvents[0] = leave; extractedEvents[1] = enter; return extractedEvents; } }; module.exports = EnterLeaveEventPlugin; },{"141":141,"15":15,"20":20,"70":70,"99":99}],15:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EventConstants */ 'use strict'; var keyMirror = _dereq_(140); var PropagationPhases = keyMirror({bubbled: null, captured: null}); /** * Types of raw signals from the browser caught at the top level. */ var topLevelTypes = keyMirror({ topBlur: null, topChange: null, topClick: null, topCompositionEnd: null, topCompositionStart: null, topCompositionUpdate: null, topContextMenu: null, topCopy: null, topCut: null, topDoubleClick: null, topDrag: null, topDragEnd: null, topDragEnter: null, topDragExit: null, topDragLeave: null, topDragOver: null, topDragStart: null, topDrop: null, topError: null, topFocus: null, topInput: null, topKeyDown: null, topKeyPress: null, topKeyUp: null, topLoad: null, topMouseDown: null, topMouseMove: null, topMouseOut: null, topMouseOver: null, topMouseUp: null, topPaste: null, topReset: null, topScroll: null, topSelectionChange: null, topSubmit: null, topTextInput: null, topTouchCancel: null, topTouchEnd: null, topTouchMove: null, topTouchStart: null, topWheel: null }); var EventConstants = { topLevelTypes: topLevelTypes, PropagationPhases: PropagationPhases }; module.exports = EventConstants; },{"140":140}],16:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to 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. * * @providesModule EventListener * @typechecks */ var emptyFunction = _dereq_(114); /** * Upstream version of event listener. Does not take into account specific * nature of platform. */ var EventListener = { /** * Listen to DOM events during the bubble phase. * * @param {DOMEventTarget} target DOM element to register listener on. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. * @param {function} callback Callback function. * @return {object} Object with a `remove` method. */ listen: function(target, eventType, callback) { if (target.addEventListener) { target.addEventListener(eventType, callback, false); return { remove: function() { target.removeEventListener(eventType, callback, false); } }; } else if (target.attachEvent) { target.attachEvent('on' + eventType, callback); return { remove: function() { target.detachEvent('on' + eventType, callback); } }; } }, /** * Listen to DOM events during the capture phase. * * @param {DOMEventTarget} target DOM element to register listener on. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. * @param {function} callback Callback function. * @return {object} Object with a `remove` method. */ capture: function(target, eventType, callback) { if (!target.addEventListener) { if ("production" !== "development") { console.error( 'Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.' ); } return { remove: emptyFunction }; } else { target.addEventListener(eventType, callback, true); return { remove: function() { target.removeEventListener(eventType, callback, true); } }; } }, registerDefault: function() {} }; module.exports = EventListener; },{"114":114}],17:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EventPluginHub */ 'use strict'; var EventPluginRegistry = _dereq_(18); var EventPluginUtils = _dereq_(19); var accumulateInto = _dereq_(105); var forEachAccumulated = _dereq_(120); var invariant = _dereq_(135); /** * Internal store for event listeners */ var listenerBank = {}; /** * Internal queue of events that have accumulated their dispatches and are * waiting to have their dispatches executed. */ var eventQueue = null; /** * Dispatches an event and releases it back into the pool, unless persistent. * * @param {?object} event Synthetic event to be dispatched. * @private */ var executeDispatchesAndRelease = function(event) { if (event) { var executeDispatch = EventPluginUtils.executeDispatch; // Plugins can provide custom behavior when dispatching events. var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event); if (PluginModule && PluginModule.executeDispatch) { executeDispatch = PluginModule.executeDispatch; } EventPluginUtils.executeDispatchesInOrder(event, executeDispatch); if (!event.isPersistent()) { event.constructor.release(event); } } }; /** * - `InstanceHandle`: [required] Module that performs logical traversals of DOM * hierarchy given ids of the logical DOM elements involved. */ var InstanceHandle = null; function validateInstanceHandle() { var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave; ("production" !== "development" ? invariant( valid, 'InstanceHandle not injected before use!' ) : invariant(valid)); } /** * This is a unified interface for event plugins to be installed and configured. * * Event plugins can implement the following properties: * * `extractEvents` {function(string, DOMEventTarget, string, object): *} * Required. When a top-level event is fired, this method is expected to * extract synthetic events that will in turn be queued and dispatched. * * `eventTypes` {object} * Optional, plugins that fire events must publish a mapping of registration * names that are used to register listeners. Values of this mapping must * be objects that contain `registrationName` or `phasedRegistrationNames`. * * `executeDispatch` {function(object, function, string)} * Optional, allows plugins to override how an event gets dispatched. By * default, the listener is simply invoked. * * Each plugin that is injected into `EventsPluginHub` is immediately operable. * * @public */ var EventPluginHub = { /** * Methods for injecting dependencies. */ injection: { /** * @param {object} InjectedMount * @public */ injectMount: EventPluginUtils.injection.injectMount, /** * @param {object} InjectedInstanceHandle * @public */ injectInstanceHandle: function(InjectedInstanceHandle) { InstanceHandle = InjectedInstanceHandle; if ("production" !== "development") { validateInstanceHandle(); } }, getInstanceHandle: function() { if ("production" !== "development") { validateInstanceHandle(); } return InstanceHandle; }, /** * @param {array} InjectedEventPluginOrder * @public */ injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder, /** * @param {object} injectedNamesToPlugins Map from names to plugin modules. */ injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName }, eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs, registrationNameModules: EventPluginRegistry.registrationNameModules, /** * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent. * * @param {string} id ID of the DOM element. * @param {string} registrationName Name of listener (e.g. `onClick`). * @param {?function} listener The callback to store. */ putListener: function(id, registrationName, listener) { ("production" !== "development" ? invariant( !listener || typeof listener === 'function', 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener ) : invariant(!listener || typeof listener === 'function')); var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); bankForRegistrationName[id] = listener; }, /** * @param {string} id ID of the DOM element. * @param {string} registrationName Name of listener (e.g. `onClick`). * @return {?function} The stored callback. */ getListener: function(id, registrationName) { var bankForRegistrationName = listenerBank[registrationName]; return bankForRegistrationName && bankForRegistrationName[id]; }, /** * Deletes a listener from the registration bank. * * @param {string} id ID of the DOM element. * @param {string} registrationName Name of listener (e.g. `onClick`). */ deleteListener: function(id, registrationName) { var bankForRegistrationName = listenerBank[registrationName]; if (bankForRegistrationName) { delete bankForRegistrationName[id]; } }, /** * Deletes all listeners for the DOM element with the supplied ID. * * @param {string} id ID of the DOM element. */ deleteAllListeners: function(id) { for (var registrationName in listenerBank) { delete listenerBank[registrationName][id]; } }, /** * Allows registered plugins an opportunity to extract events from top-level * native browser events. * * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @internal */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { var events; var plugins = EventPluginRegistry.plugins; for (var i = 0, l = plugins.length; i < l; i++) { // Not every plugin in the ordering may be loaded at runtime. var possiblePlugin = plugins[i]; if (possiblePlugin) { var extractedEvents = possiblePlugin.extractEvents( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent ); if (extractedEvents) { events = accumulateInto(events, extractedEvents); } } } return events; }, /** * Enqueues a synthetic event that should be dispatched when * `processEventQueue` is invoked. * * @param {*} events An accumulation of synthetic events. * @internal */ enqueueEvents: function(events) { if (events) { eventQueue = accumulateInto(eventQueue, events); } }, /** * Dispatches all synthetic events on the event queue. * * @internal */ processEventQueue: function() { // Set `eventQueue` to null before processing it so that we can tell if more // events get enqueued while processing. var processingEventQueue = eventQueue; eventQueue = null; forEachAccumulated(processingEventQueue, executeDispatchesAndRelease); ("production" !== "development" ? invariant( !eventQueue, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.' ) : invariant(!eventQueue)); }, /** * These are needed for tests only. Do not use! */ __purge: function() { listenerBank = {}; }, __getListenerBank: function() { return listenerBank; } }; module.exports = EventPluginHub; },{"105":105,"120":120,"135":135,"18":18,"19":19}],18:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EventPluginRegistry * @typechecks static-only */ 'use strict'; var invariant = _dereq_(135); /** * Injectable ordering of event plugins. */ var EventPluginOrder = null; /** * Injectable mapping from names to event plugin modules. */ var namesToPlugins = {}; /** * Recomputes the plugin list using the injected plugins and plugin ordering. * * @private */ function recomputePluginOrdering() { if (!EventPluginOrder) { // Wait until an `EventPluginOrder` is injected. return; } for (var pluginName in namesToPlugins) { var PluginModule = namesToPlugins[pluginName]; var pluginIndex = EventPluginOrder.indexOf(pluginName); ("production" !== "development" ? invariant( pluginIndex > -1, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName ) : invariant(pluginIndex > -1)); if (EventPluginRegistry.plugins[pluginIndex]) { continue; } ("production" !== "development" ? invariant( PluginModule.extractEvents, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName ) : invariant(PluginModule.extractEvents)); EventPluginRegistry.plugins[pluginIndex] = PluginModule; var publishedEvents = PluginModule.eventTypes; for (var eventName in publishedEvents) { ("production" !== "development" ? invariant( publishEventForPlugin( publishedEvents[eventName], PluginModule, eventName ), 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName ) : invariant(publishEventForPlugin( publishedEvents[eventName], PluginModule, eventName ))); } } } /** * Publishes an event so that it can be dispatched by the supplied plugin. * * @param {object} dispatchConfig Dispatch configuration for the event. * @param {object} PluginModule Plugin publishing the event. * @return {boolean} True if the event was successfully published. * @private */ function publishEventForPlugin(dispatchConfig, PluginModule, eventName) { ("production" !== "development" ? invariant( !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName), 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName ) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName))); EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig; var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; if (phasedRegistrationNames) { for (var phaseName in phasedRegistrationNames) { if (phasedRegistrationNames.hasOwnProperty(phaseName)) { var phasedRegistrationName = phasedRegistrationNames[phaseName]; publishRegistrationName( phasedRegistrationName, PluginModule, eventName ); } } return true; } else if (dispatchConfig.registrationName) { publishRegistrationName( dispatchConfig.registrationName, PluginModule, eventName ); return true; } return false; } /** * Publishes a registration name that is used to identify dispatched events and * can be used with `EventPluginHub.putListener` to register listeners. * * @param {string} registrationName Registration name to add. * @param {object} PluginModule Plugin publishing the event. * @private */ function publishRegistrationName(registrationName, PluginModule, eventName) { ("production" !== "development" ? invariant( !EventPluginRegistry.registrationNameModules[registrationName], 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName ) : invariant(!EventPluginRegistry.registrationNameModules[registrationName])); EventPluginRegistry.registrationNameModules[registrationName] = PluginModule; EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies; } /** * Registers plugins so that they can extract and dispatch events. * * @see {EventPluginHub} */ var EventPluginRegistry = { /** * Ordered list of injected plugins. */ plugins: [], /** * Mapping from event name to dispatch config */ eventNameDispatchConfigs: {}, /** * Mapping from registration name to plugin module */ registrationNameModules: {}, /** * Mapping from registration name to event name */ registrationNameDependencies: {}, /** * Injects an ordering of plugins (by plugin name). This allows the ordering * to be decoupled from injection of the actual plugins so that ordering is * always deterministic regardless of packaging, on-the-fly injection, etc. * * @param {array} InjectedEventPluginOrder * @internal * @see {EventPluginHub.injection.injectEventPluginOrder} */ injectEventPluginOrder: function(InjectedEventPluginOrder) { ("production" !== "development" ? invariant( !EventPluginOrder, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.' ) : invariant(!EventPluginOrder)); // Clone the ordering so it cannot be dynamically mutated. EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder); recomputePluginOrdering(); }, /** * Injects plugins to be used by `EventPluginHub`. The plugin names must be * in the ordering injected by `injectEventPluginOrder`. * * Plugins can be injected as part of page initialization or on-the-fly. * * @param {object} injectedNamesToPlugins Map from names to plugin modules. * @internal * @see {EventPluginHub.injection.injectEventPluginsByName} */ injectEventPluginsByName: function(injectedNamesToPlugins) { var isOrderingDirty = false; for (var pluginName in injectedNamesToPlugins) { if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { continue; } var PluginModule = injectedNamesToPlugins[pluginName]; if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) { ("production" !== "development" ? invariant( !namesToPlugins[pluginName], 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName ) : invariant(!namesToPlugins[pluginName])); namesToPlugins[pluginName] = PluginModule; isOrderingDirty = true; } } if (isOrderingDirty) { recomputePluginOrdering(); } }, /** * Looks up the plugin for the supplied event. * * @param {object} event A synthetic event. * @return {?object} The plugin that created the supplied event. * @internal */ getPluginModuleForEvent: function(event) { var dispatchConfig = event.dispatchConfig; if (dispatchConfig.registrationName) { return EventPluginRegistry.registrationNameModules[ dispatchConfig.registrationName ] || null; } for (var phase in dispatchConfig.phasedRegistrationNames) { if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) { continue; } var PluginModule = EventPluginRegistry.registrationNameModules[ dispatchConfig.phasedRegistrationNames[phase] ]; if (PluginModule) { return PluginModule; } } return null; }, /** * Exposed for unit testing. * @private */ _resetEventPlugins: function() { EventPluginOrder = null; for (var pluginName in namesToPlugins) { if (namesToPlugins.hasOwnProperty(pluginName)) { delete namesToPlugins[pluginName]; } } EventPluginRegistry.plugins.length = 0; var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs; for (var eventName in eventNameDispatchConfigs) { if (eventNameDispatchConfigs.hasOwnProperty(eventName)) { delete eventNameDispatchConfigs[eventName]; } } var registrationNameModules = EventPluginRegistry.registrationNameModules; for (var registrationName in registrationNameModules) { if (registrationNameModules.hasOwnProperty(registrationName)) { delete registrationNameModules[registrationName]; } } } }; module.exports = EventPluginRegistry; },{"135":135}],19:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EventPluginUtils */ 'use strict'; var EventConstants = _dereq_(15); var invariant = _dereq_(135); /** * Injected dependencies: */ /** * - `Mount`: [required] Module that can convert between React dom IDs and * actual node references. */ var injection = { Mount: null, injectMount: function(InjectedMount) { injection.Mount = InjectedMount; if ("production" !== "development") { ("production" !== "development" ? invariant( InjectedMount && InjectedMount.getNode, 'EventPluginUtils.injection.injectMount(...): Injected Mount module ' + 'is missing getNode.' ) : invariant(InjectedMount && InjectedMount.getNode)); } } }; var topLevelTypes = EventConstants.topLevelTypes; function isEndish(topLevelType) { return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel; } function isMoveish(topLevelType) { return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove; } function isStartish(topLevelType) { return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart; } var validateEventDispatches; if ("production" !== "development") { validateEventDispatches = function(event) { var dispatchListeners = event._dispatchListeners; var dispatchIDs = event._dispatchIDs; var listenersIsArr = Array.isArray(dispatchListeners); var idsIsArr = Array.isArray(dispatchIDs); var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0; var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; ("production" !== "development" ? invariant( idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.' ) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen)); }; } /** * Invokes `cb(event, listener, id)`. Avoids using call if no scope is * provided. The `(listener,id)` pair effectively forms the "dispatch" but are * kept separate to conserve memory. */ function forEachEventDispatch(event, cb) { var dispatchListeners = event._dispatchListeners; var dispatchIDs = event._dispatchIDs; if ("production" !== "development") { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { for (var i = 0; i < dispatchListeners.length; i++) { if (event.isPropagationStopped()) { break; } // Listeners and IDs are two parallel arrays that are always in sync. cb(event, dispatchListeners[i], dispatchIDs[i]); } } else if (dispatchListeners) { cb(event, dispatchListeners, dispatchIDs); } } /** * Default implementation of PluginModule.executeDispatch(). * @param {SyntheticEvent} SyntheticEvent to handle * @param {function} Application-level callback * @param {string} domID DOM id to pass to the callback. */ function executeDispatch(event, listener, domID) { event.currentTarget = injection.Mount.getNode(domID); var returnValue = listener(event, domID); event.currentTarget = null; return returnValue; } /** * Standard/simple iteration through an event's collected dispatches. */ function executeDispatchesInOrder(event, cb) { forEachEventDispatch(event, cb); event._dispatchListeners = null; event._dispatchIDs = null; } /** * Standard/simple iteration through an event's collected dispatches, but stops * at the first dispatch execution returning true, and returns that id. * * @return id of the first dispatch execution who's listener returns true, or * null if no listener returned true. */ function executeDispatchesInOrderStopAtTrueImpl(event) { var dispatchListeners = event._dispatchListeners; var dispatchIDs = event._dispatchIDs; if ("production" !== "development") { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { for (var i = 0; i < dispatchListeners.length; i++) { if (event.isPropagationStopped()) { break; } // Listeners and IDs are two parallel arrays that are always in sync. if (dispatchListeners[i](event, dispatchIDs[i])) { return dispatchIDs[i]; } } } else if (dispatchListeners) { if (dispatchListeners(event, dispatchIDs)) { return dispatchIDs; } } return null; } /** * @see executeDispatchesInOrderStopAtTrueImpl */ function executeDispatchesInOrderStopAtTrue(event) { var ret = executeDispatchesInOrderStopAtTrueImpl(event); event._dispatchIDs = null; event._dispatchListeners = null; return ret; } /** * Execution of a "direct" dispatch - there must be at most one dispatch * accumulated on the event or it is considered an error. It doesn't really make * sense for an event with multiple dispatches (bubbled) to keep track of the * return values at each dispatch execution, but it does tend to make sense when * dealing with "direct" dispatches. * * @return The return value of executing the single dispatch. */ function executeDirectDispatch(event) { if ("production" !== "development") { validateEventDispatches(event); } var dispatchListener = event._dispatchListeners; var dispatchID = event._dispatchIDs; ("production" !== "development" ? invariant( !Array.isArray(dispatchListener), 'executeDirectDispatch(...): Invalid `event`.' ) : invariant(!Array.isArray(dispatchListener))); var res = dispatchListener ? dispatchListener(event, dispatchID) : null; event._dispatchListeners = null; event._dispatchIDs = null; return res; } /** * @param {SyntheticEvent} event * @return {bool} True iff number of dispatches accumulated is greater than 0. */ function hasDispatches(event) { return !!event._dispatchListeners; } /** * General utilities that are useful in creating custom Event Plugins. */ var EventPluginUtils = { isEndish: isEndish, isMoveish: isMoveish, isStartish: isStartish, executeDirectDispatch: executeDirectDispatch, executeDispatch: executeDispatch, executeDispatchesInOrder: executeDispatchesInOrder, executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, hasDispatches: hasDispatches, injection: injection, useTouchEvents: false }; module.exports = EventPluginUtils; },{"135":135,"15":15}],20:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EventPropagators */ 'use strict'; var EventConstants = _dereq_(15); var EventPluginHub = _dereq_(17); var accumulateInto = _dereq_(105); var forEachAccumulated = _dereq_(120); var PropagationPhases = EventConstants.PropagationPhases; var getListener = EventPluginHub.getListener; /** * Some event types have a notion of different registration names for different * "phases" of propagation. This finds listeners by a given phase. */ function listenerAtPhase(id, event, propagationPhase) { var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; return getListener(id, registrationName); } /** * Tags a `SyntheticEvent` with dispatched listeners. Creating this function * here, allows us to not have to bind or create functions for each event. * Mutating the event's members allows us to not have to create a wrapping * "dispatch" object that pairs the event with the listener. */ function accumulateDirectionalDispatches(domID, upwards, event) { if ("production" !== "development") { if (!domID) { throw new Error('Dispatching id must not be null'); } } var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured; var listener = listenerAtPhase(domID, event, phase); if (listener) { event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); event._dispatchIDs = accumulateInto(event._dispatchIDs, domID); } } /** * Collect dispatches (must be entirely collected before dispatching - see unit * tests). Lazily allocate the array to conserve memory. We must loop through * each event and perform the traversal for each one. We can not perform a * single traversal for the entire collection of events because each event may * have a different target. */ function accumulateTwoPhaseDispatchesSingle(event) { if (event && event.dispatchConfig.phasedRegistrationNames) { EventPluginHub.injection.getInstanceHandle().traverseTwoPhase( event.dispatchMarker, accumulateDirectionalDispatches, event ); } } /** * Accumulates without regard to direction, does not look for phased * registration names. Same as `accumulateDirectDispatchesSingle` but without * requiring that the `dispatchMarker` be the same as the dispatched ID. */ function accumulateDispatches(id, ignoredDirection, event) { if (event && event.dispatchConfig.registrationName) { var registrationName = event.dispatchConfig.registrationName; var listener = getListener(id, registrationName); if (listener) { event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); event._dispatchIDs = accumulateInto(event._dispatchIDs, id); } } } /** * Accumulates dispatches on an `SyntheticEvent`, but only for the * `dispatchMarker`. * @param {SyntheticEvent} event */ function accumulateDirectDispatchesSingle(event) { if (event && event.dispatchConfig.registrationName) { accumulateDispatches(event.dispatchMarker, null, event); } } function accumulateTwoPhaseDispatches(events) { forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); } function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) { EventPluginHub.injection.getInstanceHandle().traverseEnterLeave( fromID, toID, accumulateDispatches, leave, enter ); } function accumulateDirectDispatches(events) { forEachAccumulated(events, accumulateDirectDispatchesSingle); } /** * A small set of propagation patterns, each of which will accept a small amount * of information, and generate a set of "dispatch ready event objects" - which * are sets of events that have already been annotated with a set of dispatched * listener functions/ids. The API is designed this way to discourage these * propagation strategies from actually executing the dispatches, since we * always want to collect the entire set of dispatches before executing event a * single one. * * @constructor EventPropagators */ var EventPropagators = { accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, accumulateDirectDispatches: accumulateDirectDispatches, accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches }; module.exports = EventPropagators; },{"105":105,"120":120,"15":15,"17":17}],21:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ExecutionEnvironment */ /*jslint evil: true */ "use strict"; var canUseDOM = !!( (typeof window !== 'undefined' && window.document && window.document.createElement) ); /** * Simple, lightweight module assisting with the detection and context of * Worker. Helps avoid circular dependencies and allows code to reason about * whether or not they are in a Worker, even if they never include the main * `ReactWorker` dependency. */ var ExecutionEnvironment = { canUseDOM: canUseDOM, canUseWorkers: typeof Worker !== 'undefined', canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), canUseViewport: canUseDOM && !!window.screen, isInWorker: !canUseDOM // For now, this is true - might change in the future. }; module.exports = ExecutionEnvironment; },{}],22:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule FallbackCompositionState * @typechecks static-only */ 'use strict'; var PooledClass = _dereq_(28); var assign = _dereq_(27); var getTextContentAccessor = _dereq_(130); /** * This helper class stores information about text content of a target node, * allowing comparison of content before and after a given event. * * Identify the node where selection currently begins, then observe * both its text content and its current position in the DOM. Since the * browser may natively replace the target node during composition, we can * use its position to find its replacement. * * @param {DOMEventTarget} root */ function FallbackCompositionState(root) { this._root = root; this._startText = this.getText(); this._fallbackText = null; } assign(FallbackCompositionState.prototype, { /** * Get current text of input. * * @return {string} */ getText: function() { if ('value' in this._root) { return this._root.value; } return this._root[getTextContentAccessor()]; }, /** * Determine the differing substring between the initially stored * text content and the current content. * * @return {string} */ getData: function() { if (this._fallbackText) { return this._fallbackText; } var start; var startValue = this._startText; var startLength = startValue.length; var end; var endValue = this.getText(); var endLength = endValue.length; for (start = 0; start < startLength; start++) { if (startValue[start] !== endValue[start]) { break; } } var minEnd = startLength - start; for (end = 1; end <= minEnd; end++) { if (startValue[startLength - end] !== endValue[endLength - end]) { break; } } var sliceTail = end > 1 ? 1 - end : undefined; this._fallbackText = endValue.slice(start, sliceTail); return this._fallbackText; } }); PooledClass.addPoolingTo(FallbackCompositionState); module.exports = FallbackCompositionState; },{"130":130,"27":27,"28":28}],23:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule HTMLDOMPropertyConfig */ /*jslint bitwise: true*/ 'use strict'; var DOMProperty = _dereq_(10); var ExecutionEnvironment = _dereq_(21); var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE; var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY; var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE; var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS; var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE; var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE; var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE; var hasSVG; if (ExecutionEnvironment.canUseDOM) { var implementation = document.implementation; hasSVG = ( implementation && implementation.hasFeature && implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1' ) ); } var HTMLDOMPropertyConfig = { isCustomAttribute: RegExp.prototype.test.bind( /^(data|aria)-[a-z_][a-z\d_.\-]*$/ ), Properties: { /** * Standard Properties */ accept: null, acceptCharset: null, accessKey: null, action: null, allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, allowTransparency: MUST_USE_ATTRIBUTE, alt: null, async: HAS_BOOLEAN_VALUE, autoComplete: null, // autoFocus is polyfilled/normalized by AutoFocusMixin // autoFocus: HAS_BOOLEAN_VALUE, autoPlay: HAS_BOOLEAN_VALUE, cellPadding: null, cellSpacing: null, charSet: MUST_USE_ATTRIBUTE, checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, classID: MUST_USE_ATTRIBUTE, // To set className on SVG elements, it's necessary to use .setAttribute; // this works on HTML elements too in all browsers except IE8. Conveniently, // IE8 doesn't support SVG and so we can simply use the attribute in // browsers that support SVG and the property in browsers that don't, // regardless of whether the element is HTML or SVG. className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY, cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, colSpan: null, content: null, contentEditable: null, contextMenu: MUST_USE_ATTRIBUTE, controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, coords: null, crossOrigin: null, data: null, // For `<object />` acts as `src`. dateTime: MUST_USE_ATTRIBUTE, defer: HAS_BOOLEAN_VALUE, dir: null, disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, download: HAS_OVERLOADED_BOOLEAN_VALUE, draggable: null, encType: null, form: MUST_USE_ATTRIBUTE, formAction: MUST_USE_ATTRIBUTE, formEncType: MUST_USE_ATTRIBUTE, formMethod: MUST_USE_ATTRIBUTE, formNoValidate: HAS_BOOLEAN_VALUE, formTarget: MUST_USE_ATTRIBUTE, frameBorder: MUST_USE_ATTRIBUTE, headers: null, height: MUST_USE_ATTRIBUTE, hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, high: null, href: null, hrefLang: null, htmlFor: null, httpEquiv: null, icon: null, id: MUST_USE_PROPERTY, label: null, lang: null, list: MUST_USE_ATTRIBUTE, loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, low: null, manifest: MUST_USE_ATTRIBUTE, marginHeight: null, marginWidth: null, max: null, maxLength: MUST_USE_ATTRIBUTE, media: MUST_USE_ATTRIBUTE, mediaGroup: null, method: null, min: null, multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, name: null, noValidate: HAS_BOOLEAN_VALUE, open: HAS_BOOLEAN_VALUE, optimum: null, pattern: null, placeholder: null, poster: null, preload: null, radioGroup: null, readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, rel: null, required: HAS_BOOLEAN_VALUE, role: MUST_USE_ATTRIBUTE, rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, rowSpan: null, sandbox: null, scope: null, scoped: HAS_BOOLEAN_VALUE, scrolling: null, seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, shape: null, size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, sizes: MUST_USE_ATTRIBUTE, span: HAS_POSITIVE_NUMERIC_VALUE, spellCheck: null, src: null, srcDoc: MUST_USE_PROPERTY, srcSet: MUST_USE_ATTRIBUTE, start: HAS_NUMERIC_VALUE, step: null, style: null, tabIndex: null, target: null, title: null, type: null, useMap: null, value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS, width: MUST_USE_ATTRIBUTE, wmode: MUST_USE_ATTRIBUTE, /** * Non-standard Properties */ // autoCapitalize and autoCorrect are supported in Mobile Safari for // keyboard hints. autoCapitalize: null, autoCorrect: null, // itemProp, itemScope, itemType are for // Microdata support. See http://schema.org/docs/gs.html itemProp: MUST_USE_ATTRIBUTE, itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, itemType: MUST_USE_ATTRIBUTE, // itemID and itemRef are for Microdata support as well but // only specified in the the WHATWG spec document. See // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api itemID: MUST_USE_ATTRIBUTE, itemRef: MUST_USE_ATTRIBUTE, // property is supported for OpenGraph in meta tags. property: null, // IE-only attribute that controls focus behavior unselectable: MUST_USE_ATTRIBUTE }, DOMAttributeNames: { acceptCharset: 'accept-charset', className: 'class', htmlFor: 'for', httpEquiv: 'http-equiv' }, DOMPropertyNames: { autoCapitalize: 'autocapitalize', autoComplete: 'autocomplete', autoCorrect: 'autocorrect', autoFocus: 'autofocus', autoPlay: 'autoplay', // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter. // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding encType: 'encoding', hrefLang: 'hreflang', radioGroup: 'radiogroup', spellCheck: 'spellcheck', srcDoc: 'srcdoc', srcSet: 'srcset' } }; module.exports = HTMLDOMPropertyConfig; },{"10":10,"21":21}],24:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule LinkedValueUtils * @typechecks static-only */ 'use strict'; var ReactPropTypes = _dereq_(78); var invariant = _dereq_(135); var hasReadOnlyValue = { 'button': true, 'checkbox': true, 'image': true, 'hidden': true, 'radio': true, 'reset': true, 'submit': true }; function _assertSingleLink(input) { ("production" !== "development" ? invariant( input.props.checkedLink == null || input.props.valueLink == null, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.' ) : invariant(input.props.checkedLink == null || input.props.valueLink == null)); } function _assertValueLink(input) { _assertSingleLink(input); ("production" !== "development" ? invariant( input.props.value == null && input.props.onChange == null, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.' ) : invariant(input.props.value == null && input.props.onChange == null)); } function _assertCheckedLink(input) { _assertSingleLink(input); ("production" !== "development" ? invariant( input.props.checked == null && input.props.onChange == null, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink' ) : invariant(input.props.checked == null && input.props.onChange == null)); } /** * @param {SyntheticEvent} e change event to handle */ function _handleLinkedValueChange(e) { /*jshint validthis:true */ this.props.valueLink.requestChange(e.target.value); } /** * @param {SyntheticEvent} e change event to handle */ function _handleLinkedCheckChange(e) { /*jshint validthis:true */ this.props.checkedLink.requestChange(e.target.checked); } /** * Provide a linked `value` attribute for controlled forms. You should not use * this outside of the ReactDOM controlled form components. */ var LinkedValueUtils = { Mixin: { propTypes: { value: function(props, propName, componentName) { if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) { return null; } return new Error( 'You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.' ); }, checked: function(props, propName, componentName) { if (!props[propName] || props.onChange || props.readOnly || props.disabled) { return null; } return new Error( 'You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.' ); }, onChange: ReactPropTypes.func } }, /** * @param {ReactComponent} input Form component * @return {*} current value of the input either from value prop or link. */ getValue: function(input) { if (input.props.valueLink) { _assertValueLink(input); return input.props.valueLink.value; } return input.props.value; }, /** * @param {ReactComponent} input Form component * @return {*} current checked status of the input either from checked prop * or link. */ getChecked: function(input) { if (input.props.checkedLink) { _assertCheckedLink(input); return input.props.checkedLink.value; } return input.props.checked; }, /** * @param {ReactComponent} input Form component * @return {function} change callback either from onChange prop or link. */ getOnChange: function(input) { if (input.props.valueLink) { _assertValueLink(input); return _handleLinkedValueChange; } else if (input.props.checkedLink) { _assertCheckedLink(input); return _handleLinkedCheckChange; } return input.props.onChange; } }; module.exports = LinkedValueUtils; },{"135":135,"78":78}],25:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule LocalEventTrapMixin */ 'use strict'; var ReactBrowserEventEmitter = _dereq_(30); var accumulateInto = _dereq_(105); var forEachAccumulated = _dereq_(120); var invariant = _dereq_(135); function remove(event) { event.remove(); } var LocalEventTrapMixin = { trapBubbledEvent:function(topLevelType, handlerBaseName) { ("production" !== "development" ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted())); // If a component renders to null or if another component fatals and causes // the state of the tree to be corrupted, `node` here can be null. var node = this.getDOMNode(); ("production" !== "development" ? invariant( node, 'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.' ) : invariant(node)); var listener = ReactBrowserEventEmitter.trapBubbledEvent( topLevelType, handlerBaseName, node ); this._localEventListeners = accumulateInto(this._localEventListeners, listener); }, // trapCapturedEvent would look nearly identical. We don't implement that // method because it isn't currently needed. componentWillUnmount:function() { if (this._localEventListeners) { forEachAccumulated(this._localEventListeners, remove); } } }; module.exports = LocalEventTrapMixin; },{"105":105,"120":120,"135":135,"30":30}],26:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule MobileSafariClickEventPlugin * @typechecks static-only */ 'use strict'; var EventConstants = _dereq_(15); var emptyFunction = _dereq_(114); var topLevelTypes = EventConstants.topLevelTypes; /** * Mobile Safari does not fire properly bubble click events on non-interactive * elements, which means delegated click listeners do not fire. The workaround * for this bug involves attaching an empty click listener on the target node. * * This particular plugin works around the bug by attaching an empty click * listener on `touchstart` (which does fire on every element). */ var MobileSafariClickEventPlugin = { eventTypes: null, /** * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @see {EventPluginHub.extractEvents} */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { if (topLevelType === topLevelTypes.topTouchStart) { var target = nativeEvent.target; if (target && !target.onclick) { target.onclick = emptyFunction; } } } }; module.exports = MobileSafariClickEventPlugin; },{"114":114,"15":15}],27:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule Object.assign */ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign 'use strict'; function assign(target, sources) { if (target == null) { throw new TypeError('Object.assign target cannot be null or undefined'); } var to = Object(target); var hasOwnProperty = Object.prototype.hasOwnProperty; for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) { var nextSource = arguments[nextIndex]; if (nextSource == null) { continue; } var from = Object(nextSource); // We don't currently support accessors nor proxies. Therefore this // copy cannot throw. If we ever supported this then we must handle // exceptions and side-effects. We don't support symbols so they won't // be transferred. for (var key in from) { if (hasOwnProperty.call(from, key)) { to[key] = from[key]; } } } return to; } module.exports = assign; },{}],28:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule PooledClass */ 'use strict'; var invariant = _dereq_(135); /** * Static poolers. Several custom versions for each potential number of * arguments. A completely generic pooler is easy to implement, but would * require accessing the `arguments` object. In each of these, `this` refers to * the Class itself, not an instance. If any others are needed, simply add them * here, or in their own files. */ var oneArgumentPooler = function(copyFieldsFrom) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); Klass.call(instance, copyFieldsFrom); return instance; } else { return new Klass(copyFieldsFrom); } }; var twoArgumentPooler = function(a1, a2) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); Klass.call(instance, a1, a2); return instance; } else { return new Klass(a1, a2); } }; var threeArgumentPooler = function(a1, a2, a3) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); Klass.call(instance, a1, a2, a3); return instance; } else { return new Klass(a1, a2, a3); } }; var fiveArgumentPooler = function(a1, a2, a3, a4, a5) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); Klass.call(instance, a1, a2, a3, a4, a5); return instance; } else { return new Klass(a1, a2, a3, a4, a5); } }; var standardReleaser = function(instance) { var Klass = this; ("production" !== "development" ? invariant( instance instanceof Klass, 'Trying to release an instance into a pool of a different type.' ) : invariant(instance instanceof Klass)); if (instance.destructor) { instance.destructor(); } if (Klass.instancePool.length < Klass.poolSize) { Klass.instancePool.push(instance); } }; var DEFAULT_POOL_SIZE = 10; var DEFAULT_POOLER = oneArgumentPooler; /** * Augments `CopyConstructor` to be a poolable class, augmenting only the class * itself (statically) not adding any prototypical fields. Any CopyConstructor * you give this may have a `poolSize` property, and will look for a * prototypical `destructor` on instances (optional). * * @param {Function} CopyConstructor Constructor that can be used to reset. * @param {Function} pooler Customizable pooler. */ var addPoolingTo = function(CopyConstructor, pooler) { var NewKlass = CopyConstructor; NewKlass.instancePool = []; NewKlass.getPooled = pooler || DEFAULT_POOLER; if (!NewKlass.poolSize) { NewKlass.poolSize = DEFAULT_POOL_SIZE; } NewKlass.release = standardReleaser; return NewKlass; }; var PooledClass = { addPoolingTo: addPoolingTo, oneArgumentPooler: oneArgumentPooler, twoArgumentPooler: twoArgumentPooler, threeArgumentPooler: threeArgumentPooler, fiveArgumentPooler: fiveArgumentPooler }; module.exports = PooledClass; },{"135":135}],29:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactBrowserComponentMixin */ 'use strict'; var findDOMNode = _dereq_(117); var ReactBrowserComponentMixin = { /** * Returns the DOM node rendered by this component. * * @return {DOMElement} The root node of this component. * @final * @protected */ getDOMNode: function() { return findDOMNode(this); } }; module.exports = ReactBrowserComponentMixin; },{"117":117}],30:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactBrowserEventEmitter * @typechecks static-only */ 'use strict'; var EventConstants = _dereq_(15); var EventPluginHub = _dereq_(17); var EventPluginRegistry = _dereq_(18); var ReactEventEmitterMixin = _dereq_(61); var ViewportMetrics = _dereq_(104); var assign = _dereq_(27); var isEventSupported = _dereq_(136); /** * Summary of `ReactBrowserEventEmitter` event handling: * * - Top-level delegation is used to trap most native browser events. This * may only occur in the main thread and is the responsibility of * ReactEventListener, which is injected and can therefore support pluggable * event sources. This is the only work that occurs in the main thread. * * - We normalize and de-duplicate events to account for browser quirks. This * may be done in the worker thread. * * - Forward these native events (with the associated top-level type used to * trap it) to `EventPluginHub`, which in turn will ask plugins if they want * to extract any synthetic events. * * - The `EventPluginHub` will then process each event by annotating them with * "dispatches", a sequence of listeners and IDs that care about that event. * * - The `EventPluginHub` then dispatches the events. * * Overview of React and the event system: * * +------------+ . * | DOM | . * +------------+ . * | . * v . * +------------+ . * | ReactEvent | . * | Listener | . * +------------+ . +-----------+ * | . +--------+|SimpleEvent| * | . | |Plugin | * +-----|------+ . v +-----------+ * | | | . +--------------+ +------------+ * | +-----------.--->|EventPluginHub| | Event | * | | . | | +-----------+ | Propagators| * | ReactEvent | . | | |TapEvent | |------------| * | Emitter | . | |<---+|Plugin | |other plugin| * | | . | | +-----------+ | utilities | * | +-----------.--->| | +------------+ * | | | . +--------------+ * +-----|------+ . ^ +-----------+ * | . | |Enter/Leave| * + . +-------+|Plugin | * +-------------+ . +-----------+ * | application | . * |-------------| . * | | . * | | . * +-------------+ . * . * React Core . General Purpose Event Plugin System */ var alreadyListeningTo = {}; var isMonitoringScrollValue = false; var reactTopListenersCounter = 0; // For events like 'submit' which don't consistently bubble (which we trap at a // lower node than `document`), binding at `document` would cause duplicate // events so we don't include them here var topEventMapping = { topBlur: 'blur', topChange: 'change', topClick: 'click', topCompositionEnd: 'compositionend', topCompositionStart: 'compositionstart', topCompositionUpdate: 'compositionupdate', topContextMenu: 'contextmenu', topCopy: 'copy', topCut: 'cut', topDoubleClick: 'dblclick', topDrag: 'drag', topDragEnd: 'dragend', topDragEnter: 'dragenter', topDragExit: 'dragexit', topDragLeave: 'dragleave', topDragOver: 'dragover', topDragStart: 'dragstart', topDrop: 'drop', topFocus: 'focus', topInput: 'input', topKeyDown: 'keydown', topKeyPress: 'keypress', topKeyUp: 'keyup', topMouseDown: 'mousedown', topMouseMove: 'mousemove', topMouseOut: 'mouseout', topMouseOver: 'mouseover', topMouseUp: 'mouseup', topPaste: 'paste', topScroll: 'scroll', topSelectionChange: 'selectionchange', topTextInput: 'textInput', topTouchCancel: 'touchcancel', topTouchEnd: 'touchend', topTouchMove: 'touchmove', topTouchStart: 'touchstart', topWheel: 'wheel' }; /** * To ensure no conflicts with other potential React instances on the page */ var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2); function getListeningForDocument(mountAt) { // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` // directly. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { mountAt[topListenersIDKey] = reactTopListenersCounter++; alreadyListeningTo[mountAt[topListenersIDKey]] = {}; } return alreadyListeningTo[mountAt[topListenersIDKey]]; } /** * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For * example: * * ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction); * * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'. * * @internal */ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, { /** * Injectable event backend */ ReactEventListener: null, injection: { /** * @param {object} ReactEventListener */ injectReactEventListener: function(ReactEventListener) { ReactEventListener.setHandleTopLevel( ReactBrowserEventEmitter.handleTopLevel ); ReactBrowserEventEmitter.ReactEventListener = ReactEventListener; } }, /** * Sets whether or not any created callbacks should be enabled. * * @param {boolean} enabled True if callbacks should be enabled. */ setEnabled: function(enabled) { if (ReactBrowserEventEmitter.ReactEventListener) { ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled); } }, /** * @return {boolean} True if callbacks are enabled. */ isEnabled: function() { return !!( (ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled()) ); }, /** * We listen for bubbled touch events on the document object. * * Firefox v8.01 (and possibly others) exhibited strange behavior when * mounting `onmousemove` events at some node that was not the document * element. The symptoms were that if your mouse is not moving over something * contained within that mount point (for example on the background) the * top-level listeners for `onmousemove` won't be called. However, if you * register the `mousemove` on the document object, then it will of course * catch all `mousemove`s. This along with iOS quirks, justifies restricting * top-level listeners to the document object only, at least for these * movement types of events and possibly all events. * * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html * * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but * they bubble to document. * * @param {string} registrationName Name of listener (e.g. `onClick`). * @param {object} contentDocumentHandle Document which owns the container */ listenTo: function(registrationName, contentDocumentHandle) { var mountAt = contentDocumentHandle; var isListening = getListeningForDocument(mountAt); var dependencies = EventPluginRegistry. registrationNameDependencies[registrationName]; var topLevelTypes = EventConstants.topLevelTypes; for (var i = 0, l = dependencies.length; i < l; i++) { var dependency = dependencies[i]; if (!( (isListening.hasOwnProperty(dependency) && isListening[dependency]) )) { if (dependency === topLevelTypes.topWheel) { if (isEventSupported('wheel')) { ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent( topLevelTypes.topWheel, 'wheel', mountAt ); } else if (isEventSupported('mousewheel')) { ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent( topLevelTypes.topWheel, 'mousewheel', mountAt ); } else { // Firefox needs to capture a different mouse scroll event. // @see http://www.quirksmode.org/dom/events/tests/scroll.html ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent( topLevelTypes.topWheel, 'DOMMouseScroll', mountAt ); } } else if (dependency === topLevelTypes.topScroll) { if (isEventSupported('scroll', true)) { ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent( topLevelTypes.topScroll, 'scroll', mountAt ); } else { ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent( topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE ); } } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) { if (isEventSupported('focus', true)) { ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent( topLevelTypes.topFocus, 'focus', mountAt ); ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent( topLevelTypes.topBlur, 'blur', mountAt ); } else if (isEventSupported('focusin')) { // IE has `focusin` and `focusout` events which bubble. // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent( topLevelTypes.topFocus, 'focusin', mountAt ); ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent( topLevelTypes.topBlur, 'focusout', mountAt ); } // to make sure blur and focus event listeners are only attached once isListening[topLevelTypes.topBlur] = true; isListening[topLevelTypes.topFocus] = true; } else if (topEventMapping.hasOwnProperty(dependency)) { ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent( dependency, topEventMapping[dependency], mountAt ); } isListening[dependency] = true; } } }, trapBubbledEvent: function(topLevelType, handlerBaseName, handle) { return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent( topLevelType, handlerBaseName, handle ); }, trapCapturedEvent: function(topLevelType, handlerBaseName, handle) { return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent( topLevelType, handlerBaseName, handle ); }, /** * Listens to window scroll and resize events. We cache scroll values so that * application code can access them without triggering reflows. * * NOTE: Scroll events do not bubble. * * @see http://www.quirksmode.org/dom/events/scroll.html */ ensureScrollValueMonitoring: function() { if (!isMonitoringScrollValue) { var refresh = ViewportMetrics.refreshScrollValues; ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh); isMonitoringScrollValue = true; } }, eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs, registrationNameModules: EventPluginHub.registrationNameModules, putListener: EventPluginHub.putListener, getListener: EventPluginHub.getListener, deleteListener: EventPluginHub.deleteListener, deleteAllListeners: EventPluginHub.deleteAllListeners }); module.exports = ReactBrowserEventEmitter; },{"104":104,"136":136,"15":15,"17":17,"18":18,"27":27,"61":61}],31:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactChildReconciler * @typechecks static-only */ 'use strict'; var ReactReconciler = _dereq_(81); var flattenChildren = _dereq_(118); var instantiateReactComponent = _dereq_(134); var shouldUpdateReactComponent = _dereq_(151); /** * ReactChildReconciler provides helpers for initializing or updating a set of * children. Its output is suitable for passing it onto ReactMultiChild which * does diffed reordering and insertion. */ var ReactChildReconciler = { /** * Generates a "mount image" for each of the supplied children. In the case * of `ReactDOMComponent`, a mount image is a string of markup. * * @param {?object} nestedChildNodes Nested child maps. * @return {?object} A set of child instances. * @internal */ instantiateChildren: function(nestedChildNodes, transaction, context) { var children = flattenChildren(nestedChildNodes); for (var name in children) { if (children.hasOwnProperty(name)) { var child = children[name]; // The rendered children must be turned into instances as they're // mounted. var childInstance = instantiateReactComponent(child, null); children[name] = childInstance; } } return children; }, /** * Updates the rendered children and returns a new set of children. * * @param {?object} prevChildren Previously initialized set of children. * @param {?object} nextNestedChildNodes Nested child maps. * @param {ReactReconcileTransaction} transaction * @param {object} context * @return {?object} A new set of child instances. * @internal */ updateChildren: function( prevChildren, nextNestedChildNodes, transaction, context) { // We currently don't have a way to track moves here but if we use iterators // instead of for..in we can zip the iterators and check if an item has // moved. // TODO: If nothing has changed, return the prevChildren object so that we // can quickly bailout if nothing has changed. var nextChildren = flattenChildren(nextNestedChildNodes); if (!nextChildren && !prevChildren) { return null; } var name; for (name in nextChildren) { if (!nextChildren.hasOwnProperty(name)) { continue; } var prevChild = prevChildren && prevChildren[name]; var prevElement = prevChild && prevChild._currentElement; var nextElement = nextChildren[name]; if (shouldUpdateReactComponent(prevElement, nextElement)) { ReactReconciler.receiveComponent( prevChild, nextElement, transaction, context ); nextChildren[name] = prevChild; } else { if (prevChild) { ReactReconciler.unmountComponent(prevChild, name); } // The child must be instantiated before it's mounted. var nextChildInstance = instantiateReactComponent( nextElement, null ); nextChildren[name] = nextChildInstance; } } // Unmount children that are no longer present. for (name in prevChildren) { if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) { ReactReconciler.unmountComponent(prevChildren[name]); } } return nextChildren; }, /** * Unmounts all rendered children. This should be used to clean up children * when this component is unmounted. * * @param {?object} renderedChildren Previously initialized set of children. * @internal */ unmountChildren: function(renderedChildren) { for (var name in renderedChildren) { var renderedChild = renderedChildren[name]; ReactReconciler.unmountComponent(renderedChild); } } }; module.exports = ReactChildReconciler; },{"118":118,"134":134,"151":151,"81":81}],32:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactChildren */ 'use strict'; var PooledClass = _dereq_(28); var ReactFragment = _dereq_(63); var traverseAllChildren = _dereq_(153); var warning = _dereq_(154); var twoArgumentPooler = PooledClass.twoArgumentPooler; var threeArgumentPooler = PooledClass.threeArgumentPooler; /** * PooledClass representing the bookkeeping associated with performing a child * traversal. Allows avoiding binding callbacks. * * @constructor ForEachBookKeeping * @param {!function} forEachFunction Function to perform traversal with. * @param {?*} forEachContext Context to perform context with. */ function ForEachBookKeeping(forEachFunction, forEachContext) { this.forEachFunction = forEachFunction; this.forEachContext = forEachContext; } PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler); function forEachSingleChild(traverseContext, child, name, i) { var forEachBookKeeping = traverseContext; forEachBookKeeping.forEachFunction.call( forEachBookKeeping.forEachContext, child, i); } /** * Iterates through children that are typically specified as `props.children`. * * The provided forEachFunc(child, index) will be called for each * leaf child. * * @param {?*} children Children tree container. * @param {function(*, int)} forEachFunc. * @param {*} forEachContext Context for forEachContext. */ function forEachChildren(children, forEachFunc, forEachContext) { if (children == null) { return children; } var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext); traverseAllChildren(children, forEachSingleChild, traverseContext); ForEachBookKeeping.release(traverseContext); } /** * PooledClass representing the bookkeeping associated with performing a child * mapping. Allows avoiding binding callbacks. * * @constructor MapBookKeeping * @param {!*} mapResult Object containing the ordered map of results. * @param {!function} mapFunction Function to perform mapping with. * @param {?*} mapContext Context to perform mapping with. */ function MapBookKeeping(mapResult, mapFunction, mapContext) { this.mapResult = mapResult; this.mapFunction = mapFunction; this.mapContext = mapContext; } PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler); function mapSingleChildIntoContext(traverseContext, child, name, i) { var mapBookKeeping = traverseContext; var mapResult = mapBookKeeping.mapResult; var keyUnique = !mapResult.hasOwnProperty(name); if ("production" !== "development") { ("production" !== "development" ? warning( keyUnique, 'ReactChildren.map(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name ) : null); } if (keyUnique) { var mappedChild = mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i); mapResult[name] = mappedChild; } } /** * Maps children that are typically specified as `props.children`. * * The provided mapFunction(child, key, index) will be called for each * leaf child. * * TODO: This may likely break any calls to `ReactChildren.map` that were * previously relying on the fact that we guarded against null children. * * @param {?*} children Children tree container. * @param {function(*, int)} mapFunction. * @param {*} mapContext Context for mapFunction. * @return {object} Object containing the ordered map of results. */ function mapChildren(children, func, context) { if (children == null) { return children; } var mapResult = {}; var traverseContext = MapBookKeeping.getPooled(mapResult, func, context); traverseAllChildren(children, mapSingleChildIntoContext, traverseContext); MapBookKeeping.release(traverseContext); return ReactFragment.create(mapResult); } function forEachSingleChildDummy(traverseContext, child, name, i) { return null; } /** * Count the number of children that are typically specified as * `props.children`. * * @param {?*} children Children tree container. * @return {number} The number of children. */ function countChildren(children, context) { return traverseAllChildren(children, forEachSingleChildDummy, null); } var ReactChildren = { forEach: forEachChildren, map: mapChildren, count: countChildren }; module.exports = ReactChildren; },{"153":153,"154":154,"28":28,"63":63}],33:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactClass */ 'use strict'; var ReactComponent = _dereq_(34); var ReactCurrentOwner = _dereq_(39); var ReactElement = _dereq_(57); var ReactErrorUtils = _dereq_(60); var ReactInstanceMap = _dereq_(67); var ReactLifeCycle = _dereq_(68); var ReactPropTypeLocations = _dereq_(77); var ReactPropTypeLocationNames = _dereq_(76); var ReactUpdateQueue = _dereq_(86); var assign = _dereq_(27); var invariant = _dereq_(135); var keyMirror = _dereq_(140); var keyOf = _dereq_(141); var warning = _dereq_(154); var MIXINS_KEY = keyOf({mixins: null}); /** * Policies that describe methods in `ReactClassInterface`. */ var SpecPolicy = keyMirror({ /** * These methods may be defined only once by the class specification or mixin. */ DEFINE_ONCE: null, /** * These methods may be defined by both the class specification and mixins. * Subsequent definitions will be chained. These methods must return void. */ DEFINE_MANY: null, /** * These methods are overriding the base class. */ OVERRIDE_BASE: null, /** * These methods are similar to DEFINE_MANY, except we assume they return * objects. We try to merge the keys of the return values of all the mixed in * functions. If there is a key conflict we throw. */ DEFINE_MANY_MERGED: null }); var injectedMixins = []; /** * Composite components are higher-level components that compose other composite * or native components. * * To create a new type of `ReactClass`, pass a specification of * your new class to `React.createClass`. The only requirement of your class * specification is that you implement a `render` method. * * var MyComponent = React.createClass({ * render: function() { * return <div>Hello World</div>; * } * }); * * The class specification supports a specific protocol of methods that have * special meaning (e.g. `render`). See `ReactClassInterface` for * more the comprehensive protocol. Any other properties and methods in the * class specification will available on the prototype. * * @interface ReactClassInterface * @internal */ var ReactClassInterface = { /** * An array of Mixin objects to include when defining your component. * * @type {array} * @optional */ mixins: SpecPolicy.DEFINE_MANY, /** * An object containing properties and methods that should be defined on * the component's constructor instead of its prototype (static methods). * * @type {object} * @optional */ statics: SpecPolicy.DEFINE_MANY, /** * Definition of prop types for this component. * * @type {object} * @optional */ propTypes: SpecPolicy.DEFINE_MANY, /** * Definition of context types for this component. * * @type {object} * @optional */ contextTypes: SpecPolicy.DEFINE_MANY, /** * Definition of context types this component sets for its children. * * @type {object} * @optional */ childContextTypes: SpecPolicy.DEFINE_MANY, // ==== Definition methods ==== /** * Invoked when the component is mounted. Values in the mapping will be set on * `this.props` if that prop is not specified (i.e. using an `in` check). * * This method is invoked before `getInitialState` and therefore cannot rely * on `this.state` or use `this.setState`. * * @return {object} * @optional */ getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED, /** * Invoked once before the component is mounted. The return value will be used * as the initial value of `this.state`. * * getInitialState: function() { * return { * isOn: false, * fooBaz: new BazFoo() * } * } * * @return {object} * @optional */ getInitialState: SpecPolicy.DEFINE_MANY_MERGED, /** * @return {object} * @optional */ getChildContext: SpecPolicy.DEFINE_MANY_MERGED, /** * Uses props from `this.props` and state from `this.state` to render the * structure of the component. * * No guarantees are made about when or how often this method is invoked, so * it must not have side effects. * * render: function() { * var name = this.props.name; * return <div>Hello, {name}!</div>; * } * * @return {ReactComponent} * @nosideeffects * @required */ render: SpecPolicy.DEFINE_ONCE, // ==== Delegate methods ==== /** * Invoked when the component is initially created and about to be mounted. * This may have side effects, but any external subscriptions or data created * by this method must be cleaned up in `componentWillUnmount`. * * @optional */ componentWillMount: SpecPolicy.DEFINE_MANY, /** * Invoked when the component has been mounted and has a DOM representation. * However, there is no guarantee that the DOM node is in the document. * * Use this as an opportunity to operate on the DOM when the component has * been mounted (initialized and rendered) for the first time. * * @param {DOMElement} rootNode DOM element representing the component. * @optional */ componentDidMount: SpecPolicy.DEFINE_MANY, /** * Invoked before the component receives new props. * * Use this as an opportunity to react to a prop transition by updating the * state using `this.setState`. Current props are accessed via `this.props`. * * componentWillReceiveProps: function(nextProps, nextContext) { * this.setState({ * likesIncreasing: nextProps.likeCount > this.props.likeCount * }); * } * * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop * transition may cause a state change, but the opposite is not true. If you * need it, you are probably looking for `componentWillUpdate`. * * @param {object} nextProps * @optional */ componentWillReceiveProps: SpecPolicy.DEFINE_MANY, /** * Invoked while deciding if the component should be updated as a result of * receiving new props, state and/or context. * * Use this as an opportunity to `return false` when you're certain that the * transition to the new props/state/context will not require a component * update. * * shouldComponentUpdate: function(nextProps, nextState, nextContext) { * return !equal(nextProps, this.props) || * !equal(nextState, this.state) || * !equal(nextContext, this.context); * } * * @param {object} nextProps * @param {?object} nextState * @param {?object} nextContext * @return {boolean} True if the component should update. * @optional */ shouldComponentUpdate: SpecPolicy.DEFINE_ONCE, /** * Invoked when the component is about to update due to a transition from * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` * and `nextContext`. * * Use this as an opportunity to perform preparation before an update occurs. * * NOTE: You **cannot** use `this.setState()` in this method. * * @param {object} nextProps * @param {?object} nextState * @param {?object} nextContext * @param {ReactReconcileTransaction} transaction * @optional */ componentWillUpdate: SpecPolicy.DEFINE_MANY, /** * Invoked when the component's DOM representation has been updated. * * Use this as an opportunity to operate on the DOM when the component has * been updated. * * @param {object} prevProps * @param {?object} prevState * @param {?object} prevContext * @param {DOMElement} rootNode DOM element representing the component. * @optional */ componentDidUpdate: SpecPolicy.DEFINE_MANY, /** * Invoked when the component is about to be removed from its parent and have * its DOM representation destroyed. * * Use this as an opportunity to deallocate any external resources. * * NOTE: There is no `componentDidUnmount` since your component will have been * destroyed by that point. * * @optional */ componentWillUnmount: SpecPolicy.DEFINE_MANY, // ==== Advanced methods ==== /** * Updates the component's currently mounted DOM representation. * * By default, this implements React's rendering and reconciliation algorithm. * Sophisticated clients may wish to override this. * * @param {ReactReconcileTransaction} transaction * @internal * @overridable */ updateComponent: SpecPolicy.OVERRIDE_BASE }; /** * Mapping from class specification keys to special processing functions. * * Although these are declared like instance properties in the specification * when defining classes using `React.createClass`, they are actually static * and are accessible on the constructor instead of the prototype. Despite * being static, they must be defined outside of the "statics" key under * which all other static methods are defined. */ var RESERVED_SPEC_KEYS = { displayName: function(Constructor, displayName) { Constructor.displayName = displayName; }, mixins: function(Constructor, mixins) { if (mixins) { for (var i = 0; i < mixins.length; i++) { mixSpecIntoComponent(Constructor, mixins[i]); } } }, childContextTypes: function(Constructor, childContextTypes) { if ("production" !== "development") { validateTypeDef( Constructor, childContextTypes, ReactPropTypeLocations.childContext ); } Constructor.childContextTypes = assign( {}, Constructor.childContextTypes, childContextTypes ); }, contextTypes: function(Constructor, contextTypes) { if ("production" !== "development") { validateTypeDef( Constructor, contextTypes, ReactPropTypeLocations.context ); } Constructor.contextTypes = assign( {}, Constructor.contextTypes, contextTypes ); }, /** * Special case getDefaultProps which should move into statics but requires * automatic merging. */ getDefaultProps: function(Constructor, getDefaultProps) { if (Constructor.getDefaultProps) { Constructor.getDefaultProps = createMergedResultFunction( Constructor.getDefaultProps, getDefaultProps ); } else { Constructor.getDefaultProps = getDefaultProps; } }, propTypes: function(Constructor, propTypes) { if ("production" !== "development") { validateTypeDef( Constructor, propTypes, ReactPropTypeLocations.prop ); } Constructor.propTypes = assign( {}, Constructor.propTypes, propTypes ); }, statics: function(Constructor, statics) { mixStaticSpecIntoComponent(Constructor, statics); } }; function validateTypeDef(Constructor, typeDef, location) { for (var propName in typeDef) { if (typeDef.hasOwnProperty(propName)) { // use a warning instead of an invariant so components // don't show up in prod but not in __DEV__ ("production" !== "development" ? warning( typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName ) : null); } } } function validateMethodOverride(proto, name) { var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; // Disallow overriding of base class methods unless explicitly allowed. if (ReactClassMixin.hasOwnProperty(name)) { ("production" !== "development" ? invariant( specPolicy === SpecPolicy.OVERRIDE_BASE, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name ) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE)); } // Disallow defining methods more than once unless explicitly allowed. if (proto.hasOwnProperty(name)) { ("production" !== "development" ? invariant( specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name ) : invariant(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED)); } } /** * Mixin helper which handles policy validation and reserved * specification keys when building React classses. */ function mixSpecIntoComponent(Constructor, spec) { if (!spec) { return; } ("production" !== "development" ? invariant( typeof spec !== 'function', 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.' ) : invariant(typeof spec !== 'function')); ("production" !== "development" ? invariant( !ReactElement.isValidElement(spec), 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.' ) : invariant(!ReactElement.isValidElement(spec))); var proto = Constructor.prototype; // By handling mixins before any other properties, we ensure the same // chaining order is applied to methods with DEFINE_MANY policy, whether // mixins are listed before or after these methods in the spec. if (spec.hasOwnProperty(MIXINS_KEY)) { RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); } for (var name in spec) { if (!spec.hasOwnProperty(name)) { continue; } if (name === MIXINS_KEY) { // We have already handled mixins in a special case above continue; } var property = spec[name]; validateMethodOverride(proto, name); if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { RESERVED_SPEC_KEYS[name](Constructor, property); } else { // Setup methods on prototype: // The following member methods should not be automatically bound: // 1. Expected ReactClass methods (in the "interface"). // 2. Overridden methods (that were mixed in). var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); var isAlreadyDefined = proto.hasOwnProperty(name); var markedDontBind = property && property.__reactDontBind; var isFunction = typeof property === 'function'; var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && !markedDontBind; if (shouldAutoBind) { if (!proto.__reactAutoBindMap) { proto.__reactAutoBindMap = {}; } proto.__reactAutoBindMap[name] = property; proto[name] = property; } else { if (isAlreadyDefined) { var specPolicy = ReactClassInterface[name]; // These cases should already be caught by validateMethodOverride ("production" !== "development" ? invariant( isReactClassMethod && ( (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY) ), 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name ) : invariant(isReactClassMethod && ( (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY) ))); // For methods which are defined more than once, call the existing // methods before calling the new property, merging if appropriate. if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) { proto[name] = createMergedResultFunction(proto[name], property); } else if (specPolicy === SpecPolicy.DEFINE_MANY) { proto[name] = createChainedFunction(proto[name], property); } } else { proto[name] = property; if ("production" !== "development") { // Add verbose displayName to the function, which helps when looking // at profiling tools. if (typeof property === 'function' && spec.displayName) { proto[name].displayName = spec.displayName + '_' + name; } } } } } } } function mixStaticSpecIntoComponent(Constructor, statics) { if (!statics) { return; } for (var name in statics) { var property = statics[name]; if (!statics.hasOwnProperty(name)) { continue; } var isReserved = name in RESERVED_SPEC_KEYS; ("production" !== "development" ? invariant( !isReserved, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name ) : invariant(!isReserved)); var isInherited = name in Constructor; ("production" !== "development" ? invariant( !isInherited, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name ) : invariant(!isInherited)); Constructor[name] = property; } } /** * Merge two objects, but throw if both contain the same key. * * @param {object} one The first object, which is mutated. * @param {object} two The second object * @return {object} one after it has been mutated to contain everything in two. */ function mergeIntoWithNoDuplicateKeys(one, two) { ("production" !== "development" ? invariant( one && two && typeof one === 'object' && typeof two === 'object', 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.' ) : invariant(one && two && typeof one === 'object' && typeof two === 'object')); for (var key in two) { if (two.hasOwnProperty(key)) { ("production" !== "development" ? invariant( one[key] === undefined, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key ) : invariant(one[key] === undefined)); one[key] = two[key]; } } return one; } /** * Creates a function that invokes two functions and merges their return values. * * @param {function} one Function to invoke first. * @param {function} two Function to invoke second. * @return {function} Function that invokes the two argument functions. * @private */ function createMergedResultFunction(one, two) { return function mergedResult() { var a = one.apply(this, arguments); var b = two.apply(this, arguments); if (a == null) { return b; } else if (b == null) { return a; } var c = {}; mergeIntoWithNoDuplicateKeys(c, a); mergeIntoWithNoDuplicateKeys(c, b); return c; }; } /** * Creates a function that invokes two functions and ignores their return vales. * * @param {function} one Function to invoke first. * @param {function} two Function to invoke second. * @return {function} Function that invokes the two argument functions. * @private */ function createChainedFunction(one, two) { return function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }; } /** * Binds a method to the component. * * @param {object} component Component whose method is going to be bound. * @param {function} method Method to be bound. * @return {function} The bound method. */ function bindAutoBindMethod(component, method) { var boundMethod = method.bind(component); if ("production" !== "development") { boundMethod.__reactBoundContext = component; boundMethod.__reactBoundMethod = method; boundMethod.__reactBoundArguments = null; var componentName = component.constructor.displayName; var _bind = boundMethod.bind; /* eslint-disable block-scoped-var, no-undef */ boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]); // User is trying to bind() an autobound method; we effectively will // ignore the value of "this" that the user is trying to use, so // let's warn. if (newThis !== component && newThis !== null) { ("production" !== "development" ? warning( false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName ) : null); } else if (!args.length) { ("production" !== "development" ? warning( false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName ) : null); return boundMethod; } var reboundMethod = _bind.apply(boundMethod, arguments); reboundMethod.__reactBoundContext = component; reboundMethod.__reactBoundMethod = method; reboundMethod.__reactBoundArguments = args; return reboundMethod; /* eslint-enable */ }; } return boundMethod; } /** * Binds all auto-bound methods in a component. * * @param {object} component Component whose method is going to be bound. */ function bindAutoBindMethods(component) { for (var autoBindKey in component.__reactAutoBindMap) { if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) { var method = component.__reactAutoBindMap[autoBindKey]; component[autoBindKey] = bindAutoBindMethod( component, ReactErrorUtils.guard( method, component.constructor.displayName + '.' + autoBindKey ) ); } } } var typeDeprecationDescriptor = { enumerable: false, get: function() { var displayName = this.displayName || this.name || 'Component'; ("production" !== "development" ? warning( false, '%s.type is deprecated. Use %s directly to access the class.', displayName, displayName ) : null); Object.defineProperty(this, 'type', { value: this }); return this; } }; /** * Add more to the ReactClass base class. These are all legacy features and * therefore not already part of the modern ReactComponent. */ var ReactClassMixin = { /** * TODO: This will be deprecated because state should always keep a consistent * type signature and the only use case for this, is to avoid that. */ replaceState: function(newState, callback) { ReactUpdateQueue.enqueueReplaceState(this, newState); if (callback) { ReactUpdateQueue.enqueueCallback(this, callback); } }, /** * Checks whether or not this composite component is mounted. * @return {boolean} True if mounted, false otherwise. * @protected * @final */ isMounted: function() { if ("production" !== "development") { var owner = ReactCurrentOwner.current; if (owner !== null) { ("production" !== "development" ? warning( owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component' ) : null); owner._warnedAboutRefsInRender = true; } } var internalInstance = ReactInstanceMap.get(this); return ( internalInstance && internalInstance !== ReactLifeCycle.currentlyMountingInstance ); }, /** * Sets a subset of the props. * * @param {object} partialProps Subset of the next props. * @param {?function} callback Called after props are updated. * @final * @public * @deprecated */ setProps: function(partialProps, callback) { ReactUpdateQueue.enqueueSetProps(this, partialProps); if (callback) { ReactUpdateQueue.enqueueCallback(this, callback); } }, /** * Replace all the props. * * @param {object} newProps Subset of the next props. * @param {?function} callback Called after props are updated. * @final * @public * @deprecated */ replaceProps: function(newProps, callback) { ReactUpdateQueue.enqueueReplaceProps(this, newProps); if (callback) { ReactUpdateQueue.enqueueCallback(this, callback); } } }; var ReactClassComponent = function() {}; assign( ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin ); /** * Module for creating composite components. * * @class ReactClass */ var ReactClass = { /** * Creates a composite component class given a class specification. * * @param {object} spec Class specification (which must define `render`). * @return {function} Component constructor function. * @public */ createClass: function(spec) { var Constructor = function(props, context) { // This constructor is overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if ("production" !== "development") { ("production" !== "development" ? warning( this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory' ) : null); } // Wire up auto-binding if (this.__reactAutoBindMap) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if ("production" !== "development") { // We allow auto-mocks to proceed as if they're returning null. if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } ("production" !== "development" ? invariant( typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent' ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState))); this.state = initialState; }; Constructor.prototype = new ReactClassComponent(); Constructor.prototype.constructor = Constructor; injectedMixins.forEach( mixSpecIntoComponent.bind(null, Constructor) ); mixSpecIntoComponent(Constructor, spec); // Initialize the defaultProps property after all mixins have been merged if (Constructor.getDefaultProps) { Constructor.defaultProps = Constructor.getDefaultProps(); } if ("production" !== "development") { // This is a tag to indicate that the use of these method names is ok, // since it's used with createClass. If it's not, then it's likely a // mistake so we'll warn you to use the static property, property // initializer or constructor respectively. if (Constructor.getDefaultProps) { Constructor.getDefaultProps.isReactClassApproved = {}; } if (Constructor.prototype.getInitialState) { Constructor.prototype.getInitialState.isReactClassApproved = {}; } } ("production" !== "development" ? invariant( Constructor.prototype.render, 'createClass(...): Class specification must implement a `render` method.' ) : invariant(Constructor.prototype.render)); if ("production" !== "development") { ("production" !== "development" ? warning( !Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component' ) : null); } // Reduce time spent doing lookups by setting these on the prototype. for (var methodName in ReactClassInterface) { if (!Constructor.prototype[methodName]) { Constructor.prototype[methodName] = null; } } // Legacy hook Constructor.type = Constructor; if ("production" !== "development") { try { Object.defineProperty(Constructor, 'type', typeDeprecationDescriptor); } catch (x) { // IE will fail on defineProperty (es5-shim/sham too) } } return Constructor; }, injection: { injectMixin: function(mixin) { injectedMixins.push(mixin); } } }; module.exports = ReactClass; },{"135":135,"140":140,"141":141,"154":154,"27":27,"34":34,"39":39,"57":57,"60":60,"67":67,"68":68,"76":76,"77":77,"86":86}],34:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactComponent */ 'use strict'; var ReactUpdateQueue = _dereq_(86); var invariant = _dereq_(135); var warning = _dereq_(154); /** * Base class helpers for the updating state of a component. */ function ReactComponent(props, context) { this.props = props; this.context = context; } /** * Sets a subset of the state. Always use this to mutate * state. You should treat `this.state` as immutable. * * There is no guarantee that `this.state` will be immediately updated, so * accessing `this.state` after calling this method may return the old value. * * There is no guarantee that calls to `setState` will run synchronously, * as they may eventually be batched together. You can provide an optional * callback that will be executed when the call to setState is actually * completed. * * When a function is provided to setState, it will be called at some point in * the future (not synchronously). It will be called with the up to date * component arguments (state, props, context). These values can be different * from this.* because your function may be called after receiveProps but before * shouldComponentUpdate, and this new state, props, and context will not yet be * assigned to this. * * @param {object|function} partialState Next partial state or function to * produce next partial state to be merged with current state. * @param {?function} callback Called after state is updated. * @final * @protected */ ReactComponent.prototype.setState = function(partialState, callback) { ("production" !== "development" ? invariant( typeof partialState === 'object' || typeof partialState === 'function' || partialState == null, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.' ) : invariant(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)); if ("production" !== "development") { ("production" !== "development" ? warning( partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().' ) : null); } ReactUpdateQueue.enqueueSetState(this, partialState); if (callback) { ReactUpdateQueue.enqueueCallback(this, callback); } }; /** * Forces an update. This should only be invoked when it is known with * certainty that we are **not** in a DOM transaction. * * You may want to call this when you know that some deeper aspect of the * component's state has changed but `setState` was not called. * * This will not invoke `shouldComponentUpdate`, but it will invoke * `componentWillUpdate` and `componentDidUpdate`. * * @param {?function} callback Called after update is complete. * @final * @protected */ ReactComponent.prototype.forceUpdate = function(callback) { ReactUpdateQueue.enqueueForceUpdate(this); if (callback) { ReactUpdateQueue.enqueueCallback(this, callback); } }; /** * Deprecated APIs. These APIs used to exist on classic React classes but since * we would like to deprecate them, we're not going to move them over to this * modern base class. Instead, we define a getter that warns if it's accessed. */ if ("production" !== "development") { var deprecatedAPIs = { getDOMNode: [ 'getDOMNode', 'Use React.findDOMNode(component) instead.' ], isMounted: [ 'isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.' ], replaceProps: [ 'replaceProps', 'Instead call React.render again at the top level.' ], replaceState: [ 'replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).' ], setProps: [ 'setProps', 'Instead call React.render again at the top level.' ] }; var defineDeprecationWarning = function(methodName, info) { try { Object.defineProperty(ReactComponent.prototype, methodName, { get: function() { ("production" !== "development" ? warning( false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1] ) : null); return undefined; } }); } catch (x) { // IE will fail on defineProperty (es5-shim/sham too) } }; for (var fnName in deprecatedAPIs) { if (deprecatedAPIs.hasOwnProperty(fnName)) { defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); } } } module.exports = ReactComponent; },{"135":135,"154":154,"86":86}],35:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactComponentBrowserEnvironment */ /*jslint evil: true */ 'use strict'; var ReactDOMIDOperations = _dereq_(44); var ReactMount = _dereq_(70); /** * Abstracts away all functionality of the reconciler that requires knowledge of * the browser context. TODO: These callers should be refactored to avoid the * need for this injection. */ var ReactComponentBrowserEnvironment = { processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates, replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID, /** * If a particular environment requires that some resources be cleaned up, * specify this in the injected Mixin. In the DOM, we would likely want to * purge any cached node ID lookups. * * @private */ unmountIDFromEnvironment: function(rootNodeID) { ReactMount.purgeID(rootNodeID); } }; module.exports = ReactComponentBrowserEnvironment; },{"44":44,"70":70}],36:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactComponentEnvironment */ 'use strict'; var invariant = _dereq_(135); var injected = false; var ReactComponentEnvironment = { /** * Optionally injectable environment dependent cleanup hook. (server vs. * browser etc). Example: A browser system caches DOM nodes based on component * ID and must remove that cache entry when this instance is unmounted. */ unmountIDFromEnvironment: null, /** * Optionally injectable hook for swapping out mount images in the middle of * the tree. */ replaceNodeWithMarkupByID: null, /** * Optionally injectable hook for processing a queue of child updates. Will * later move into MultiChildComponents. */ processChildrenUpdates: null, injection: { injectEnvironment: function(environment) { ("production" !== "development" ? invariant( !injected, 'ReactCompositeComponent: injectEnvironment() can only be called once.' ) : invariant(!injected)); ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment; ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID; ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates; injected = true; } } }; module.exports = ReactComponentEnvironment; },{"135":135}],37:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactCompositeComponent */ 'use strict'; var ReactComponentEnvironment = _dereq_(36); var ReactContext = _dereq_(38); var ReactCurrentOwner = _dereq_(39); var ReactElement = _dereq_(57); var ReactElementValidator = _dereq_(58); var ReactInstanceMap = _dereq_(67); var ReactLifeCycle = _dereq_(68); var ReactNativeComponent = _dereq_(73); var ReactPerf = _dereq_(75); var ReactPropTypeLocations = _dereq_(77); var ReactPropTypeLocationNames = _dereq_(76); var ReactReconciler = _dereq_(81); var ReactUpdates = _dereq_(87); var assign = _dereq_(27); var emptyObject = _dereq_(115); var invariant = _dereq_(135); var shouldUpdateReactComponent = _dereq_(151); var warning = _dereq_(154); function getDeclarationErrorAddendum(component) { var owner = component._currentElement._owner || null; if (owner) { var name = owner.getName(); if (name) { return ' Check the render method of `' + name + '`.'; } } return ''; } /** * ------------------ The Life-Cycle of a Composite Component ------------------ * * - constructor: Initialization of state. The instance is now retained. * - componentWillMount * - render * - [children's constructors] * - [children's componentWillMount and render] * - [children's componentDidMount] * - componentDidMount * * Update Phases: * - componentWillReceiveProps (only called if parent updated) * - shouldComponentUpdate * - componentWillUpdate * - render * - [children's constructors or receive props phases] * - componentDidUpdate * * - componentWillUnmount * - [children's componentWillUnmount] * - [children destroyed] * - (destroyed): The instance is now blank, released by React and ready for GC. * * ----------------------------------------------------------------------------- */ /** * An incrementing ID assigned to each component when it is mounted. This is * used to enforce the order in which `ReactUpdates` updates dirty components. * * @private */ var nextMountID = 1; /** * @lends {ReactCompositeComponent.prototype} */ var ReactCompositeComponentMixin = { /** * Base constructor for all composite component. * * @param {ReactElement} element * @final * @internal */ construct: function(element) { this._currentElement = element; this._rootNodeID = null; this._instance = null; // See ReactUpdateQueue this._pendingElement = null; this._pendingStateQueue = null; this._pendingReplaceState = false; this._pendingForceUpdate = false; this._renderedComponent = null; this._context = null; this._mountOrder = 0; this._isTopLevel = false; // See ReactUpdates and ReactUpdateQueue. this._pendingCallbacks = null; }, /** * Initializes the component, renders markup, and registers event listeners. * * @param {string} rootID DOM ID of the root node. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction * @return {?string} Rendered markup to be inserted into the DOM. * @final * @internal */ mountComponent: function(rootID, transaction, context) { this._context = context; this._mountOrder = nextMountID++; this._rootNodeID = rootID; var publicProps = this._processProps(this._currentElement.props); var publicContext = this._processContext(this._currentElement._context); var Component = ReactNativeComponent.getComponentClassForElement( this._currentElement ); // Initialize the public class var inst = new Component(publicProps, publicContext); if ("production" !== "development") { // This will throw later in _renderValidatedComponent, but add an early // warning now to help debugging ("production" !== "development" ? warning( inst.render != null, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render` in your ' + 'component or you may have accidentally tried to render an element ' + 'whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component' ) : null); } // These should be set up in the constructor, but as a convenience for // simpler class abstractions, we set them up after the fact. inst.props = publicProps; inst.context = publicContext; inst.refs = emptyObject; this._instance = inst; // Store a reference from the instance back to the internal representation ReactInstanceMap.set(inst, this); if ("production" !== "development") { this._warnIfContextsDiffer(this._currentElement._context, context); } if ("production" !== "development") { // Since plain JS classes are defined without any special initialization // logic, we can not catch common errors early. Therefore, we have to // catch them here, at initialization time, instead. ("production" !== "development" ? warning( !inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component' ) : null); ("production" !== "development" ? warning( !inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component' ) : null); ("production" !== "development" ? warning( !inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component' ) : null); ("production" !== "development" ? warning( !inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component' ) : null); ("production" !== "development" ? warning( typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', (this.getName() || 'A component') ) : null); } var initialState = inst.state; if (initialState === undefined) { inst.state = initialState = null; } ("production" !== "development" ? invariant( typeof initialState === 'object' && !Array.isArray(initialState), '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent' ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState))); this._pendingStateQueue = null; this._pendingReplaceState = false; this._pendingForceUpdate = false; var childContext; var renderedElement; var previouslyMounting = ReactLifeCycle.currentlyMountingInstance; ReactLifeCycle.currentlyMountingInstance = this; try { if (inst.componentWillMount) { inst.componentWillMount(); // When mounting, calls to `setState` by `componentWillMount` will set // `this._pendingStateQueue` without triggering a re-render. if (this._pendingStateQueue) { inst.state = this._processPendingState(inst.props, inst.context); } } childContext = this._getValidatedChildContext(context); renderedElement = this._renderValidatedComponent(childContext); } finally { ReactLifeCycle.currentlyMountingInstance = previouslyMounting; } this._renderedComponent = this._instantiateReactComponent( renderedElement, this._currentElement.type // The wrapping type ); var markup = ReactReconciler.mountComponent( this._renderedComponent, rootID, transaction, this._mergeChildContext(context, childContext) ); if (inst.componentDidMount) { transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); } return markup; }, /** * Releases any resources allocated by `mountComponent`. * * @final * @internal */ unmountComponent: function() { var inst = this._instance; if (inst.componentWillUnmount) { var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance; ReactLifeCycle.currentlyUnmountingInstance = this; try { inst.componentWillUnmount(); } finally { ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting; } } ReactReconciler.unmountComponent(this._renderedComponent); this._renderedComponent = null; // Reset pending fields this._pendingStateQueue = null; this._pendingReplaceState = false; this._pendingForceUpdate = false; this._pendingCallbacks = null; this._pendingElement = null; // These fields do not really need to be reset since this object is no // longer accessible. this._context = null; this._rootNodeID = null; // Delete the reference from the instance to this internal representation // which allow the internals to be properly cleaned up even if the user // leaks a reference to the public instance. ReactInstanceMap.remove(inst); // Some existing components rely on inst.props even after they've been // destroyed (in event handlers). // TODO: inst.props = null; // TODO: inst.state = null; // TODO: inst.context = null; }, /** * Schedule a partial update to the props. Only used for internal testing. * * @param {object} partialProps Subset of the next props. * @param {?function} callback Called after props are updated. * @final * @internal */ _setPropsInternal: function(partialProps, callback) { // This is a deoptimized path. We optimize for always having an element. // This creates an extra internal element. var element = this._pendingElement || this._currentElement; this._pendingElement = ReactElement.cloneAndReplaceProps( element, assign({}, element.props, partialProps) ); ReactUpdates.enqueueUpdate(this, callback); }, /** * Filters the context object to only contain keys specified in * `contextTypes` * * @param {object} context * @return {?object} * @private */ _maskContext: function(context) { var maskedContext = null; // This really should be getting the component class for the element, // but we know that we're not going to need it for built-ins. if (typeof this._currentElement.type === 'string') { return emptyObject; } var contextTypes = this._currentElement.type.contextTypes; if (!contextTypes) { return emptyObject; } maskedContext = {}; for (var contextName in contextTypes) { maskedContext[contextName] = context[contextName]; } return maskedContext; }, /** * Filters the context object to only contain keys specified in * `contextTypes`, and asserts that they are valid. * * @param {object} context * @return {?object} * @private */ _processContext: function(context) { var maskedContext = this._maskContext(context); if ("production" !== "development") { var Component = ReactNativeComponent.getComponentClassForElement( this._currentElement ); if (Component.contextTypes) { this._checkPropTypes( Component.contextTypes, maskedContext, ReactPropTypeLocations.context ); } } return maskedContext; }, /** * @param {object} currentContext * @return {object} * @private */ _getValidatedChildContext: function(currentContext) { var inst = this._instance; var childContext = inst.getChildContext && inst.getChildContext(); if (childContext) { ("production" !== "development" ? invariant( typeof inst.constructor.childContextTypes === 'object', '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent' ) : invariant(typeof inst.constructor.childContextTypes === 'object')); if ("production" !== "development") { this._checkPropTypes( inst.constructor.childContextTypes, childContext, ReactPropTypeLocations.childContext ); } for (var name in childContext) { ("production" !== "development" ? invariant( name in inst.constructor.childContextTypes, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name ) : invariant(name in inst.constructor.childContextTypes)); } return childContext; } return null; }, _mergeChildContext: function(currentContext, childContext) { if (childContext) { return assign({}, currentContext, childContext); } return currentContext; }, /** * Processes props by setting default values for unspecified props and * asserting that the props are valid. Does not mutate its argument; returns * a new props object with defaults merged in. * * @param {object} newProps * @return {object} * @private */ _processProps: function(newProps) { if ("production" !== "development") { var Component = ReactNativeComponent.getComponentClassForElement( this._currentElement ); if (Component.propTypes) { this._checkPropTypes( Component.propTypes, newProps, ReactPropTypeLocations.prop ); } } return newProps; }, /** * Assert that the props are valid * * @param {object} propTypes Map of prop name to a ReactPropType * @param {object} props * @param {string} location e.g. "prop", "context", "child context" * @private */ _checkPropTypes: function(propTypes, props, location) { // TODO: Stop validating prop types here and only use the element // validation. var componentName = this.getName(); for (var propName in propTypes) { if (propTypes.hasOwnProperty(propName)) { var error; try { // This is intentionally an invariant that gets caught. It's the same // behavior as without this statement except with a better message. ("production" !== "development" ? invariant( typeof propTypes[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName ) : invariant(typeof propTypes[propName] === 'function')); error = propTypes[propName](props, propName, componentName, location); } catch (ex) { error = ex; } if (error instanceof Error) { // We may want to extend this logic for similar errors in // React.render calls, so I'm abstracting it away into // a function to minimize refactoring in the future var addendum = getDeclarationErrorAddendum(this); if (location === ReactPropTypeLocations.prop) { // Preface gives us something to blacklist in warning module ("production" !== "development" ? warning( false, 'Failed Composite propType: %s%s', error.message, addendum ) : null); } else { ("production" !== "development" ? warning( false, 'Failed Context Types: %s%s', error.message, addendum ) : null); } } } } }, receiveComponent: function(nextElement, transaction, nextContext) { var prevElement = this._currentElement; var prevContext = this._context; this._pendingElement = null; this.updateComponent( transaction, prevElement, nextElement, prevContext, nextContext ); }, /** * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate` * is set, update the component. * * @param {ReactReconcileTransaction} transaction * @internal */ performUpdateIfNecessary: function(transaction) { if (this._pendingElement != null) { ReactReconciler.receiveComponent( this, this._pendingElement || this._currentElement, transaction, this._context ); } if (this._pendingStateQueue !== null || this._pendingForceUpdate) { if ("production" !== "development") { ReactElementValidator.checkAndWarnForMutatedProps( this._currentElement ); } this.updateComponent( transaction, this._currentElement, this._currentElement, this._context, this._context ); } }, /** * Compare two contexts, warning if they are different * TODO: Remove this check when owner-context is removed */ _warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) { ownerBasedContext = this._maskContext(ownerBasedContext); parentBasedContext = this._maskContext(parentBasedContext); var parentKeys = Object.keys(parentBasedContext).sort(); var displayName = this.getName() || 'ReactCompositeComponent'; for (var i = 0; i < parentKeys.length; i++) { var key = parentKeys[i]; ("production" !== "development" ? warning( ownerBasedContext[key] === parentBasedContext[key], 'owner-based and parent-based contexts differ ' + '(values: `%s` vs `%s`) for key (%s) while mounting %s ' + '(see: http://fb.me/react-context-by-parent)', ownerBasedContext[key], parentBasedContext[key], key, displayName ) : null); } }, /** * Perform an update to a mounted component. The componentWillReceiveProps and * shouldComponentUpdate methods are called, then (assuming the update isn't * skipped) the remaining update lifecycle methods are called and the DOM * representation is updated. * * By default, this implements React's rendering and reconciliation algorithm. * Sophisticated clients may wish to override this. * * @param {ReactReconcileTransaction} transaction * @param {ReactElement} prevParentElement * @param {ReactElement} nextParentElement * @internal * @overridable */ updateComponent: function( transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext ) { var inst = this._instance; var nextContext = inst.context; var nextProps = inst.props; // Distinguish between a props update versus a simple state update if (prevParentElement !== nextParentElement) { nextContext = this._processContext(nextParentElement._context); nextProps = this._processProps(nextParentElement.props); if ("production" !== "development") { if (nextUnmaskedContext != null) { this._warnIfContextsDiffer( nextParentElement._context, nextUnmaskedContext ); } } // An update here will schedule an update but immediately set // _pendingStateQueue which will ensure that any state updates gets // immediately reconciled instead of waiting for the next batch. if (inst.componentWillReceiveProps) { inst.componentWillReceiveProps(nextProps, nextContext); } } var nextState = this._processPendingState(nextProps, nextContext); var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext); if ("production" !== "development") { ("production" !== "development" ? warning( typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent' ) : null); } if (shouldUpdate) { this._pendingForceUpdate = false; // Will set `this.props`, `this.state` and `this.context`. this._performComponentUpdate( nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext ); } else { // If it's determined that a component should not update, we still want // to set props and state but we shortcut the rest of the update. this._currentElement = nextParentElement; this._context = nextUnmaskedContext; inst.props = nextProps; inst.state = nextState; inst.context = nextContext; } }, _processPendingState: function(props, context) { var inst = this._instance; var queue = this._pendingStateQueue; var replace = this._pendingReplaceState; this._pendingReplaceState = false; this._pendingStateQueue = null; if (!queue) { return inst.state; } if (replace && queue.length === 1) { return queue[0]; } var nextState = assign({}, replace ? queue[0] : inst.state); for (var i = replace ? 1 : 0; i < queue.length; i++) { var partial = queue[i]; assign( nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial ); } return nextState; }, /** * Merges new props and state, notifies delegate methods of update and * performs update. * * @param {ReactElement} nextElement Next element * @param {object} nextProps Next public object to set as properties. * @param {?object} nextState Next object to set as state. * @param {?object} nextContext Next public object to set as context. * @param {ReactReconcileTransaction} transaction * @param {?object} unmaskedContext * @private */ _performComponentUpdate: function( nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext ) { var inst = this._instance; var prevProps = inst.props; var prevState = inst.state; var prevContext = inst.context; if (inst.componentWillUpdate) { inst.componentWillUpdate(nextProps, nextState, nextContext); } this._currentElement = nextElement; this._context = unmaskedContext; inst.props = nextProps; inst.state = nextState; inst.context = nextContext; this._updateRenderedComponent(transaction, unmaskedContext); if (inst.componentDidUpdate) { transaction.getReactMountReady().enqueue( inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst ); } }, /** * Call the component's `render` method and update the DOM accordingly. * * @param {ReactReconcileTransaction} transaction * @internal */ _updateRenderedComponent: function(transaction, context) { var prevComponentInstance = this._renderedComponent; var prevRenderedElement = prevComponentInstance._currentElement; var childContext = this._getValidatedChildContext(); var nextRenderedElement = this._renderValidatedComponent(childContext); if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { ReactReconciler.receiveComponent( prevComponentInstance, nextRenderedElement, transaction, this._mergeChildContext(context, childContext) ); } else { // These two IDs are actually the same! But nothing should rely on that. var thisID = this._rootNodeID; var prevComponentID = prevComponentInstance._rootNodeID; ReactReconciler.unmountComponent(prevComponentInstance); this._renderedComponent = this._instantiateReactComponent( nextRenderedElement, this._currentElement.type ); var nextMarkup = ReactReconciler.mountComponent( this._renderedComponent, thisID, transaction, this._mergeChildContext(context, childContext) ); this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup); } }, /** * @protected */ _replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) { ReactComponentEnvironment.replaceNodeWithMarkupByID( prevComponentID, nextMarkup ); }, /** * @protected */ _renderValidatedComponentWithoutOwnerOrContext: function() { var inst = this._instance; var renderedComponent = inst.render(); if ("production" !== "development") { // We allow auto-mocks to proceed as if they're returning null. if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. renderedComponent = null; } } return renderedComponent; }, /** * @private */ _renderValidatedComponent: function(childContext) { var renderedComponent; var previousContext = ReactContext.current; ReactContext.current = this._mergeChildContext( this._currentElement._context, childContext ); ReactCurrentOwner.current = this; try { renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); } finally { ReactContext.current = previousContext; ReactCurrentOwner.current = null; } ("production" !== "development" ? invariant( // TODO: An `isValidNode` function would probably be more appropriate renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent), '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent' ) : invariant(// TODO: An `isValidNode` function would probably be more appropriate renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent))); return renderedComponent; }, /** * Lazily allocates the refs object and stores `component` as `ref`. * * @param {string} ref Reference name. * @param {component} component Component to store as `ref`. * @final * @private */ attachRef: function(ref, component) { var inst = this.getPublicInstance(); var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs; refs[ref] = component.getPublicInstance(); }, /** * Detaches a reference name. * * @param {string} ref Name to dereference. * @final * @private */ detachRef: function(ref) { var refs = this.getPublicInstance().refs; delete refs[ref]; }, /** * Get a text description of the component that can be used to identify it * in error messages. * @return {string} The name or null. * @internal */ getName: function() { var type = this._currentElement.type; var constructor = this._instance && this._instance.constructor; return ( type.displayName || (constructor && constructor.displayName) || type.name || (constructor && constructor.name) || null ); }, /** * Get the publicly accessible representation of this component - i.e. what * is exposed by refs and returned by React.render. Can be null for stateless * components. * * @return {ReactComponent} the public component instance. * @internal */ getPublicInstance: function() { return this._instance; }, // Stub _instantiateReactComponent: null }; ReactPerf.measureMethods( ReactCompositeComponentMixin, 'ReactCompositeComponent', { mountComponent: 'mountComponent', updateComponent: 'updateComponent', _renderValidatedComponent: '_renderValidatedComponent' } ); var ReactCompositeComponent = { Mixin: ReactCompositeComponentMixin }; module.exports = ReactCompositeComponent; },{"115":115,"135":135,"151":151,"154":154,"27":27,"36":36,"38":38,"39":39,"57":57,"58":58,"67":67,"68":68,"73":73,"75":75,"76":76,"77":77,"81":81,"87":87}],38:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactContext */ 'use strict'; var assign = _dereq_(27); var emptyObject = _dereq_(115); var warning = _dereq_(154); var didWarn = false; /** * Keeps track of the current context. * * The context is automatically passed down the component ownership hierarchy * and is accessible via `this.context` on ReactCompositeComponents. */ var ReactContext = { /** * @internal * @type {object} */ current: emptyObject, /** * Temporarily extends the current context while executing scopedCallback. * * A typical use case might look like * * render: function() { * var children = ReactContext.withContext({foo: 'foo'}, () => ( * * )); * return <div>{children}</div>; * } * * @param {object} newContext New context to merge into the existing context * @param {function} scopedCallback Callback to run with the new context * @return {ReactComponent|array<ReactComponent>} */ withContext: function(newContext, scopedCallback) { if ("production" !== "development") { ("production" !== "development" ? warning( didWarn, 'withContext is deprecated and will be removed in a future version. ' + 'Use a wrapper component with getChildContext instead.' ) : null); didWarn = true; } var result; var previousContext = ReactContext.current; ReactContext.current = assign({}, previousContext, newContext); try { result = scopedCallback(); } finally { ReactContext.current = previousContext; } return result; } }; module.exports = ReactContext; },{"115":115,"154":154,"27":27}],39:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactCurrentOwner */ 'use strict'; /** * Keeps track of the current owner. * * The current owner is the component who should own any components that are * currently being constructed. * * The depth indicate how many composite components are above this render level. */ var ReactCurrentOwner = { /** * @internal * @type {ReactComponent} */ current: null }; module.exports = ReactCurrentOwner; },{}],40:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOM * @typechecks static-only */ 'use strict'; var ReactElement = _dereq_(57); var ReactElementValidator = _dereq_(58); var mapObject = _dereq_(142); /** * Create a factory that creates HTML tag elements. * * @param {string} tag Tag name (e.g. `div`). * @private */ function createDOMFactory(tag) { if ("production" !== "development") { return ReactElementValidator.createFactory(tag); } return ReactElement.createFactory(tag); } /** * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. * This is also accessible via `React.DOM`. * * @public */ var ReactDOM = mapObject({ a: 'a', abbr: 'abbr', address: 'address', area: 'area', article: 'article', aside: 'aside', audio: 'audio', b: 'b', base: 'base', bdi: 'bdi', bdo: 'bdo', big: 'big', blockquote: 'blockquote', body: 'body', br: 'br', button: 'button', canvas: 'canvas', caption: 'caption', cite: 'cite', code: 'code', col: 'col', colgroup: 'colgroup', data: 'data', datalist: 'datalist', dd: 'dd', del: 'del', details: 'details', dfn: 'dfn', dialog: 'dialog', div: 'div', dl: 'dl', dt: 'dt', em: 'em', embed: 'embed', fieldset: 'fieldset', figcaption: 'figcaption', figure: 'figure', footer: 'footer', form: 'form', h1: 'h1', h2: 'h2', h3: 'h3', h4: 'h4', h5: 'h5', h6: 'h6', head: 'head', header: 'header', hr: 'hr', html: 'html', i: 'i', iframe: 'iframe', img: 'img', input: 'input', ins: 'ins', kbd: 'kbd', keygen: 'keygen', label: 'label', legend: 'legend', li: 'li', link: 'link', main: 'main', map: 'map', mark: 'mark', menu: 'menu', menuitem: 'menuitem', meta: 'meta', meter: 'meter', nav: 'nav', noscript: 'noscript', object: 'object', ol: 'ol', optgroup: 'optgroup', option: 'option', output: 'output', p: 'p', param: 'param', picture: 'picture', pre: 'pre', progress: 'progress', q: 'q', rp: 'rp', rt: 'rt', ruby: 'ruby', s: 's', samp: 'samp', script: 'script', section: 'section', select: 'select', small: 'small', source: 'source', span: 'span', strong: 'strong', style: 'style', sub: 'sub', summary: 'summary', sup: 'sup', table: 'table', tbody: 'tbody', td: 'td', textarea: 'textarea', tfoot: 'tfoot', th: 'th', thead: 'thead', time: 'time', title: 'title', tr: 'tr', track: 'track', u: 'u', ul: 'ul', 'var': 'var', video: 'video', wbr: 'wbr', // SVG circle: 'circle', clipPath: 'clipPath', defs: 'defs', ellipse: 'ellipse', g: 'g', line: 'line', linearGradient: 'linearGradient', mask: 'mask', path: 'path', pattern: 'pattern', polygon: 'polygon', polyline: 'polyline', radialGradient: 'radialGradient', rect: 'rect', stop: 'stop', svg: 'svg', text: 'text', tspan: 'tspan' }, createDOMFactory); module.exports = ReactDOM; },{"142":142,"57":57,"58":58}],41:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMButton */ 'use strict'; var AutoFocusMixin = _dereq_(2); var ReactBrowserComponentMixin = _dereq_(29); var ReactClass = _dereq_(33); var ReactElement = _dereq_(57); var keyMirror = _dereq_(140); var button = ReactElement.createFactory('button'); var mouseListenerNames = keyMirror({ onClick: true, onDoubleClick: true, onMouseDown: true, onMouseMove: true, onMouseUp: true, onClickCapture: true, onDoubleClickCapture: true, onMouseDownCapture: true, onMouseMoveCapture: true, onMouseUpCapture: true }); /** * Implements a <button> native component that does not receive mouse events * when `disabled` is set. */ var ReactDOMButton = ReactClass.createClass({ displayName: 'ReactDOMButton', tagName: 'BUTTON', mixins: [AutoFocusMixin, ReactBrowserComponentMixin], render: function() { var props = {}; // Copy the props; except the mouse listeners if we're disabled for (var key in this.props) { if (this.props.hasOwnProperty(key) && (!this.props.disabled || !mouseListenerNames[key])) { props[key] = this.props[key]; } } return button(props, this.props.children); } }); module.exports = ReactDOMButton; },{"140":140,"2":2,"29":29,"33":33,"57":57}],42:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMComponent * @typechecks static-only */ /* global hasOwnProperty:true */ 'use strict'; var CSSPropertyOperations = _dereq_(5); var DOMProperty = _dereq_(10); var DOMPropertyOperations = _dereq_(11); var ReactBrowserEventEmitter = _dereq_(30); var ReactComponentBrowserEnvironment = _dereq_(35); var ReactMount = _dereq_(70); var ReactMultiChild = _dereq_(71); var ReactPerf = _dereq_(75); var assign = _dereq_(27); var escapeTextContentForBrowser = _dereq_(116); var invariant = _dereq_(135); var isEventSupported = _dereq_(136); var keyOf = _dereq_(141); var warning = _dereq_(154); var deleteListener = ReactBrowserEventEmitter.deleteListener; var listenTo = ReactBrowserEventEmitter.listenTo; var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules; // For quickly matching children type, to test if can be treated as content. var CONTENT_TYPES = {'string': true, 'number': true}; var STYLE = keyOf({style: null}); var ELEMENT_NODE_TYPE = 1; /** * Optionally injectable operations for mutating the DOM */ var BackendIDOperations = null; /** * @param {?object} props */ function assertValidProps(props) { if (!props) { return; } // Note the use of `==` which checks for null or undefined. if (props.dangerouslySetInnerHTML != null) { ("production" !== "development" ? invariant( props.children == null, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.' ) : invariant(props.children == null)); ("production" !== "development" ? invariant( typeof props.dangerouslySetInnerHTML === 'object' && '__html' in props.dangerouslySetInnerHTML, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.' ) : invariant(typeof props.dangerouslySetInnerHTML === 'object' && '__html' in props.dangerouslySetInnerHTML)); } if ("production" !== "development") { ("production" !== "development" ? warning( props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.' ) : null); ("production" !== "development" ? warning( !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.' ) : null); } ("production" !== "development" ? invariant( props.style == null || typeof props.style === 'object', 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.' ) : invariant(props.style == null || typeof props.style === 'object')); } function putListener(id, registrationName, listener, transaction) { if ("production" !== "development") { // IE8 has no API for event capturing and the `onScroll` event doesn't // bubble. ("production" !== "development" ? warning( registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event' ) : null); } var container = ReactMount.findReactContainerForID(id); if (container) { var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container; listenTo(registrationName, doc); } transaction.getPutListenerQueue().enqueuePutListener( id, registrationName, listener ); } // For HTML, certain tags should omit their close tag. We keep a whitelist for // those special cased tags. var omittedCloseTags = { 'area': true, 'base': true, 'br': true, 'col': true, 'embed': true, 'hr': true, 'img': true, 'input': true, 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true, 'track': true, 'wbr': true // NOTE: menuitem's close tag should be omitted, but that causes problems. }; // We accept any tag to be rendered but since this gets injected into abitrary // HTML, we want to make sure that it's a safe tag. // http://www.w3.org/TR/REC-xml/#NT-Name var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset var validatedTagCache = {}; var hasOwnProperty = {}.hasOwnProperty; function validateDangerousTag(tag) { if (!hasOwnProperty.call(validatedTagCache, tag)) { ("production" !== "development" ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag))); validatedTagCache[tag] = true; } } /** * Creates a new React class that is idempotent and capable of containing other * React components. It accepts event listeners and DOM properties that are * valid according to `DOMProperty`. * * - Event listeners: `onClick`, `onMouseDown`, etc. * - DOM properties: `className`, `name`, `title`, etc. * * The `style` property functions differently from the DOM API. It accepts an * object mapping of style properties to values. * * @constructor ReactDOMComponent * @extends ReactMultiChild */ function ReactDOMComponent(tag) { validateDangerousTag(tag); this._tag = tag; this._renderedChildren = null; this._previousStyleCopy = null; this._rootNodeID = null; } ReactDOMComponent.displayName = 'ReactDOMComponent'; ReactDOMComponent.Mixin = { construct: function(element) { this._currentElement = element; }, /** * Generates root tag markup then recurses. This method has side effects and * is not idempotent. * * @internal * @param {string} rootID The root DOM ID for this node. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction * @return {string} The computed markup. */ mountComponent: function(rootID, transaction, context) { this._rootNodeID = rootID; assertValidProps(this._currentElement.props); var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>'; return ( this._createOpenTagMarkupAndPutListeners(transaction) + this._createContentMarkup(transaction, context) + closeTag ); }, /** * Creates markup for the open tag and all attributes. * * This method has side effects because events get registered. * * Iterating over object properties is faster than iterating over arrays. * @see http://jsperf.com/obj-vs-arr-iteration * * @private * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction * @return {string} Markup of opening tag. */ _createOpenTagMarkupAndPutListeners: function(transaction) { var props = this._currentElement.props; var ret = '<' + this._tag; for (var propKey in props) { if (!props.hasOwnProperty(propKey)) { continue; } var propValue = props[propKey]; if (propValue == null) { continue; } if (registrationNameModules.hasOwnProperty(propKey)) { putListener(this._rootNodeID, propKey, propValue, transaction); } else { if (propKey === STYLE) { if (propValue) { propValue = this._previousStyleCopy = assign({}, props.style); } propValue = CSSPropertyOperations.createMarkupForStyles(propValue); } var markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue); if (markup) { ret += ' ' + markup; } } } // For static pages, no need to put React ID and checksum. Saves lots of // bytes. if (transaction.renderToStaticMarkup) { return ret + '>'; } var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID); return ret + ' ' + markupForID + '>'; }, /** * Creates markup for the content between the tags. * * @private * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction * @param {object} context * @return {string} Content markup. */ _createContentMarkup: function(transaction, context) { var prefix = ''; if (this._tag === 'listing' || this._tag === 'pre' || this._tag === 'textarea') { // Add an initial newline because browsers ignore the first newline in // a <listing>, <pre>, or <textarea> as an "authoring convenience" -- see // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody. prefix = '\n'; } var props = this._currentElement.props; // Intentional use of != to avoid catching zero/false. var innerHTML = props.dangerouslySetInnerHTML; if (innerHTML != null) { if (innerHTML.__html != null) { return prefix + innerHTML.__html; } } else { var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; var childrenToUse = contentToUse != null ? null : props.children; if (contentToUse != null) { return prefix + escapeTextContentForBrowser(contentToUse); } else if (childrenToUse != null) { var mountImages = this.mountChildren( childrenToUse, transaction, context ); return prefix + mountImages.join(''); } } return prefix; }, receiveComponent: function(nextElement, transaction, context) { var prevElement = this._currentElement; this._currentElement = nextElement; this.updateComponent(transaction, prevElement, nextElement, context); }, /** * Updates a native DOM component after it has already been allocated and * attached to the DOM. Reconciles the root DOM node, then recurses. * * @param {ReactReconcileTransaction} transaction * @param {ReactElement} prevElement * @param {ReactElement} nextElement * @internal * @overridable */ updateComponent: function(transaction, prevElement, nextElement, context) { assertValidProps(this._currentElement.props); this._updateDOMProperties(prevElement.props, transaction); this._updateDOMChildren(prevElement.props, transaction, context); }, /** * Reconciles the properties by detecting differences in property values and * updating the DOM as necessary. This function is probably the single most * critical path for performance optimization. * * TODO: Benchmark whether checking for changed values in memory actually * improves performance (especially statically positioned elements). * TODO: Benchmark the effects of putting this at the top since 99% of props * do not change for a given reconciliation. * TODO: Benchmark areas that can be improved with caching. * * @private * @param {object} lastProps * @param {ReactReconcileTransaction} transaction */ _updateDOMProperties: function(lastProps, transaction) { var nextProps = this._currentElement.props; var propKey; var styleName; var styleUpdates; for (propKey in lastProps) { if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) { continue; } if (propKey === STYLE) { var lastStyle = this._previousStyleCopy; for (styleName in lastStyle) { if (lastStyle.hasOwnProperty(styleName)) { styleUpdates = styleUpdates || {}; styleUpdates[styleName] = ''; } } this._previousStyleCopy = null; } else if (registrationNameModules.hasOwnProperty(propKey)) { deleteListener(this._rootNodeID, propKey); } else if ( DOMProperty.isStandardName[propKey] || DOMProperty.isCustomAttribute(propKey)) { BackendIDOperations.deletePropertyByID( this._rootNodeID, propKey ); } } for (propKey in nextProps) { var nextProp = nextProps[propKey]; var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey]; if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) { continue; } if (propKey === STYLE) { if (nextProp) { nextProp = this._previousStyleCopy = assign({}, nextProp); } else { this._previousStyleCopy = null; } if (lastProp) { // Unset styles on `lastProp` but not on `nextProp`. for (styleName in lastProp) { if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) { styleUpdates = styleUpdates || {}; styleUpdates[styleName] = ''; } } // Update styles that changed since `lastProp`. for (styleName in nextProp) { if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) { styleUpdates = styleUpdates || {}; styleUpdates[styleName] = nextProp[styleName]; } } } else { // Relies on `updateStylesByID` not mutating `styleUpdates`. styleUpdates = nextProp; } } else if (registrationNameModules.hasOwnProperty(propKey)) { putListener(this._rootNodeID, propKey, nextProp, transaction); } else if ( DOMProperty.isStandardName[propKey] || DOMProperty.isCustomAttribute(propKey)) { BackendIDOperations.updatePropertyByID( this._rootNodeID, propKey, nextProp ); } } if (styleUpdates) { BackendIDOperations.updateStylesByID( this._rootNodeID, styleUpdates ); } }, /** * Reconciles the children with the various properties that affect the * children content. * * @param {object} lastProps * @param {ReactReconcileTransaction} transaction */ _updateDOMChildren: function(lastProps, transaction, context) { var nextProps = this._currentElement.props; var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null; var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null; var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html; var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html; // Note the use of `!=` which checks for null or undefined. var lastChildren = lastContent != null ? null : lastProps.children; var nextChildren = nextContent != null ? null : nextProps.children; // If we're switching from children to content/html or vice versa, remove // the old content var lastHasContentOrHtml = lastContent != null || lastHtml != null; var nextHasContentOrHtml = nextContent != null || nextHtml != null; if (lastChildren != null && nextChildren == null) { this.updateChildren(null, transaction, context); } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { this.updateTextContent(''); } if (nextContent != null) { if (lastContent !== nextContent) { this.updateTextContent('' + nextContent); } } else if (nextHtml != null) { if (lastHtml !== nextHtml) { BackendIDOperations.updateInnerHTMLByID( this._rootNodeID, nextHtml ); } } else if (nextChildren != null) { this.updateChildren(nextChildren, transaction, context); } }, /** * Destroys all event registrations for this instance. Does not remove from * the DOM. That must be done by the parent. * * @internal */ unmountComponent: function() { this.unmountChildren(); ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID); ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID); this._rootNodeID = null; } }; ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', { mountComponent: 'mountComponent', updateComponent: 'updateComponent' }); assign( ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin ); ReactDOMComponent.injection = { injectIDOperations: function(IDOperations) { ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations; } }; module.exports = ReactDOMComponent; },{"10":10,"11":11,"116":116,"135":135,"136":136,"141":141,"154":154,"27":27,"30":30,"35":35,"5":5,"70":70,"71":71,"75":75}],43:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMForm */ 'use strict'; var EventConstants = _dereq_(15); var LocalEventTrapMixin = _dereq_(25); var ReactBrowserComponentMixin = _dereq_(29); var ReactClass = _dereq_(33); var ReactElement = _dereq_(57); var form = ReactElement.createFactory('form'); /** * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need * to capture it on the <form> element itself. There are lots of hacks we could * do to accomplish this, but the most reliable is to make <form> a * composite component and use `componentDidMount` to attach the event handlers. */ var ReactDOMForm = ReactClass.createClass({ displayName: 'ReactDOMForm', tagName: 'FORM', mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin], render: function() { // TODO: Instead of using `ReactDOM` directly, we should use JSX. However, // `jshint` fails to parse JSX so in order for linting to work in the open // source repo, we need to just use `ReactDOM.form`. return form(this.props); }, componentDidMount: function() { this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset'); this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit'); } }); module.exports = ReactDOMForm; },{"15":15,"25":25,"29":29,"33":33,"57":57}],44:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMIDOperations * @typechecks static-only */ /*jslint evil: true */ 'use strict'; var CSSPropertyOperations = _dereq_(5); var DOMChildrenOperations = _dereq_(9); var DOMPropertyOperations = _dereq_(11); var ReactMount = _dereq_(70); var ReactPerf = _dereq_(75); var invariant = _dereq_(135); var setInnerHTML = _dereq_(148); /** * Errors for properties that should not be updated with `updatePropertyById()`. * * @type {object} * @private */ var INVALID_PROPERTY_ERRORS = { dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.', style: '`style` must be set using `updateStylesByID()`.' }; /** * Operations used to process updates to DOM nodes. This is made injectable via * `ReactDOMComponent.BackendIDOperations`. */ var ReactDOMIDOperations = { /** * Updates a DOM node with new property values. This should only be used to * update DOM properties in `DOMProperty`. * * @param {string} id ID of the node to update. * @param {string} name A valid property name, see `DOMProperty`. * @param {*} value New value of the property. * @internal */ updatePropertyByID: function(id, name, value) { var node = ReactMount.getNode(id); ("production" !== "development" ? invariant( !INVALID_PROPERTY_ERRORS.hasOwnProperty(name), 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name] ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name))); // If we're updating to null or undefined, we should remove the property // from the DOM node instead of inadvertantly setting to a string. This // brings us in line with the same behavior we have on initial render. if (value != null) { DOMPropertyOperations.setValueForProperty(node, name, value); } else { DOMPropertyOperations.deleteValueForProperty(node, name); } }, /** * Updates a DOM node to remove a property. This should only be used to remove * DOM properties in `DOMProperty`. * * @param {string} id ID of the node to update. * @param {string} name A property name to remove, see `DOMProperty`. * @internal */ deletePropertyByID: function(id, name, value) { var node = ReactMount.getNode(id); ("production" !== "development" ? invariant( !INVALID_PROPERTY_ERRORS.hasOwnProperty(name), 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name] ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name))); DOMPropertyOperations.deleteValueForProperty(node, name, value); }, /** * Updates a DOM node with new style values. If a value is specified as '', * the corresponding style property will be unset. * * @param {string} id ID of the node to update. * @param {object} styles Mapping from styles to values. * @internal */ updateStylesByID: function(id, styles) { var node = ReactMount.getNode(id); CSSPropertyOperations.setValueForStyles(node, styles); }, /** * Updates a DOM node's innerHTML. * * @param {string} id ID of the node to update. * @param {string} html An HTML string. * @internal */ updateInnerHTMLByID: function(id, html) { var node = ReactMount.getNode(id); setInnerHTML(node, html); }, /** * Updates a DOM node's text content set by `props.content`. * * @param {string} id ID of the node to update. * @param {string} content Text content. * @internal */ updateTextContentByID: function(id, content) { var node = ReactMount.getNode(id); DOMChildrenOperations.updateTextContent(node, content); }, /** * Replaces a DOM node that exists in the document with markup. * * @param {string} id ID of child to be replaced. * @param {string} markup Dangerous markup to inject in place of child. * @internal * @see {Danger.dangerouslyReplaceNodeWithMarkup} */ dangerouslyReplaceNodeWithMarkupByID: function(id, markup) { var node = ReactMount.getNode(id); DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup); }, /** * Updates a component's children by processing a series of updates. * * @param {array<object>} updates List of update configurations. * @param {array<string>} markup List of markup strings. * @internal */ dangerouslyProcessChildrenUpdates: function(updates, markup) { for (var i = 0; i < updates.length; i++) { updates[i].parentNode = ReactMount.getNode(updates[i].parentID); } DOMChildrenOperations.processUpdates(updates, markup); } }; ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', { updatePropertyByID: 'updatePropertyByID', deletePropertyByID: 'deletePropertyByID', updateStylesByID: 'updateStylesByID', updateInnerHTMLByID: 'updateInnerHTMLByID', updateTextContentByID: 'updateTextContentByID', dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID', dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates' }); module.exports = ReactDOMIDOperations; },{"11":11,"135":135,"148":148,"5":5,"70":70,"75":75,"9":9}],45:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMIframe */ 'use strict'; var EventConstants = _dereq_(15); var LocalEventTrapMixin = _dereq_(25); var ReactBrowserComponentMixin = _dereq_(29); var ReactClass = _dereq_(33); var ReactElement = _dereq_(57); var iframe = ReactElement.createFactory('iframe'); /** * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to * capture it on the <iframe> element itself. There are lots of hacks we could * do to accomplish this, but the most reliable is to make <iframe> a composite * component and use `componentDidMount` to attach the event handlers. */ var ReactDOMIframe = ReactClass.createClass({ displayName: 'ReactDOMIframe', tagName: 'IFRAME', mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin], render: function() { return iframe(this.props); }, componentDidMount: function() { this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load'); } }); module.exports = ReactDOMIframe; },{"15":15,"25":25,"29":29,"33":33,"57":57}],46:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMImg */ 'use strict'; var EventConstants = _dereq_(15); var LocalEventTrapMixin = _dereq_(25); var ReactBrowserComponentMixin = _dereq_(29); var ReactClass = _dereq_(33); var ReactElement = _dereq_(57); var img = ReactElement.createFactory('img'); /** * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to * capture it on the <img> element itself. There are lots of hacks we could do * to accomplish this, but the most reliable is to make <img> a composite * component and use `componentDidMount` to attach the event handlers. */ var ReactDOMImg = ReactClass.createClass({ displayName: 'ReactDOMImg', tagName: 'IMG', mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin], render: function() { return img(this.props); }, componentDidMount: function() { this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load'); this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error'); } }); module.exports = ReactDOMImg; },{"15":15,"25":25,"29":29,"33":33,"57":57}],47:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMInput */ 'use strict'; var AutoFocusMixin = _dereq_(2); var DOMPropertyOperations = _dereq_(11); var LinkedValueUtils = _dereq_(24); var ReactBrowserComponentMixin = _dereq_(29); var ReactClass = _dereq_(33); var ReactElement = _dereq_(57); var ReactMount = _dereq_(70); var ReactUpdates = _dereq_(87); var assign = _dereq_(27); var invariant = _dereq_(135); var input = ReactElement.createFactory('input'); var instancesByReactID = {}; function forceUpdateIfMounted() { /*jshint validthis:true */ if (this.isMounted()) { this.forceUpdate(); } } /** * Implements an <input> native component that allows setting these optional * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. * * If `checked` or `value` are not supplied (or null/undefined), user actions * that affect the checked state or value will trigger updates to the element. * * If they are supplied (and not null/undefined), the rendered element will not * trigger updates to the element. Instead, the props must change in order for * the rendered element to be updated. * * The rendered element will be initialized as unchecked (or `defaultChecked`) * with an empty value (or `defaultValue`). * * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html */ var ReactDOMInput = ReactClass.createClass({ displayName: 'ReactDOMInput', tagName: 'INPUT', mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin], getInitialState: function() { var defaultValue = this.props.defaultValue; return { initialChecked: this.props.defaultChecked || false, initialValue: defaultValue != null ? defaultValue : null }; }, render: function() { // Clone `this.props` so we don't mutate the input. var props = assign({}, this.props); props.defaultChecked = null; props.defaultValue = null; var value = LinkedValueUtils.getValue(this); props.value = value != null ? value : this.state.initialValue; var checked = LinkedValueUtils.getChecked(this); props.checked = checked != null ? checked : this.state.initialChecked; props.onChange = this._handleChange; return input(props, this.props.children); }, componentDidMount: function() { var id = ReactMount.getID(this.getDOMNode()); instancesByReactID[id] = this; }, componentWillUnmount: function() { var rootNode = this.getDOMNode(); var id = ReactMount.getID(rootNode); delete instancesByReactID[id]; }, componentDidUpdate: function(prevProps, prevState, prevContext) { var rootNode = this.getDOMNode(); if (this.props.checked != null) { DOMPropertyOperations.setValueForProperty( rootNode, 'checked', this.props.checked || false ); } var value = LinkedValueUtils.getValue(this); if (value != null) { // Cast `value` to a string to ensure the value is set correctly. While // browsers typically do this as necessary, jsdom doesn't. DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value); } }, _handleChange: function(event) { var returnValue; var onChange = LinkedValueUtils.getOnChange(this); if (onChange) { returnValue = onChange.call(this, event); } // Here we use asap to wait until all updates have propagated, which // is important when using controlled components within layers: // https://github.com/facebook/react/issues/1698 ReactUpdates.asap(forceUpdateIfMounted, this); var name = this.props.name; if (this.props.type === 'radio' && name != null) { var rootNode = this.getDOMNode(); var queryRoot = rootNode; while (queryRoot.parentNode) { queryRoot = queryRoot.parentNode; } // If `rootNode.form` was non-null, then we could try `form.elements`, // but that sometimes behaves strangely in IE8. We could also try using // `form.getElementsByName`, but that will only return direct children // and won't include inputs that use the HTML5 `form=` attribute. Since // the input might not even be in a form, let's just use the global // `querySelectorAll` to ensure we don't miss anything. var group = queryRoot.querySelectorAll( 'input[name=' + JSON.stringify('' + name) + '][type="radio"]'); for (var i = 0, groupLen = group.length; i < groupLen; i++) { var otherNode = group[i]; if (otherNode === rootNode || otherNode.form !== rootNode.form) { continue; } var otherID = ReactMount.getID(otherNode); ("production" !== "development" ? invariant( otherID, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.' ) : invariant(otherID)); var otherInstance = instancesByReactID[otherID]; ("production" !== "development" ? invariant( otherInstance, 'ReactDOMInput: Unknown radio button ID %s.', otherID ) : invariant(otherInstance)); // If this is a controlled radio button group, forcing the input that // was previously checked to update will cause it to be come re-checked // as appropriate. ReactUpdates.asap(forceUpdateIfMounted, otherInstance); } } return returnValue; } }); module.exports = ReactDOMInput; },{"11":11,"135":135,"2":2,"24":24,"27":27,"29":29,"33":33,"57":57,"70":70,"87":87}],48:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMOption */ 'use strict'; var ReactBrowserComponentMixin = _dereq_(29); var ReactClass = _dereq_(33); var ReactElement = _dereq_(57); var warning = _dereq_(154); var option = ReactElement.createFactory('option'); /** * Implements an <option> native component that warns when `selected` is set. */ var ReactDOMOption = ReactClass.createClass({ displayName: 'ReactDOMOption', tagName: 'OPTION', mixins: [ReactBrowserComponentMixin], componentWillMount: function() { // TODO (yungsters): Remove support for `selected` in <option>. if ("production" !== "development") { ("production" !== "development" ? warning( this.props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.' ) : null); } }, render: function() { return option(this.props, this.props.children); } }); module.exports = ReactDOMOption; },{"154":154,"29":29,"33":33,"57":57}],49:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMSelect */ 'use strict'; var AutoFocusMixin = _dereq_(2); var LinkedValueUtils = _dereq_(24); var ReactBrowserComponentMixin = _dereq_(29); var ReactClass = _dereq_(33); var ReactElement = _dereq_(57); var ReactUpdates = _dereq_(87); var assign = _dereq_(27); var select = ReactElement.createFactory('select'); function updateOptionsIfPendingUpdateAndMounted() { /*jshint validthis:true */ if (this._pendingUpdate) { this._pendingUpdate = false; var value = LinkedValueUtils.getValue(this); if (value != null && this.isMounted()) { updateOptions(this, value); } } } /** * Validation function for `value` and `defaultValue`. * @private */ function selectValueType(props, propName, componentName) { if (props[propName] == null) { return null; } if (props.multiple) { if (!Array.isArray(props[propName])) { return new Error( ("The `" + propName + "` prop supplied to <select> must be an array if ") + ("`multiple` is true.") ); } } else { if (Array.isArray(props[propName])) { return new Error( ("The `" + propName + "` prop supplied to <select> must be a scalar ") + ("value if `multiple` is false.") ); } } } /** * @param {ReactComponent} component Instance of ReactDOMSelect * @param {*} propValue A stringable (with `multiple`, a list of stringables). * @private */ function updateOptions(component, propValue) { var selectedValue, i, l; var options = component.getDOMNode().options; if (component.props.multiple) { selectedValue = {}; for (i = 0, l = propValue.length; i < l; i++) { selectedValue['' + propValue[i]] = true; } for (i = 0, l = options.length; i < l; i++) { var selected = selectedValue.hasOwnProperty(options[i].value); if (options[i].selected !== selected) { options[i].selected = selected; } } } else { // Do not set `select.value` as exact behavior isn't consistent across all // browsers for all cases. selectedValue = '' + propValue; for (i = 0, l = options.length; i < l; i++) { if (options[i].value === selectedValue) { options[i].selected = true; return; } } if (options.length) { options[0].selected = true; } } } /** * Implements a <select> native component that allows optionally setting the * props `value` and `defaultValue`. If `multiple` is false, the prop must be a * stringable. If `multiple` is true, the prop must be an array of stringables. * * If `value` is not supplied (or null/undefined), user actions that change the * selected option will trigger updates to the rendered options. * * If it is supplied (and not null/undefined), the rendered options will not * update in response to user actions. Instead, the `value` prop must change in * order for the rendered options to update. * * If `defaultValue` is provided, any options with the supplied values will be * selected. */ var ReactDOMSelect = ReactClass.createClass({ displayName: 'ReactDOMSelect', tagName: 'SELECT', mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin], propTypes: { defaultValue: selectValueType, value: selectValueType }, render: function() { // Clone `this.props` so we don't mutate the input. var props = assign({}, this.props); props.onChange = this._handleChange; props.value = null; return select(props, this.props.children); }, componentWillMount: function() { this._pendingUpdate = false; }, componentDidMount: function() { var value = LinkedValueUtils.getValue(this); if (value != null) { updateOptions(this, value); } else if (this.props.defaultValue != null) { updateOptions(this, this.props.defaultValue); } }, componentDidUpdate: function(prevProps) { var value = LinkedValueUtils.getValue(this); if (value != null) { this._pendingUpdate = false; updateOptions(this, value); } else if (!prevProps.multiple !== !this.props.multiple) { // For simplicity, reapply `defaultValue` if `multiple` is toggled. if (this.props.defaultValue != null) { updateOptions(this, this.props.defaultValue); } else { // Revert the select back to its default unselected state. updateOptions(this, this.props.multiple ? [] : ''); } } }, _handleChange: function(event) { var returnValue; var onChange = LinkedValueUtils.getOnChange(this); if (onChange) { returnValue = onChange.call(this, event); } this._pendingUpdate = true; ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this); return returnValue; } }); module.exports = ReactDOMSelect; },{"2":2,"24":24,"27":27,"29":29,"33":33,"57":57,"87":87}],50:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMSelection */ 'use strict'; var ExecutionEnvironment = _dereq_(21); var getNodeForCharacterOffset = _dereq_(128); var getTextContentAccessor = _dereq_(130); /** * While `isCollapsed` is available on the Selection object and `collapsed` * is available on the Range object, IE11 sometimes gets them wrong. * If the anchor/focus nodes and offsets are the same, the range is collapsed. */ function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) { return anchorNode === focusNode && anchorOffset === focusOffset; } /** * Get the appropriate anchor and focus node/offset pairs for IE. * * The catch here is that IE's selection API doesn't provide information * about whether the selection is forward or backward, so we have to * behave as though it's always forward. * * IE text differs from modern selection in that it behaves as though * block elements end with a new line. This means character offsets will * differ between the two APIs. * * @param {DOMElement} node * @return {object} */ function getIEOffsets(node) { var selection = document.selection; var selectedRange = selection.createRange(); var selectedLength = selectedRange.text.length; // Duplicate selection so we can move range without breaking user selection. var fromStart = selectedRange.duplicate(); fromStart.moveToElementText(node); fromStart.setEndPoint('EndToStart', selectedRange); var startOffset = fromStart.text.length; var endOffset = startOffset + selectedLength; return { start: startOffset, end: endOffset }; } /** * @param {DOMElement} node * @return {?object} */ function getModernOffsets(node) { var selection = window.getSelection && window.getSelection(); if (!selection || selection.rangeCount === 0) { return null; } var anchorNode = selection.anchorNode; var anchorOffset = selection.anchorOffset; var focusNode = selection.focusNode; var focusOffset = selection.focusOffset; var currentRange = selection.getRangeAt(0); // If the node and offset values are the same, the selection is collapsed. // `Selection.isCollapsed` is available natively, but IE sometimes gets // this value wrong. var isSelectionCollapsed = isCollapsed( selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset ); var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length; var tempRange = currentRange.cloneRange(); tempRange.selectNodeContents(node); tempRange.setEnd(currentRange.startContainer, currentRange.startOffset); var isTempRangeCollapsed = isCollapsed( tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset ); var start = isTempRangeCollapsed ? 0 : tempRange.toString().length; var end = start + rangeLength; // Detect whether the selection is backward. var detectionRange = document.createRange(); detectionRange.setStart(anchorNode, anchorOffset); detectionRange.setEnd(focusNode, focusOffset); var isBackward = detectionRange.collapsed; return { start: isBackward ? end : start, end: isBackward ? start : end }; } /** * @param {DOMElement|DOMTextNode} node * @param {object} offsets */ function setIEOffsets(node, offsets) { var range = document.selection.createRange().duplicate(); var start, end; if (typeof offsets.end === 'undefined') { start = offsets.start; end = start; } else if (offsets.start > offsets.end) { start = offsets.end; end = offsets.start; } else { start = offsets.start; end = offsets.end; } range.moveToElementText(node); range.moveStart('character', start); range.setEndPoint('EndToStart', range); range.moveEnd('character', end - start); range.select(); } /** * In modern non-IE browsers, we can support both forward and backward * selections. * * Note: IE10+ supports the Selection object, but it does not support * the `extend` method, which means that even in modern IE, it's not possible * to programatically create a backward selection. Thus, for all IE * versions, we use the old IE API to create our selections. * * @param {DOMElement|DOMTextNode} node * @param {object} offsets */ function setModernOffsets(node, offsets) { if (!window.getSelection) { return; } var selection = window.getSelection(); var length = node[getTextContentAccessor()].length; var start = Math.min(offsets.start, length); var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length); // IE 11 uses modern selection, but doesn't support the extend method. // Flip backward selections, so we can set with a single range. if (!selection.extend && start > end) { var temp = end; end = start; start = temp; } var startMarker = getNodeForCharacterOffset(node, start); var endMarker = getNodeForCharacterOffset(node, end); if (startMarker && endMarker) { var range = document.createRange(); range.setStart(startMarker.node, startMarker.offset); selection.removeAllRanges(); if (start > end) { selection.addRange(range); selection.extend(endMarker.node, endMarker.offset); } else { range.setEnd(endMarker.node, endMarker.offset); selection.addRange(range); } } } var useIEOffsets = ( ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window) ); var ReactDOMSelection = { /** * @param {DOMElement} node */ getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets, /** * @param {DOMElement|DOMTextNode} node * @param {object} offsets */ setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets }; module.exports = ReactDOMSelection; },{"128":128,"130":130,"21":21}],51:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMTextComponent * @typechecks static-only */ 'use strict'; var DOMPropertyOperations = _dereq_(11); var ReactComponentBrowserEnvironment = _dereq_(35); var ReactDOMComponent = _dereq_(42); var assign = _dereq_(27); var escapeTextContentForBrowser = _dereq_(116); /** * Text nodes violate a couple assumptions that React makes about components: * * - When mounting text into the DOM, adjacent text nodes are merged. * - Text nodes cannot be assigned a React root ID. * * This component is used to wrap strings in elements so that they can undergo * the same reconciliation that is applied to elements. * * TODO: Investigate representing React components in the DOM with text nodes. * * @class ReactDOMTextComponent * @extends ReactComponent * @internal */ var ReactDOMTextComponent = function(props) { // This constructor and its argument is currently used by mocks. }; assign(ReactDOMTextComponent.prototype, { /** * @param {ReactText} text * @internal */ construct: function(text) { // TODO: This is really a ReactText (ReactNode), not a ReactElement this._currentElement = text; this._stringText = '' + text; // Properties this._rootNodeID = null; this._mountIndex = 0; }, /** * Creates the markup for this text node. This node is not intended to have * any features besides containing text content. * * @param {string} rootID DOM ID of the root node. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction * @return {string} Markup for this text node. * @internal */ mountComponent: function(rootID, transaction, context) { this._rootNodeID = rootID; var escapedText = escapeTextContentForBrowser(this._stringText); if (transaction.renderToStaticMarkup) { // Normally we'd wrap this in a `span` for the reasons stated above, but // since this is a situation where React won't take over (static pages), // we can simply return the text as it is. return escapedText; } return ( '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>' ); }, /** * Updates this component by updating the text content. * * @param {ReactText} nextText The next text content * @param {ReactReconcileTransaction} transaction * @internal */ receiveComponent: function(nextText, transaction) { if (nextText !== this._currentElement) { this._currentElement = nextText; var nextStringText = '' + nextText; if (nextStringText !== this._stringText) { // TODO: Save this as pending props and use performUpdateIfNecessary // and/or updateComponent to do the actual update for consistency with // other component types? this._stringText = nextStringText; ReactDOMComponent.BackendIDOperations.updateTextContentByID( this._rootNodeID, nextStringText ); } } }, unmountComponent: function() { ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID); } }); module.exports = ReactDOMTextComponent; },{"11":11,"116":116,"27":27,"35":35,"42":42}],52:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDOMTextarea */ 'use strict'; var AutoFocusMixin = _dereq_(2); var DOMPropertyOperations = _dereq_(11); var LinkedValueUtils = _dereq_(24); var ReactBrowserComponentMixin = _dereq_(29); var ReactClass = _dereq_(33); var ReactElement = _dereq_(57); var ReactUpdates = _dereq_(87); var assign = _dereq_(27); var invariant = _dereq_(135); var warning = _dereq_(154); var textarea = ReactElement.createFactory('textarea'); function forceUpdateIfMounted() { /*jshint validthis:true */ if (this.isMounted()) { this.forceUpdate(); } } /** * Implements a <textarea> native component that allows setting `value`, and * `defaultValue`. This differs from the traditional DOM API because value is * usually set as PCDATA children. * * If `value` is not supplied (or null/undefined), user actions that affect the * value will trigger updates to the element. * * If `value` is supplied (and not null/undefined), the rendered element will * not trigger updates to the element. Instead, the `value` prop must change in * order for the rendered element to be updated. * * The rendered element will be initialized with an empty value, the prop * `defaultValue` if specified, or the children content (deprecated). */ var ReactDOMTextarea = ReactClass.createClass({ displayName: 'ReactDOMTextarea', tagName: 'TEXTAREA', mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin], getInitialState: function() { var defaultValue = this.props.defaultValue; // TODO (yungsters): Remove support for children content in <textarea>. var children = this.props.children; if (children != null) { if ("production" !== "development") { ("production" !== "development" ? warning( false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.' ) : null); } ("production" !== "development" ? invariant( defaultValue == null, 'If you supply `defaultValue` on a <textarea>, do not pass children.' ) : invariant(defaultValue == null)); if (Array.isArray(children)) { ("production" !== "development" ? invariant( children.length <= 1, '<textarea> can only have at most one child.' ) : invariant(children.length <= 1)); children = children[0]; } defaultValue = '' + children; } if (defaultValue == null) { defaultValue = ''; } var value = LinkedValueUtils.getValue(this); return { // We save the initial value so that `ReactDOMComponent` doesn't update // `textContent` (unnecessary since we update value). // The initial value can be a boolean or object so that's why it's // forced to be a string. initialValue: '' + (value != null ? value : defaultValue) }; }, render: function() { // Clone `this.props` so we don't mutate the input. var props = assign({}, this.props); ("production" !== "development" ? invariant( props.dangerouslySetInnerHTML == null, '`dangerouslySetInnerHTML` does not make sense on <textarea>.' ) : invariant(props.dangerouslySetInnerHTML == null)); props.defaultValue = null; props.value = null; props.onChange = this._handleChange; // Always set children to the same thing. In IE9, the selection range will // get reset if `textContent` is mutated. return textarea(props, this.state.initialValue); }, componentDidUpdate: function(prevProps, prevState, prevContext) { var value = LinkedValueUtils.getValue(this); if (value != null) { var rootNode = this.getDOMNode(); // Cast `value` to a string to ensure the value is set correctly. While // browsers typically do this as necessary, jsdom doesn't. DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value); } }, _handleChange: function(event) { var returnValue; var onChange = LinkedValueUtils.getOnChange(this); if (onChange) { returnValue = onChange.call(this, event); } ReactUpdates.asap(forceUpdateIfMounted, this); return returnValue; } }); module.exports = ReactDOMTextarea; },{"11":11,"135":135,"154":154,"2":2,"24":24,"27":27,"29":29,"33":33,"57":57,"87":87}],53:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDefaultBatchingStrategy */ 'use strict'; var ReactUpdates = _dereq_(87); var Transaction = _dereq_(103); var assign = _dereq_(27); var emptyFunction = _dereq_(114); var RESET_BATCHED_UPDATES = { initialize: emptyFunction, close: function() { ReactDefaultBatchingStrategy.isBatchingUpdates = false; } }; var FLUSH_BATCHED_UPDATES = { initialize: emptyFunction, close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates) }; var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES]; function ReactDefaultBatchingStrategyTransaction() { this.reinitializeTransaction(); } assign( ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, { getTransactionWrappers: function() { return TRANSACTION_WRAPPERS; } } ); var transaction = new ReactDefaultBatchingStrategyTransaction(); var ReactDefaultBatchingStrategy = { isBatchingUpdates: false, /** * Call the provided function in a context within which calls to `setState` * and friends are batched such that components aren't updated unnecessarily. */ batchedUpdates: function(callback, a, b, c, d) { var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates; ReactDefaultBatchingStrategy.isBatchingUpdates = true; // The code is written this way to avoid extra allocations if (alreadyBatchingUpdates) { callback(a, b, c, d); } else { transaction.perform(callback, null, a, b, c, d); } } }; module.exports = ReactDefaultBatchingStrategy; },{"103":103,"114":114,"27":27,"87":87}],54:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDefaultInjection */ 'use strict'; var BeforeInputEventPlugin = _dereq_(3); var ChangeEventPlugin = _dereq_(7); var ClientReactRootIndex = _dereq_(8); var DefaultEventPluginOrder = _dereq_(13); var EnterLeaveEventPlugin = _dereq_(14); var ExecutionEnvironment = _dereq_(21); var HTMLDOMPropertyConfig = _dereq_(23); var MobileSafariClickEventPlugin = _dereq_(26); var ReactBrowserComponentMixin = _dereq_(29); var ReactClass = _dereq_(33); var ReactComponentBrowserEnvironment = _dereq_(35); var ReactDefaultBatchingStrategy = _dereq_(53); var ReactDOMComponent = _dereq_(42); var ReactDOMButton = _dereq_(41); var ReactDOMForm = _dereq_(43); var ReactDOMImg = _dereq_(46); var ReactDOMIDOperations = _dereq_(44); var ReactDOMIframe = _dereq_(45); var ReactDOMInput = _dereq_(47); var ReactDOMOption = _dereq_(48); var ReactDOMSelect = _dereq_(49); var ReactDOMTextarea = _dereq_(52); var ReactDOMTextComponent = _dereq_(51); var ReactElement = _dereq_(57); var ReactEventListener = _dereq_(62); var ReactInjection = _dereq_(64); var ReactInstanceHandles = _dereq_(66); var ReactMount = _dereq_(70); var ReactReconcileTransaction = _dereq_(80); var SelectEventPlugin = _dereq_(89); var ServerReactRootIndex = _dereq_(90); var SimpleEventPlugin = _dereq_(91); var SVGDOMPropertyConfig = _dereq_(88); var createFullPageComponent = _dereq_(111); function autoGenerateWrapperClass(type) { return ReactClass.createClass({ tagName: type.toUpperCase(), render: function() { return new ReactElement( type, null, null, null, null, this.props ); } }); } function inject() { ReactInjection.EventEmitter.injectReactEventListener( ReactEventListener ); /** * Inject modules for resolving DOM hierarchy and plugin ordering. */ ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder); ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles); ReactInjection.EventPluginHub.injectMount(ReactMount); /** * Some important event plugins included by default (without having to require * them). */ ReactInjection.EventPluginHub.injectEventPluginsByName({ SimpleEventPlugin: SimpleEventPlugin, EnterLeaveEventPlugin: EnterLeaveEventPlugin, ChangeEventPlugin: ChangeEventPlugin, MobileSafariClickEventPlugin: MobileSafariClickEventPlugin, SelectEventPlugin: SelectEventPlugin, BeforeInputEventPlugin: BeforeInputEventPlugin }); ReactInjection.NativeComponent.injectGenericComponentClass( ReactDOMComponent ); ReactInjection.NativeComponent.injectTextComponentClass( ReactDOMTextComponent ); ReactInjection.NativeComponent.injectAutoWrapper( autoGenerateWrapperClass ); // This needs to happen before createFullPageComponent() otherwise the mixin // won't be included. ReactInjection.Class.injectMixin(ReactBrowserComponentMixin); ReactInjection.NativeComponent.injectComponentClasses({ 'button': ReactDOMButton, 'form': ReactDOMForm, 'iframe': ReactDOMIframe, 'img': ReactDOMImg, 'input': ReactDOMInput, 'option': ReactDOMOption, 'select': ReactDOMSelect, 'textarea': ReactDOMTextarea, 'html': createFullPageComponent('html'), 'head': createFullPageComponent('head'), 'body': createFullPageComponent('body') }); ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig); ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig); ReactInjection.EmptyComponent.injectEmptyComponent('noscript'); ReactInjection.Updates.injectReconcileTransaction( ReactReconcileTransaction ); ReactInjection.Updates.injectBatchingStrategy( ReactDefaultBatchingStrategy ); ReactInjection.RootIndex.injectCreateReactRootIndex( ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex ); ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment); ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations); if ("production" !== "development") { var url = (ExecutionEnvironment.canUseDOM && window.location.href) || ''; if ((/[?&]react_perf\b/).test(url)) { var ReactDefaultPerf = _dereq_(55); ReactDefaultPerf.start(); } } } module.exports = { inject: inject }; },{"111":111,"13":13,"14":14,"21":21,"23":23,"26":26,"29":29,"3":3,"33":33,"35":35,"41":41,"42":42,"43":43,"44":44,"45":45,"46":46,"47":47,"48":48,"49":49,"51":51,"52":52,"53":53,"55":55,"57":57,"62":62,"64":64,"66":66,"7":7,"70":70,"8":8,"80":80,"88":88,"89":89,"90":90,"91":91}],55:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDefaultPerf * @typechecks static-only */ 'use strict'; var DOMProperty = _dereq_(10); var ReactDefaultPerfAnalysis = _dereq_(56); var ReactMount = _dereq_(70); var ReactPerf = _dereq_(75); var performanceNow = _dereq_(146); function roundFloat(val) { return Math.floor(val * 100) / 100; } function addValue(obj, key, val) { obj[key] = (obj[key] || 0) + val; } var ReactDefaultPerf = { _allMeasurements: [], // last item in the list is the current one _mountStack: [0], _injected: false, start: function() { if (!ReactDefaultPerf._injected) { ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure); } ReactDefaultPerf._allMeasurements.length = 0; ReactPerf.enableMeasure = true; }, stop: function() { ReactPerf.enableMeasure = false; }, getLastMeasurements: function() { return ReactDefaultPerf._allMeasurements; }, printExclusive: function(measurements) { measurements = measurements || ReactDefaultPerf._allMeasurements; var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements); console.table(summary.map(function(item) { return { 'Component class name': item.componentName, 'Total inclusive time (ms)': roundFloat(item.inclusive), 'Exclusive mount time (ms)': roundFloat(item.exclusive), 'Exclusive render time (ms)': roundFloat(item.render), 'Mount time per instance (ms)': roundFloat(item.exclusive / item.count), 'Render time per instance (ms)': roundFloat(item.render / item.count), 'Instances': item.count }; })); // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct // number. }, printInclusive: function(measurements) { measurements = measurements || ReactDefaultPerf._allMeasurements; var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements); console.table(summary.map(function(item) { return { 'Owner > component': item.componentName, 'Inclusive time (ms)': roundFloat(item.time), 'Instances': item.count }; })); console.log( 'Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms' ); }, getMeasurementsSummaryMap: function(measurements) { var summary = ReactDefaultPerfAnalysis.getInclusiveSummary( measurements, true ); return summary.map(function(item) { return { 'Owner > component': item.componentName, 'Wasted time (ms)': item.time, 'Instances': item.count }; }); }, printWasted: function(measurements) { measurements = measurements || ReactDefaultPerf._allMeasurements; console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements)); console.log( 'Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms' ); }, printDOM: function(measurements) { measurements = measurements || ReactDefaultPerf._allMeasurements; var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements); console.table(summary.map(function(item) { var result = {}; result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id; result['type'] = item.type; result['args'] = JSON.stringify(item.args); return result; })); console.log( 'Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms' ); }, _recordWrite: function(id, fnName, totalTime, args) { // TODO: totalTime isn't that useful since it doesn't count paints/reflows var writes = ReactDefaultPerf ._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1] .writes; writes[id] = writes[id] || []; writes[id].push({ type: fnName, time: totalTime, args: args }); }, measure: function(moduleName, fnName, func) { return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]); var totalTime; var rv; var start; if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') { // A "measurement" is a set of metrics recorded for each flush. We want // to group the metrics for a given flush together so we can look at the // components that rendered and the DOM operations that actually // happened to determine the amount of "wasted work" performed. ReactDefaultPerf._allMeasurements.push({ exclusive: {}, inclusive: {}, render: {}, counts: {}, writes: {}, displayNames: {}, totalTime: 0 }); start = performanceNow(); rv = func.apply(this, args); ReactDefaultPerf._allMeasurements[ ReactDefaultPerf._allMeasurements.length - 1 ].totalTime = performanceNow() - start; return rv; } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactDOMIDOperations') { start = performanceNow(); rv = func.apply(this, args); totalTime = performanceNow() - start; if (fnName === '_mountImageIntoNode') { var mountID = ReactMount.getID(args[1]); ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]); } else if (fnName === 'dangerouslyProcessChildrenUpdates') { // special format args[0].forEach(function(update) { var writeArgs = {}; if (update.fromIndex !== null) { writeArgs.fromIndex = update.fromIndex; } if (update.toIndex !== null) { writeArgs.toIndex = update.toIndex; } if (update.textContent !== null) { writeArgs.textContent = update.textContent; } if (update.markupIndex !== null) { writeArgs.markup = args[1][update.markupIndex]; } ReactDefaultPerf._recordWrite( update.parentID, update.type, totalTime, writeArgs ); }); } else { // basic format ReactDefaultPerf._recordWrite( args[0], fnName, totalTime, Array.prototype.slice.call(args, 1) ); } return rv; } else if (moduleName === 'ReactCompositeComponent' && ( (// TODO: receiveComponent()? (fnName === 'mountComponent' || fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) { if (typeof this._currentElement.type === 'string') { return func.apply(this, args); } var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID; var isRender = fnName === '_renderValidatedComponent'; var isMount = fnName === 'mountComponent'; var mountStack = ReactDefaultPerf._mountStack; var entry = ReactDefaultPerf._allMeasurements[ ReactDefaultPerf._allMeasurements.length - 1 ]; if (isRender) { addValue(entry.counts, rootNodeID, 1); } else if (isMount) { mountStack.push(0); } start = performanceNow(); rv = func.apply(this, args); totalTime = performanceNow() - start; if (isRender) { addValue(entry.render, rootNodeID, totalTime); } else if (isMount) { var subMountTime = mountStack.pop(); mountStack[mountStack.length - 1] += totalTime; addValue(entry.exclusive, rootNodeID, totalTime - subMountTime); addValue(entry.inclusive, rootNodeID, totalTime); } else { addValue(entry.inclusive, rootNodeID, totalTime); } entry.displayNames[rootNodeID] = { current: this.getName(), owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>' }; return rv; } else { return func.apply(this, args); } }; } }; module.exports = ReactDefaultPerf; },{"10":10,"146":146,"56":56,"70":70,"75":75}],56:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactDefaultPerfAnalysis */ var assign = _dereq_(27); // Don't try to save users less than 1.2ms (a number I made up) var DONT_CARE_THRESHOLD = 1.2; var DOM_OPERATION_TYPES = { '_mountImageIntoNode': 'set innerHTML', INSERT_MARKUP: 'set innerHTML', MOVE_EXISTING: 'move', REMOVE_NODE: 'remove', TEXT_CONTENT: 'set textContent', 'updatePropertyByID': 'update attribute', 'deletePropertyByID': 'delete attribute', 'updateStylesByID': 'update styles', 'updateInnerHTMLByID': 'set innerHTML', 'dangerouslyReplaceNodeWithMarkupByID': 'replace' }; function getTotalTime(measurements) { // TODO: return number of DOM ops? could be misleading. // TODO: measure dropped frames after reconcile? // TODO: log total time of each reconcile and the top-level component // class that triggered it. var totalTime = 0; for (var i = 0; i < measurements.length; i++) { var measurement = measurements[i]; totalTime += measurement.totalTime; } return totalTime; } function getDOMSummary(measurements) { var items = []; for (var i = 0; i < measurements.length; i++) { var measurement = measurements[i]; var id; for (id in measurement.writes) { measurement.writes[id].forEach(function(write) { items.push({ id: id, type: DOM_OPERATION_TYPES[write.type] || write.type, args: write.args }); }); } } return items; } function getExclusiveSummary(measurements) { var candidates = {}; var displayName; for (var i = 0; i < measurements.length; i++) { var measurement = measurements[i]; var allIDs = assign( {}, measurement.exclusive, measurement.inclusive ); for (var id in allIDs) { displayName = measurement.displayNames[id].current; candidates[displayName] = candidates[displayName] || { componentName: displayName, inclusive: 0, exclusive: 0, render: 0, count: 0 }; if (measurement.render[id]) { candidates[displayName].render += measurement.render[id]; } if (measurement.exclusive[id]) { candidates[displayName].exclusive += measurement.exclusive[id]; } if (measurement.inclusive[id]) { candidates[displayName].inclusive += measurement.inclusive[id]; } if (measurement.counts[id]) { candidates[displayName].count += measurement.counts[id]; } } } // Now make a sorted array with the results. var arr = []; for (displayName in candidates) { if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) { arr.push(candidates[displayName]); } } arr.sort(function(a, b) { return b.exclusive - a.exclusive; }); return arr; } function getInclusiveSummary(measurements, onlyClean) { var candidates = {}; var inclusiveKey; for (var i = 0; i < measurements.length; i++) { var measurement = measurements[i]; var allIDs = assign( {}, measurement.exclusive, measurement.inclusive ); var cleanComponents; if (onlyClean) { cleanComponents = getUnchangedComponents(measurement); } for (var id in allIDs) { if (onlyClean && !cleanComponents[id]) { continue; } var displayName = measurement.displayNames[id]; // Inclusive time is not useful for many components without knowing where // they are instantiated. So we aggregate inclusive time with both the // owner and current displayName as the key. inclusiveKey = displayName.owner + ' > ' + displayName.current; candidates[inclusiveKey] = candidates[inclusiveKey] || { componentName: inclusiveKey, time: 0, count: 0 }; if (measurement.inclusive[id]) { candidates[inclusiveKey].time += measurement.inclusive[id]; } if (measurement.counts[id]) { candidates[inclusiveKey].count += measurement.counts[id]; } } } // Now make a sorted array with the results. var arr = []; for (inclusiveKey in candidates) { if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) { arr.push(candidates[inclusiveKey]); } } arr.sort(function(a, b) { return b.time - a.time; }); return arr; } function getUnchangedComponents(measurement) { // For a given reconcile, look at which components did not actually // render anything to the DOM and return a mapping of their ID to // the amount of time it took to render the entire subtree. var cleanComponents = {}; var dirtyLeafIDs = Object.keys(measurement.writes); var allIDs = assign({}, measurement.exclusive, measurement.inclusive); for (var id in allIDs) { var isDirty = false; // For each component that rendered, see if a component that triggered // a DOM op is in its subtree. for (var i = 0; i < dirtyLeafIDs.length; i++) { if (dirtyLeafIDs[i].indexOf(id) === 0) { isDirty = true; break; } } if (!isDirty && measurement.counts[id] > 0) { cleanComponents[id] = true; } } return cleanComponents; } var ReactDefaultPerfAnalysis = { getExclusiveSummary: getExclusiveSummary, getInclusiveSummary: getInclusiveSummary, getDOMSummary: getDOMSummary, getTotalTime: getTotalTime }; module.exports = ReactDefaultPerfAnalysis; },{"27":27}],57:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactElement */ 'use strict'; var ReactContext = _dereq_(38); var ReactCurrentOwner = _dereq_(39); var assign = _dereq_(27); var warning = _dereq_(154); var RESERVED_PROPS = { key: true, ref: true }; /** * Warn for mutations. * * @internal * @param {object} object * @param {string} key */ function defineWarningProperty(object, key) { Object.defineProperty(object, key, { configurable: false, enumerable: true, get: function() { if (!this._store) { return null; } return this._store[key]; }, set: function(value) { ("production" !== "development" ? warning( false, 'Don\'t set the %s property of the React element. Instead, ' + 'specify the correct value when initially creating the element.', key ) : null); this._store[key] = value; } }); } /** * This is updated to true if the membrane is successfully created. */ var useMutationMembrane = false; /** * Warn for mutations. * * @internal * @param {object} element */ function defineMutationMembrane(prototype) { try { var pseudoFrozenProperties = { props: true }; for (var key in pseudoFrozenProperties) { defineWarningProperty(prototype, key); } useMutationMembrane = true; } catch (x) { // IE will fail on defineProperty } } /** * Base constructor for all React elements. This is only used to make this * work with a dynamic instanceof check. Nothing should live on this prototype. * * @param {*} type * @param {string|object} ref * @param {*} key * @param {*} props * @internal */ var ReactElement = function(type, key, ref, owner, context, props) { // Built-in properties that belong on the element this.type = type; this.key = key; this.ref = ref; // Record the component responsible for creating this element. this._owner = owner; // TODO: Deprecate withContext, and then the context becomes accessible // through the owner. this._context = context; if ("production" !== "development") { // The validation flag and props are currently mutative. We put them on // an external backing store so that we can freeze the whole object. // This can be replaced with a WeakMap once they are implemented in // commonly used development environments. this._store = {props: props, originalProps: assign({}, props)}; // To make comparing ReactElements easier for testing purposes, we make // the validation flag non-enumerable (where possible, which should // include every environment we run tests in), so the test framework // ignores it. try { Object.defineProperty(this._store, 'validated', { configurable: false, enumerable: false, writable: true }); } catch (x) { } this._store.validated = false; // We're not allowed to set props directly on the object so we early // return and rely on the prototype membrane to forward to the backing // store. if (useMutationMembrane) { Object.freeze(this); return; } } this.props = props; }; // We intentionally don't expose the function on the constructor property. // ReactElement should be indistinguishable from a plain object. ReactElement.prototype = { _isReactElement: true }; if ("production" !== "development") { defineMutationMembrane(ReactElement.prototype); } ReactElement.createElement = function(type, config, children) { var propName; // Reserved names are extracted var props = {}; var key = null; var ref = null; if (config != null) { ref = config.ref === undefined ? null : config.ref; key = config.key === undefined ? null : '' + config.key; // Remaining properties are added to a new props object for (propName in config) { if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { props[propName] = config[propName]; } } } // Children can be more than one argument, and those are transferred onto // the newly allocated props object. var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 2]; } props.children = childArray; } // Resolve default props if (type && type.defaultProps) { var defaultProps = type.defaultProps; for (propName in defaultProps) { if (typeof props[propName] === 'undefined') { props[propName] = defaultProps[propName]; } } } return new ReactElement( type, key, ref, ReactCurrentOwner.current, ReactContext.current, props ); }; ReactElement.createFactory = function(type) { var factory = ReactElement.createElement.bind(null, type); // Expose the type on the factory and the prototype so that it can be // easily accessed on elements. E.g. <Foo />.type === Foo.type. // This should not be named `constructor` since this may not be the function // that created the element, and it may not even be a constructor. // Legacy hook TODO: Warn if this is accessed factory.type = type; return factory; }; ReactElement.cloneAndReplaceProps = function(oldElement, newProps) { var newElement = new ReactElement( oldElement.type, oldElement.key, oldElement.ref, oldElement._owner, oldElement._context, newProps ); if ("production" !== "development") { // If the key on the original is valid, then the clone is valid newElement._store.validated = oldElement._store.validated; } return newElement; }; ReactElement.cloneElement = function(element, config, children) { var propName; // Original props are copied var props = assign({}, element.props); // Reserved names are extracted var key = element.key; var ref = element.ref; // Owner will be preserved, unless ref is overridden var owner = element._owner; if (config != null) { if (config.ref !== undefined) { // Silently steal the ref from the parent. ref = config.ref; owner = ReactCurrentOwner.current; } if (config.key !== undefined) { key = '' + config.key; } // Remaining properties override existing props for (propName in config) { if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { props[propName] = config[propName]; } } } // Children can be more than one argument, and those are transferred onto // the newly allocated props object. var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 2]; } props.children = childArray; } return new ReactElement( element.type, key, ref, owner, element._context, props ); }; /** * @param {?object} object * @return {boolean} True if `object` is a valid component. * @final */ ReactElement.isValidElement = function(object) { // ReactTestUtils is often used outside of beforeEach where as React is // within it. This leads to two different instances of React on the same // page. To identify a element from a different React instance we use // a flag instead of an instanceof check. var isElement = !!(object && object._isReactElement); // if (isElement && !(object instanceof ReactElement)) { // This is an indicator that you're using multiple versions of React at the // same time. This will screw with ownership and stuff. Fix it, please. // TODO: We could possibly warn here. // } return isElement; }; module.exports = ReactElement; },{"154":154,"27":27,"38":38,"39":39}],58:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactElementValidator */ /** * ReactElementValidator provides a wrapper around a element factory * which validates the props passed to the element. This is intended to be * used only in DEV and could be replaced by a static type checker for languages * that support it. */ 'use strict'; var ReactElement = _dereq_(57); var ReactFragment = _dereq_(63); var ReactPropTypeLocations = _dereq_(77); var ReactPropTypeLocationNames = _dereq_(76); var ReactCurrentOwner = _dereq_(39); var ReactNativeComponent = _dereq_(73); var getIteratorFn = _dereq_(126); var invariant = _dereq_(135); var warning = _dereq_(154); function getDeclarationErrorAddendum() { if (ReactCurrentOwner.current) { var name = ReactCurrentOwner.current.getName(); if (name) { return ' Check the render method of `' + name + '`.'; } } return ''; } /** * Warn if there's no key explicitly set on dynamic arrays of children or * object keys are not valid. This allows us to keep track of children between * updates. */ var ownerHasKeyUseWarning = {}; var loggedTypeFailures = {}; var NUMERIC_PROPERTY_REGEX = /^\d+$/; /** * Gets the instance's name for use in warnings. * * @internal * @return {?string} Display name or undefined */ function getName(instance) { var publicInstance = instance && instance.getPublicInstance(); if (!publicInstance) { return undefined; } var constructor = publicInstance.constructor; if (!constructor) { return undefined; } return constructor.displayName || constructor.name || undefined; } /** * Gets the current owner's displayName for use in warnings. * * @internal * @return {?string} Display name or undefined */ function getCurrentOwnerDisplayName() { var current = ReactCurrentOwner.current; return ( current && getName(current) || undefined ); } /** * Warn if the element doesn't have an explicit key assigned to it. * This element is in an array. The array could grow and shrink or be * reordered. All children that haven't already been validated are required to * have a "key" property assigned to it. * * @internal * @param {ReactElement} element Element that requires a key. * @param {*} parentType element's parent's type. */ function validateExplicitKey(element, parentType) { if (element._store.validated || element.key != null) { return; } element._store.validated = true; warnAndMonitorForKeyUse( 'Each child in an array or iterator should have a unique "key" prop.', element, parentType ); } /** * Warn if the key is being defined as an object property but has an incorrect * value. * * @internal * @param {string} name Property name of the key. * @param {ReactElement} element Component that requires a key. * @param {*} parentType element's parent's type. */ function validatePropertyKey(name, element, parentType) { if (!NUMERIC_PROPERTY_REGEX.test(name)) { return; } warnAndMonitorForKeyUse( 'Child objects should have non-numeric keys so ordering is preserved.', element, parentType ); } /** * Shared warning and monitoring code for the key warnings. * * @internal * @param {string} message The base warning that gets output. * @param {ReactElement} element Component that requires a key. * @param {*} parentType element's parent's type. */ function warnAndMonitorForKeyUse(message, element, parentType) { var ownerName = getCurrentOwnerDisplayName(); var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; var useName = ownerName || parentName; var memoizer = ownerHasKeyUseWarning[message] || ( (ownerHasKeyUseWarning[message] = {}) ); if (memoizer.hasOwnProperty(useName)) { return; } memoizer[useName] = true; var parentOrOwnerAddendum = ownerName ? (" Check the render method of " + ownerName + ".") : parentName ? (" Check the React.render call using <" + parentName + ">.") : ''; // Usually the current owner is the offender, but if it accepts children as a // property, it may be the creator of the child that's responsible for // assigning it a key. var childOwnerAddendum = ''; if (element && element._owner && element._owner !== ReactCurrentOwner.current) { // Name of the component that originally created this child. var childOwnerName = getName(element._owner); childOwnerAddendum = (" It was passed a child from " + childOwnerName + "."); } ("production" !== "development" ? warning( false, message + '%s%s See https://fb.me/react-warning-keys for more information.', parentOrOwnerAddendum, childOwnerAddendum ) : null); } /** * Ensure that every element either is passed in a static location, in an * array with an explicit keys property defined, or in an object literal * with valid key property. * * @internal * @param {ReactNode} node Statically passed child of any type. * @param {*} parentType node's parent's type. */ function validateChildKeys(node, parentType) { if (Array.isArray(node)) { for (var i = 0; i < node.length; i++) { var child = node[i]; if (ReactElement.isValidElement(child)) { validateExplicitKey(child, parentType); } } } else if (ReactElement.isValidElement(node)) { // This element was passed in a valid location. node._store.validated = true; } else if (node) { var iteratorFn = getIteratorFn(node); // Entry iterators provide implicit keys. if (iteratorFn) { if (iteratorFn !== node.entries) { var iterator = iteratorFn.call(node); var step; while (!(step = iterator.next()).done) { if (ReactElement.isValidElement(step.value)) { validateExplicitKey(step.value, parentType); } } } } else if (typeof node === 'object') { var fragment = ReactFragment.extractIfFragment(node); for (var key in fragment) { if (fragment.hasOwnProperty(key)) { validatePropertyKey(key, fragment[key], parentType); } } } } } /** * Assert that the props are valid * * @param {string} componentName Name of the component for error messages. * @param {object} propTypes Map of prop name to a ReactPropType * @param {object} props * @param {string} location e.g. "prop", "context", "child context" * @private */ function checkPropTypes(componentName, propTypes, props, location) { for (var propName in propTypes) { if (propTypes.hasOwnProperty(propName)) { var error; // Prop type validation may throw. In case they do, we don't want to // fail the render phase where it didn't fail before. So we log it. // After these have been cleaned up, we'll let them throw. try { // This is intentionally an invariant that gets caught. It's the same // behavior as without this statement except with a better message. ("production" !== "development" ? invariant( typeof propTypes[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName ) : invariant(typeof propTypes[propName] === 'function')); error = propTypes[propName](props, propName, componentName, location); } catch (ex) { error = ex; } if (error instanceof Error && !(error.message in loggedTypeFailures)) { // Only monitor this failure once because there tends to be a lot of the // same error. loggedTypeFailures[error.message] = true; var addendum = getDeclarationErrorAddendum(this); ("production" !== "development" ? warning(false, 'Failed propType: %s%s', error.message, addendum) : null); } } } } var warnedPropsMutations = {}; /** * Warn about mutating props when setting `propName` on `element`. * * @param {string} propName The string key within props that was set * @param {ReactElement} element */ function warnForPropsMutation(propName, element) { var type = element.type; var elementName = typeof type === 'string' ? type : type.displayName; var ownerName = element._owner ? element._owner.getPublicInstance().constructor.displayName : null; var warningKey = propName + '|' + elementName + '|' + ownerName; if (warnedPropsMutations.hasOwnProperty(warningKey)) { return; } warnedPropsMutations[warningKey] = true; var elementInfo = ''; if (elementName) { elementInfo = ' <' + elementName + ' />'; } var ownerInfo = ''; if (ownerName) { ownerInfo = ' The element was created by ' + ownerName + '.'; } ("production" !== "development" ? warning( false, 'Don\'t set .props.%s of the React component%s. Instead, specify the ' + 'correct value when initially creating the element or use ' + 'React.cloneElement to make a new element with updated props.%s', propName, elementInfo, ownerInfo ) : null); } // Inline Object.is polyfill function is(a, b) { if (a !== a) { // NaN return b !== b; } if (a === 0 && b === 0) { // +-0 return 1 / a === 1 / b; } return a === b; } /** * Given an element, check if its props have been mutated since element * creation (or the last call to this function). In particular, check if any * new props have been added, which we can't directly catch by defining warning * properties on the props object. * * @param {ReactElement} element */ function checkAndWarnForMutatedProps(element) { if (!element._store) { // Element was created using `new ReactElement` directly or with // `ReactElement.createElement`; skip mutation checking return; } var originalProps = element._store.originalProps; var props = element.props; for (var propName in props) { if (props.hasOwnProperty(propName)) { if (!originalProps.hasOwnProperty(propName) || !is(originalProps[propName], props[propName])) { warnForPropsMutation(propName, element); // Copy over the new value so that the two props objects match again originalProps[propName] = props[propName]; } } } } /** * Given an element, validate that its props follow the propTypes definition, * provided by the type. * * @param {ReactElement} element */ function validatePropTypes(element) { if (element.type == null) { // This has already warned. Don't throw. return; } // Extract the component class from the element. Converts string types // to a composite class which may have propTypes. // TODO: Validating a string's propTypes is not decoupled from the // rendering target which is problematic. var componentClass = ReactNativeComponent.getComponentClassForElement( element ); var name = componentClass.displayName || componentClass.name; if (componentClass.propTypes) { checkPropTypes( name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop ); } if (typeof componentClass.getDefaultProps === 'function') { ("production" !== "development" ? warning( componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.' ) : null); } } var ReactElementValidator = { checkAndWarnForMutatedProps: checkAndWarnForMutatedProps, createElement: function(type, props, children) { // We warn in this case but don't throw. We expect the element creation to // succeed and there will likely be errors in render. ("production" !== "development" ? warning( type != null, 'React.createElement: type should not be null or undefined. It should ' + 'be a string (for DOM elements) or a ReactClass (for composite ' + 'components).' ) : null); var element = ReactElement.createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used. // TODO: Drop this when these are no longer allowed as the type argument. if (element == null) { return element; } for (var i = 2; i < arguments.length; i++) { validateChildKeys(arguments[i], type); } validatePropTypes(element); return element; }, createFactory: function(type) { var validatedFactory = ReactElementValidator.createElement.bind( null, type ); // Legacy hook TODO: Warn if this is accessed validatedFactory.type = type; if ("production" !== "development") { try { Object.defineProperty( validatedFactory, 'type', { enumerable: false, get: function() { ("production" !== "development" ? warning( false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.' ) : null); Object.defineProperty(this, 'type', { value: type }); return type; } } ); } catch (x) { // IE will fail on defineProperty (es5-shim/sham too) } } return validatedFactory; }, cloneElement: function(element, props, children) { var newElement = ReactElement.cloneElement.apply(this, arguments); for (var i = 2; i < arguments.length; i++) { validateChildKeys(arguments[i], newElement.type); } validatePropTypes(newElement); return newElement; } }; module.exports = ReactElementValidator; },{"126":126,"135":135,"154":154,"39":39,"57":57,"63":63,"73":73,"76":76,"77":77}],59:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactEmptyComponent */ 'use strict'; var ReactElement = _dereq_(57); var ReactInstanceMap = _dereq_(67); var invariant = _dereq_(135); var component; // This registry keeps track of the React IDs of the components that rendered to // `null` (in reality a placeholder such as `noscript`) var nullComponentIDsRegistry = {}; var ReactEmptyComponentInjection = { injectEmptyComponent: function(emptyComponent) { component = ReactElement.createFactory(emptyComponent); } }; var ReactEmptyComponentType = function() {}; ReactEmptyComponentType.prototype.componentDidMount = function() { var internalInstance = ReactInstanceMap.get(this); // TODO: Make sure we run these methods in the correct order, we shouldn't // need this check. We're going to assume if we're here it means we ran // componentWillUnmount already so there is no internal instance (it gets // removed as part of the unmounting process). if (!internalInstance) { return; } registerNullComponentID(internalInstance._rootNodeID); }; ReactEmptyComponentType.prototype.componentWillUnmount = function() { var internalInstance = ReactInstanceMap.get(this); // TODO: Get rid of this check. See TODO in componentDidMount. if (!internalInstance) { return; } deregisterNullComponentID(internalInstance._rootNodeID); }; ReactEmptyComponentType.prototype.render = function() { ("production" !== "development" ? invariant( component, 'Trying to return null from a render, but no null placeholder component ' + 'was injected.' ) : invariant(component)); return component(); }; var emptyElement = ReactElement.createElement(ReactEmptyComponentType); /** * Mark the component as having rendered to null. * @param {string} id Component's `_rootNodeID`. */ function registerNullComponentID(id) { nullComponentIDsRegistry[id] = true; } /** * Unmark the component as having rendered to null: it renders to something now. * @param {string} id Component's `_rootNodeID`. */ function deregisterNullComponentID(id) { delete nullComponentIDsRegistry[id]; } /** * @param {string} id Component's `_rootNodeID`. * @return {boolean} True if the component is rendered to null. */ function isNullComponentID(id) { return !!nullComponentIDsRegistry[id]; } var ReactEmptyComponent = { emptyElement: emptyElement, injection: ReactEmptyComponentInjection, isNullComponentID: isNullComponentID }; module.exports = ReactEmptyComponent; },{"135":135,"57":57,"67":67}],60:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactErrorUtils * @typechecks */ "use strict"; var ReactErrorUtils = { /** * Creates a guarded version of a function. This is supposed to make debugging * of event handlers easier. To aid debugging with the browser's debugger, * this currently simply returns the original function. * * @param {function} func Function to be executed * @param {string} name The name of the guard * @return {function} */ guard: function(func, name) { return func; } }; module.exports = ReactErrorUtils; },{}],61:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactEventEmitterMixin */ 'use strict'; var EventPluginHub = _dereq_(17); function runEventQueueInBatch(events) { EventPluginHub.enqueueEvents(events); EventPluginHub.processEventQueue(); } var ReactEventEmitterMixin = { /** * Streams a fired top-level event to `EventPluginHub` where plugins have the * opportunity to create `ReactEvent`s to be dispatched. * * @param {string} topLevelType Record from `EventConstants`. * @param {object} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native environment event. */ handleTopLevel: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { var events = EventPluginHub.extractEvents( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent ); runEventQueueInBatch(events); } }; module.exports = ReactEventEmitterMixin; },{"17":17}],62:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactEventListener * @typechecks static-only */ 'use strict'; var EventListener = _dereq_(16); var ExecutionEnvironment = _dereq_(21); var PooledClass = _dereq_(28); var ReactInstanceHandles = _dereq_(66); var ReactMount = _dereq_(70); var ReactUpdates = _dereq_(87); var assign = _dereq_(27); var getEventTarget = _dereq_(125); var getUnboundedScrollPosition = _dereq_(131); /** * Finds the parent React component of `node`. * * @param {*} node * @return {?DOMEventTarget} Parent container, or `null` if the specified node * is not nested. */ function findParent(node) { // TODO: It may be a good idea to cache this to prevent unnecessary DOM // traversal, but caching is difficult to do correctly without using a // mutation observer to listen for all DOM changes. var nodeID = ReactMount.getID(node); var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID); var container = ReactMount.findReactContainerForID(rootID); var parent = ReactMount.getFirstReactDOM(container); return parent; } // Used to store ancestor hierarchy in top level callback function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) { this.topLevelType = topLevelType; this.nativeEvent = nativeEvent; this.ancestors = []; } assign(TopLevelCallbackBookKeeping.prototype, { destructor: function() { this.topLevelType = null; this.nativeEvent = null; this.ancestors.length = 0; } }); PooledClass.addPoolingTo( TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler ); function handleTopLevelImpl(bookKeeping) { var topLevelTarget = ReactMount.getFirstReactDOM( getEventTarget(bookKeeping.nativeEvent) ) || window; // Loop through the hierarchy, in case there's any nested components. // It's important that we build the array of ancestors before calling any // event handlers, because event handlers can modify the DOM, leading to // inconsistencies with ReactMount's node cache. See #1105. var ancestor = topLevelTarget; while (ancestor) { bookKeeping.ancestors.push(ancestor); ancestor = findParent(ancestor); } for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) { topLevelTarget = bookKeeping.ancestors[i]; var topLevelTargetID = ReactMount.getID(topLevelTarget) || ''; ReactEventListener._handleTopLevel( bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent ); } } function scrollValueMonitor(cb) { var scrollPosition = getUnboundedScrollPosition(window); cb(scrollPosition); } var ReactEventListener = { _enabled: true, _handleTopLevel: null, WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null, setHandleTopLevel: function(handleTopLevel) { ReactEventListener._handleTopLevel = handleTopLevel; }, setEnabled: function(enabled) { ReactEventListener._enabled = !!enabled; }, isEnabled: function() { return ReactEventListener._enabled; }, /** * Traps top-level events by using event bubbling. * * @param {string} topLevelType Record from `EventConstants`. * @param {string} handlerBaseName Event name (e.g. "click"). * @param {object} handle Element on which to attach listener. * @return {object} An object with a remove function which will forcefully * remove the listener. * @internal */ trapBubbledEvent: function(topLevelType, handlerBaseName, handle) { var element = handle; if (!element) { return null; } return EventListener.listen( element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType) ); }, /** * Traps a top-level event by using event capturing. * * @param {string} topLevelType Record from `EventConstants`. * @param {string} handlerBaseName Event name (e.g. "click"). * @param {object} handle Element on which to attach listener. * @return {object} An object with a remove function which will forcefully * remove the listener. * @internal */ trapCapturedEvent: function(topLevelType, handlerBaseName, handle) { var element = handle; if (!element) { return null; } return EventListener.capture( element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType) ); }, monitorScrollValue: function(refresh) { var callback = scrollValueMonitor.bind(null, refresh); EventListener.listen(window, 'scroll', callback); }, dispatchEvent: function(topLevelType, nativeEvent) { if (!ReactEventListener._enabled) { return; } var bookKeeping = TopLevelCallbackBookKeeping.getPooled( topLevelType, nativeEvent ); try { // Event queue being processed in the same cycle allows // `preventDefault`. ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping); } finally { TopLevelCallbackBookKeeping.release(bookKeeping); } } }; module.exports = ReactEventListener; },{"125":125,"131":131,"16":16,"21":21,"27":27,"28":28,"66":66,"70":70,"87":87}],63:[function(_dereq_,module,exports){ /** * Copyright 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactFragment */ 'use strict'; var ReactElement = _dereq_(57); var warning = _dereq_(154); /** * We used to allow keyed objects to serve as a collection of ReactElements, * or nested sets. This allowed us a way to explicitly key a set a fragment of * components. This is now being replaced with an opaque data structure. * The upgrade path is to call React.addons.createFragment({ key: value }) to * create a keyed fragment. The resulting data structure is opaque, for now. */ if ("production" !== "development") { var fragmentKey = '_reactFragment'; var didWarnKey = '_reactDidWarn'; var canWarnForReactFragment = false; try { // Feature test. Don't even try to issue this warning if we can't use // enumerable: false. var dummy = function() { return 1; }; Object.defineProperty( {}, fragmentKey, {enumerable: false, value: true} ); Object.defineProperty( {}, 'key', {enumerable: true, get: dummy} ); canWarnForReactFragment = true; } catch (x) { } var proxyPropertyAccessWithWarning = function(obj, key) { Object.defineProperty(obj, key, { enumerable: true, get: function() { ("production" !== "development" ? warning( this[didWarnKey], 'A ReactFragment is an opaque type. Accessing any of its ' + 'properties is deprecated. Pass it to one of the React.Children ' + 'helpers.' ) : null); this[didWarnKey] = true; return this[fragmentKey][key]; }, set: function(value) { ("production" !== "development" ? warning( this[didWarnKey], 'A ReactFragment is an immutable opaque type. Mutating its ' + 'properties is deprecated.' ) : null); this[didWarnKey] = true; this[fragmentKey][key] = value; } }); }; var issuedWarnings = {}; var didWarnForFragment = function(fragment) { // We use the keys and the type of the value as a heuristic to dedupe the // warning to avoid spamming too much. var fragmentCacheKey = ''; for (var key in fragment) { fragmentCacheKey += key + ':' + (typeof fragment[key]) + ','; } var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey]; issuedWarnings[fragmentCacheKey] = true; return alreadyWarnedOnce; }; } var ReactFragment = { // Wrap a keyed object in an opaque proxy that warns you if you access any // of its properties. create: function(object) { if ("production" !== "development") { if (typeof object !== 'object' || !object || Array.isArray(object)) { ("production" !== "development" ? warning( false, 'React.addons.createFragment only accepts a single object.', object ) : null); return object; } if (ReactElement.isValidElement(object)) { ("production" !== "development" ? warning( false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.' ) : null); return object; } if (canWarnForReactFragment) { var proxy = {}; Object.defineProperty(proxy, fragmentKey, { enumerable: false, value: object }); Object.defineProperty(proxy, didWarnKey, { writable: true, enumerable: false, value: false }); for (var key in object) { proxyPropertyAccessWithWarning(proxy, key); } Object.preventExtensions(proxy); return proxy; } } return object; }, // Extract the original keyed object from the fragment opaque type. Warn if // a plain object is passed here. extract: function(fragment) { if ("production" !== "development") { if (canWarnForReactFragment) { if (!fragment[fragmentKey]) { ("production" !== "development" ? warning( didWarnForFragment(fragment), 'Any use of a keyed object should be wrapped in ' + 'React.addons.createFragment(object) before being passed as a ' + 'child.' ) : null); return fragment; } return fragment[fragmentKey]; } } return fragment; }, // Check if this is a fragment and if so, extract the keyed object. If it // is a fragment-like object, warn that it should be wrapped. Ignore if we // can't determine what kind of object this is. extractIfFragment: function(fragment) { if ("production" !== "development") { if (canWarnForReactFragment) { // If it is the opaque type, return the keyed object. if (fragment[fragmentKey]) { return fragment[fragmentKey]; } // Otherwise, check each property if it has an element, if it does // it is probably meant as a fragment, so we can warn early. Defer, // the warning to extract. for (var key in fragment) { if (fragment.hasOwnProperty(key) && ReactElement.isValidElement(fragment[key])) { // This looks like a fragment object, we should provide an // early warning. return ReactFragment.extract(fragment); } } } } return fragment; } }; module.exports = ReactFragment; },{"154":154,"57":57}],64:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactInjection */ 'use strict'; var DOMProperty = _dereq_(10); var EventPluginHub = _dereq_(17); var ReactComponentEnvironment = _dereq_(36); var ReactClass = _dereq_(33); var ReactEmptyComponent = _dereq_(59); var ReactBrowserEventEmitter = _dereq_(30); var ReactNativeComponent = _dereq_(73); var ReactDOMComponent = _dereq_(42); var ReactPerf = _dereq_(75); var ReactRootIndex = _dereq_(83); var ReactUpdates = _dereq_(87); var ReactInjection = { Component: ReactComponentEnvironment.injection, Class: ReactClass.injection, DOMComponent: ReactDOMComponent.injection, DOMProperty: DOMProperty.injection, EmptyComponent: ReactEmptyComponent.injection, EventPluginHub: EventPluginHub.injection, EventEmitter: ReactBrowserEventEmitter.injection, NativeComponent: ReactNativeComponent.injection, Perf: ReactPerf.injection, RootIndex: ReactRootIndex.injection, Updates: ReactUpdates.injection }; module.exports = ReactInjection; },{"10":10,"17":17,"30":30,"33":33,"36":36,"42":42,"59":59,"73":73,"75":75,"83":83,"87":87}],65:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactInputSelection */ 'use strict'; var ReactDOMSelection = _dereq_(50); var containsNode = _dereq_(109); var focusNode = _dereq_(119); var getActiveElement = _dereq_(121); function isInDocument(node) { return containsNode(document.documentElement, node); } /** * @ReactInputSelection: React input selection module. Based on Selection.js, * but modified to be suitable for react and has a couple of bug fixes (doesn't * assume buttons have range selections allowed). * Input selection module for React. */ var ReactInputSelection = { hasSelectionCapabilities: function(elem) { return elem && ( ((elem.nodeName === 'INPUT' && elem.type === 'text') || elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true') ); }, getSelectionInformation: function() { var focusedElem = getActiveElement(); return { focusedElem: focusedElem, selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null }; }, /** * @restoreSelection: If any selection information was potentially lost, * restore it. This is useful when performing operations that could remove dom * nodes and place them back in, resulting in focus being lost. */ restoreSelection: function(priorSelectionInformation) { var curFocusedElem = getActiveElement(); var priorFocusedElem = priorSelectionInformation.focusedElem; var priorSelectionRange = priorSelectionInformation.selectionRange; if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) { ReactInputSelection.setSelection( priorFocusedElem, priorSelectionRange ); } focusNode(priorFocusedElem); } }, /** * @getSelection: Gets the selection bounds of a focused textarea, input or * contentEditable node. * -@input: Look up selection bounds of this input * -@return {start: selectionStart, end: selectionEnd} */ getSelection: function(input) { var selection; if ('selectionStart' in input) { // Modern browser with input or textarea. selection = { start: input.selectionStart, end: input.selectionEnd }; } else if (document.selection && input.nodeName === 'INPUT') { // IE8 input. var range = document.selection.createRange(); // There can only be one selection per document in IE, so it must // be in our element. if (range.parentElement() === input) { selection = { start: -range.moveStart('character', -input.value.length), end: -range.moveEnd('character', -input.value.length) }; } } else { // Content editable or old IE textarea. selection = ReactDOMSelection.getOffsets(input); } return selection || {start: 0, end: 0}; }, /** * @setSelection: Sets the selection bounds of a textarea or input and focuses * the input. * -@input Set selection bounds of this input or textarea * -@offsets Object of same form that is returned from get* */ setSelection: function(input, offsets) { var start = offsets.start; var end = offsets.end; if (typeof end === 'undefined') { end = start; } if ('selectionStart' in input) { input.selectionStart = start; input.selectionEnd = Math.min(end, input.value.length); } else if (document.selection && input.nodeName === 'INPUT') { var range = input.createTextRange(); range.collapse(true); range.moveStart('character', start); range.moveEnd('character', end - start); range.select(); } else { ReactDOMSelection.setOffsets(input, offsets); } } }; module.exports = ReactInputSelection; },{"109":109,"119":119,"121":121,"50":50}],66:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactInstanceHandles * @typechecks static-only */ 'use strict'; var ReactRootIndex = _dereq_(83); var invariant = _dereq_(135); var SEPARATOR = '.'; var SEPARATOR_LENGTH = SEPARATOR.length; /** * Maximum depth of traversals before we consider the possibility of a bad ID. */ var MAX_TREE_DEPTH = 100; /** * Creates a DOM ID prefix to use when mounting React components. * * @param {number} index A unique integer * @return {string} React root ID. * @internal */ function getReactRootIDString(index) { return SEPARATOR + index.toString(36); } /** * Checks if a character in the supplied ID is a separator or the end. * * @param {string} id A React DOM ID. * @param {number} index Index of the character to check. * @return {boolean} True if the character is a separator or end of the ID. * @private */ function isBoundary(id, index) { return id.charAt(index) === SEPARATOR || index === id.length; } /** * Checks if the supplied string is a valid React DOM ID. * * @param {string} id A React DOM ID, maybe. * @return {boolean} True if the string is a valid React DOM ID. * @private */ function isValidID(id) { return id === '' || ( id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR ); } /** * Checks if the first ID is an ancestor of or equal to the second ID. * * @param {string} ancestorID * @param {string} descendantID * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`. * @internal */ function isAncestorIDOf(ancestorID, descendantID) { return ( descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length) ); } /** * Gets the parent ID of the supplied React DOM ID, `id`. * * @param {string} id ID of a component. * @return {string} ID of the parent, or an empty string. * @private */ function getParentID(id) { return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : ''; } /** * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the * supplied `destinationID`. If they are equal, the ID is returned. * * @param {string} ancestorID ID of an ancestor node of `destinationID`. * @param {string} destinationID ID of the destination node. * @return {string} Next ID on the path from `ancestorID` to `destinationID`. * @private */ function getNextDescendantID(ancestorID, destinationID) { ("production" !== "development" ? invariant( isValidID(ancestorID) && isValidID(destinationID), 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID ) : invariant(isValidID(ancestorID) && isValidID(destinationID))); ("production" !== "development" ? invariant( isAncestorIDOf(ancestorID, destinationID), 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID ) : invariant(isAncestorIDOf(ancestorID, destinationID))); if (ancestorID === destinationID) { return ancestorID; } // Skip over the ancestor and the immediate separator. Traverse until we hit // another separator or we reach the end of `destinationID`. var start = ancestorID.length + SEPARATOR_LENGTH; var i; for (i = start; i < destinationID.length; i++) { if (isBoundary(destinationID, i)) { break; } } return destinationID.substr(0, i); } /** * Gets the nearest common ancestor ID of two IDs. * * Using this ID scheme, the nearest common ancestor ID is the longest common * prefix of the two IDs that immediately preceded a "marker" in both strings. * * @param {string} oneID * @param {string} twoID * @return {string} Nearest common ancestor ID, or the empty string if none. * @private */ function getFirstCommonAncestorID(oneID, twoID) { var minLength = Math.min(oneID.length, twoID.length); if (minLength === 0) { return ''; } var lastCommonMarkerIndex = 0; // Use `<=` to traverse until the "EOL" of the shorter string. for (var i = 0; i <= minLength; i++) { if (isBoundary(oneID, i) && isBoundary(twoID, i)) { lastCommonMarkerIndex = i; } else if (oneID.charAt(i) !== twoID.charAt(i)) { break; } } var longestCommonID = oneID.substr(0, lastCommonMarkerIndex); ("production" !== "development" ? invariant( isValidID(longestCommonID), 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID ) : invariant(isValidID(longestCommonID))); return longestCommonID; } /** * Traverses the parent path between two IDs (either up or down). The IDs must * not be the same, and there must exist a parent path between them. If the * callback returns `false`, traversal is stopped. * * @param {?string} start ID at which to start traversal. * @param {?string} stop ID at which to end traversal. * @param {function} cb Callback to invoke each ID with. * @param {?boolean} skipFirst Whether or not to skip the first node. * @param {?boolean} skipLast Whether or not to skip the last node. * @private */ function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) { start = start || ''; stop = stop || ''; ("production" !== "development" ? invariant( start !== stop, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start ) : invariant(start !== stop)); var traverseUp = isAncestorIDOf(stop, start); ("production" !== "development" ? invariant( traverseUp || isAncestorIDOf(start, stop), 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop ) : invariant(traverseUp || isAncestorIDOf(start, stop))); // Traverse from `start` to `stop` one depth at a time. var depth = 0; var traverse = traverseUp ? getParentID : getNextDescendantID; for (var id = start; /* until break */; id = traverse(id, stop)) { var ret; if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) { ret = cb(id, traverseUp, arg); } if (ret === false || id === stop) { // Only break //after// visiting `stop`. break; } ("production" !== "development" ? invariant( depth++ < MAX_TREE_DEPTH, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop ) : invariant(depth++ < MAX_TREE_DEPTH)); } } /** * Manages the IDs assigned to DOM representations of React components. This * uses a specific scheme in order to traverse the DOM efficiently (e.g. in * order to simulate events). * * @internal */ var ReactInstanceHandles = { /** * Constructs a React root ID * @return {string} A React root ID. */ createReactRootID: function() { return getReactRootIDString(ReactRootIndex.createReactRootIndex()); }, /** * Constructs a React ID by joining a root ID with a name. * * @param {string} rootID Root ID of a parent component. * @param {string} name A component's name (as flattened children). * @return {string} A React ID. * @internal */ createReactID: function(rootID, name) { return rootID + name; }, /** * Gets the DOM ID of the React component that is the root of the tree that * contains the React component with the supplied DOM ID. * * @param {string} id DOM ID of a React component. * @return {?string} DOM ID of the React component that is the root. * @internal */ getReactRootIDFromNodeID: function(id) { if (id && id.charAt(0) === SEPARATOR && id.length > 1) { var index = id.indexOf(SEPARATOR, 1); return index > -1 ? id.substr(0, index) : id; } return null; }, /** * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that * should would receive a `mouseEnter` or `mouseLeave` event. * * NOTE: Does not invoke the callback on the nearest common ancestor because * nothing "entered" or "left" that element. * * @param {string} leaveID ID being left. * @param {string} enterID ID being entered. * @param {function} cb Callback to invoke on each entered/left ID. * @param {*} upArg Argument to invoke the callback with on left IDs. * @param {*} downArg Argument to invoke the callback with on entered IDs. * @internal */ traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) { var ancestorID = getFirstCommonAncestorID(leaveID, enterID); if (ancestorID !== leaveID) { traverseParentPath(leaveID, ancestorID, cb, upArg, false, true); } if (ancestorID !== enterID) { traverseParentPath(ancestorID, enterID, cb, downArg, true, false); } }, /** * Simulates the traversal of a two-phase, capture/bubble event dispatch. * * NOTE: This traversal happens on IDs without touching the DOM. * * @param {string} targetID ID of the target node. * @param {function} cb Callback to invoke. * @param {*} arg Argument to invoke the callback with. * @internal */ traverseTwoPhase: function(targetID, cb, arg) { if (targetID) { traverseParentPath('', targetID, cb, arg, true, false); traverseParentPath(targetID, '', cb, arg, false, true); } }, /** * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For * example, passing `.0.$row-0.1` would result in `cb` getting called * with `.0`, `.0.$row-0`, and `.0.$row-0.1`. * * NOTE: This traversal happens on IDs without touching the DOM. * * @param {string} targetID ID of the target node. * @param {function} cb Callback to invoke. * @param {*} arg Argument to invoke the callback with. * @internal */ traverseAncestors: function(targetID, cb, arg) { traverseParentPath('', targetID, cb, arg, true, false); }, /** * Exposed for unit testing. * @private */ _getFirstCommonAncestorID: getFirstCommonAncestorID, /** * Exposed for unit testing. * @private */ _getNextDescendantID: getNextDescendantID, isAncestorIDOf: isAncestorIDOf, SEPARATOR: SEPARATOR }; module.exports = ReactInstanceHandles; },{"135":135,"83":83}],67:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactInstanceMap */ 'use strict'; /** * `ReactInstanceMap` maintains a mapping from a public facing stateful * instance (key) and the internal representation (value). This allows public * methods to accept the user facing instance as an argument and map them back * to internal methods. */ // TODO: Replace this with ES6: var ReactInstanceMap = new Map(); var ReactInstanceMap = { /** * This API should be called `delete` but we'd have to make sure to always * transform these to strings for IE support. When this transform is fully * supported we can rename it. */ remove: function(key) { key._reactInternalInstance = undefined; }, get: function(key) { return key._reactInternalInstance; }, has: function(key) { return key._reactInternalInstance !== undefined; }, set: function(key, value) { key._reactInternalInstance = value; } }; module.exports = ReactInstanceMap; },{}],68:[function(_dereq_,module,exports){ /** * Copyright 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactLifeCycle */ 'use strict'; /** * This module manages the bookkeeping when a component is in the process * of being mounted or being unmounted. This is used as a way to enforce * invariants (or warnings) when it is not recommended to call * setState/forceUpdate. * * currentlyMountingInstance: During the construction phase, it is not possible * to trigger an update since the instance is not fully mounted yet. However, we * currently allow this as a convenience for mutating the initial state. * * currentlyUnmountingInstance: During the unmounting phase, the instance is * still mounted and can therefore schedule an update. However, this is not * recommended and probably an error since it's about to be unmounted. * Therefore we still want to trigger in an error for that case. */ var ReactLifeCycle = { currentlyMountingInstance: null, currentlyUnmountingInstance: null }; module.exports = ReactLifeCycle; },{}],69:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactMarkupChecksum */ 'use strict'; var adler32 = _dereq_(106); var ReactMarkupChecksum = { CHECKSUM_ATTR_NAME: 'data-react-checksum', /** * @param {string} markup Markup string * @return {string} Markup string with checksum attribute attached */ addChecksumToMarkup: function(markup) { var checksum = adler32(markup); return markup.replace( '>', ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">' ); }, /** * @param {string} markup to use * @param {DOMElement} element root React element * @returns {boolean} whether or not the markup is the same */ canReuseMarkup: function(markup, element) { var existingChecksum = element.getAttribute( ReactMarkupChecksum.CHECKSUM_ATTR_NAME ); existingChecksum = existingChecksum && parseInt(existingChecksum, 10); var markupChecksum = adler32(markup); return markupChecksum === existingChecksum; } }; module.exports = ReactMarkupChecksum; },{"106":106}],70:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactMount */ 'use strict'; var DOMProperty = _dereq_(10); var ReactBrowserEventEmitter = _dereq_(30); var ReactCurrentOwner = _dereq_(39); var ReactElement = _dereq_(57); var ReactElementValidator = _dereq_(58); var ReactEmptyComponent = _dereq_(59); var ReactInstanceHandles = _dereq_(66); var ReactInstanceMap = _dereq_(67); var ReactMarkupChecksum = _dereq_(69); var ReactPerf = _dereq_(75); var ReactReconciler = _dereq_(81); var ReactUpdateQueue = _dereq_(86); var ReactUpdates = _dereq_(87); var emptyObject = _dereq_(115); var containsNode = _dereq_(109); var getReactRootElementInContainer = _dereq_(129); var instantiateReactComponent = _dereq_(134); var invariant = _dereq_(135); var setInnerHTML = _dereq_(148); var shouldUpdateReactComponent = _dereq_(151); var warning = _dereq_(154); var SEPARATOR = ReactInstanceHandles.SEPARATOR; var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; var nodeCache = {}; var ELEMENT_NODE_TYPE = 1; var DOC_NODE_TYPE = 9; /** Mapping from reactRootID to React component instance. */ var instancesByReactRootID = {}; /** Mapping from reactRootID to `container` nodes. */ var containersByReactRootID = {}; if ("production" !== "development") { /** __DEV__-only mapping from reactRootID to root elements. */ var rootElementsByReactRootID = {}; } // Used to store breadth-first search state in findComponentRoot. var findComponentRootReusableArray = []; /** * Finds the index of the first character * that's not common between the two given strings. * * @return {number} the index of the character where the strings diverge */ function firstDifferenceIndex(string1, string2) { var minLen = Math.min(string1.length, string2.length); for (var i = 0; i < minLen; i++) { if (string1.charAt(i) !== string2.charAt(i)) { return i; } } return string1.length === string2.length ? -1 : minLen; } /** * @param {DOMElement} container DOM element that may contain a React component. * @return {?string} A "reactRoot" ID, if a React component is rendered. */ function getReactRootID(container) { var rootElement = getReactRootElementInContainer(container); return rootElement && ReactMount.getID(rootElement); } /** * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form * element can return its control whose name or ID equals ATTR_NAME. All * DOM nodes support `getAttributeNode` but this can also get called on * other objects so just return '' if we're given something other than a * DOM node (such as window). * * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node. * @return {string} ID of the supplied `domNode`. */ function getID(node) { var id = internalGetID(node); if (id) { if (nodeCache.hasOwnProperty(id)) { var cached = nodeCache[id]; if (cached !== node) { ("production" !== "development" ? invariant( !isValid(cached, id), 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id ) : invariant(!isValid(cached, id))); nodeCache[id] = node; } } else { nodeCache[id] = node; } } return id; } function internalGetID(node) { // If node is something like a window, document, or text node, none of // which support attributes or a .getAttribute method, gracefully return // the empty string, as if the attribute were missing. return node && node.getAttribute && node.getAttribute(ATTR_NAME) || ''; } /** * Sets the React-specific ID of the given node. * * @param {DOMElement} node The DOM node whose ID will be set. * @param {string} id The value of the ID attribute. */ function setID(node, id) { var oldID = internalGetID(node); if (oldID !== id) { delete nodeCache[oldID]; } node.setAttribute(ATTR_NAME, id); nodeCache[id] = node; } /** * Finds the node with the supplied React-generated DOM ID. * * @param {string} id A React-generated DOM ID. * @return {DOMElement} DOM node with the suppled `id`. * @internal */ function getNode(id) { if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) { nodeCache[id] = ReactMount.findReactNodeByID(id); } return nodeCache[id]; } /** * Finds the node with the supplied public React instance. * * @param {*} instance A public React instance. * @return {?DOMElement} DOM node with the suppled `id`. * @internal */ function getNodeFromInstance(instance) { var id = ReactInstanceMap.get(instance)._rootNodeID; if (ReactEmptyComponent.isNullComponentID(id)) { return null; } if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) { nodeCache[id] = ReactMount.findReactNodeByID(id); } return nodeCache[id]; } /** * A node is "valid" if it is contained by a currently mounted container. * * This means that the node does not have to be contained by a document in * order to be considered valid. * * @param {?DOMElement} node The candidate DOM node. * @param {string} id The expected ID of the node. * @return {boolean} Whether the node is contained by a mounted container. */ function isValid(node, id) { if (node) { ("production" !== "development" ? invariant( internalGetID(node) === id, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME ) : invariant(internalGetID(node) === id)); var container = ReactMount.findReactContainerForID(id); if (container && containsNode(container, node)) { return true; } } return false; } /** * Causes the cache to forget about one React-specific ID. * * @param {string} id The ID to forget. */ function purgeID(id) { delete nodeCache[id]; } var deepestNodeSoFar = null; function findDeepestCachedAncestorImpl(ancestorID) { var ancestor = nodeCache[ancestorID]; if (ancestor && isValid(ancestor, ancestorID)) { deepestNodeSoFar = ancestor; } else { // This node isn't populated in the cache, so presumably none of its // descendants are. Break out of the loop. return false; } } /** * Return the deepest cached node whose ID is a prefix of `targetID`. */ function findDeepestCachedAncestor(targetID) { deepestNodeSoFar = null; ReactInstanceHandles.traverseAncestors( targetID, findDeepestCachedAncestorImpl ); var foundNode = deepestNodeSoFar; deepestNodeSoFar = null; return foundNode; } /** * Mounts this component and inserts it into the DOM. * * @param {ReactComponent} componentInstance The instance to mount. * @param {string} rootID DOM ID of the root node. * @param {DOMElement} container DOM element to mount into. * @param {ReactReconcileTransaction} transaction * @param {boolean} shouldReuseMarkup If true, do not insert markup */ function mountComponentIntoNode( componentInstance, rootID, container, transaction, shouldReuseMarkup) { var markup = ReactReconciler.mountComponent( componentInstance, rootID, transaction, emptyObject ); componentInstance._isTopLevel = true; ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup); } /** * Batched mount. * * @param {ReactComponent} componentInstance The instance to mount. * @param {string} rootID DOM ID of the root node. * @param {DOMElement} container DOM element to mount into. * @param {boolean} shouldReuseMarkup If true, do not insert markup */ function batchedMountComponentIntoNode( componentInstance, rootID, container, shouldReuseMarkup) { var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(); transaction.perform( mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup ); ReactUpdates.ReactReconcileTransaction.release(transaction); } /** * Mounting is the process of initializing a React component by creating its * representative DOM elements and inserting them into a supplied `container`. * Any prior content inside `container` is destroyed in the process. * * ReactMount.render( * component, * document.getElementById('container') * ); * * <div id="container"> <-- Supplied `container`. * <div data-reactid=".3"> <-- Rendered reactRoot of React * // ... component. * </div> * </div> * * Inside of `container`, the first element rendered is the "reactRoot". */ var ReactMount = { /** Exposed for debugging purposes **/ _instancesByReactRootID: instancesByReactRootID, /** * This is a hook provided to support rendering React components while * ensuring that the apparent scroll position of its `container` does not * change. * * @param {DOMElement} container The `container` being rendered into. * @param {function} renderCallback This must be called once to do the render. */ scrollMonitor: function(container, renderCallback) { renderCallback(); }, /** * Take a component that's already mounted into the DOM and replace its props * @param {ReactComponent} prevComponent component instance already in the DOM * @param {ReactElement} nextElement component instance to render * @param {DOMElement} container container to render into * @param {?function} callback function triggered on completion */ _updateRootComponent: function( prevComponent, nextElement, container, callback) { if ("production" !== "development") { ReactElementValidator.checkAndWarnForMutatedProps(nextElement); } ReactMount.scrollMonitor(container, function() { ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement); if (callback) { ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback); } }); if ("production" !== "development") { // Record the root element in case it later gets transplanted. rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container); } return prevComponent; }, /** * Register a component into the instance map and starts scroll value * monitoring * @param {ReactComponent} nextComponent component instance to render * @param {DOMElement} container container to render into * @return {string} reactRoot ID prefix */ _registerComponent: function(nextComponent, container) { ("production" !== "development" ? invariant( container && ( (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE) ), '_registerComponent(...): Target container is not a DOM element.' ) : invariant(container && ( (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE) ))); ReactBrowserEventEmitter.ensureScrollValueMonitoring(); var reactRootID = ReactMount.registerContainer(container); instancesByReactRootID[reactRootID] = nextComponent; return reactRootID; }, /** * Render a new component into the DOM. * @param {ReactElement} nextElement element to render * @param {DOMElement} container container to render into * @param {boolean} shouldReuseMarkup if we should skip the markup insertion * @return {ReactComponent} nextComponent */ _renderNewRootComponent: function( nextElement, container, shouldReuseMarkup ) { // Various parts of our code (such as ReactCompositeComponent's // _renderValidatedComponent) assume that calls to render aren't nested; // verify that that's the case. ("production" !== "development" ? warning( ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate.' ) : null); var componentInstance = instantiateReactComponent(nextElement, null); var reactRootID = ReactMount._registerComponent( componentInstance, container ); // The initial render is synchronous but any updates that happen during // rendering, in componentWillMount or componentDidMount, will be batched // according to the current batching strategy. ReactUpdates.batchedUpdates( batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup ); if ("production" !== "development") { // Record the root element in case it later gets transplanted. rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container); } return componentInstance; }, /** * Renders a React component into the DOM in the supplied `container`. * * If the React component was previously rendered into `container`, this will * perform an update on it and only mutate the DOM as necessary to reflect the * latest React component. * * @param {ReactElement} nextElement Component element to render. * @param {DOMElement} container DOM element to render into. * @param {?function} callback function triggered on completion * @return {ReactComponent} Component instance rendered in `container`. */ render: function(nextElement, container, callback) { ("production" !== "development" ? invariant( ReactElement.isValidElement(nextElement), 'React.render(): Invalid component element.%s', ( typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : // Check if it quacks like an element nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '' ) ) : invariant(ReactElement.isValidElement(nextElement))); var prevComponent = instancesByReactRootID[getReactRootID(container)]; if (prevComponent) { var prevElement = prevComponent._currentElement; if (shouldUpdateReactComponent(prevElement, nextElement)) { return ReactMount._updateRootComponent( prevComponent, nextElement, container, callback ).getPublicInstance(); } else { ReactMount.unmountComponentAtNode(container); } } var reactRootElement = getReactRootElementInContainer(container); var containerHasReactMarkup = reactRootElement && ReactMount.isRenderedByReact(reactRootElement); if ("production" !== "development") { if (!containerHasReactMarkup || reactRootElement.nextSibling) { var rootElementSibling = reactRootElement; while (rootElementSibling) { if (ReactMount.isRenderedByReact(rootElementSibling)) { ("production" !== "development" ? warning( false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.' ) : null); break; } rootElementSibling = rootElementSibling.nextSibling; } } } var shouldReuseMarkup = containerHasReactMarkup && !prevComponent; var component = ReactMount._renderNewRootComponent( nextElement, container, shouldReuseMarkup ).getPublicInstance(); if (callback) { callback.call(component); } return component; }, /** * Constructs a component instance of `constructor` with `initialProps` and * renders it into the supplied `container`. * * @param {function} constructor React component constructor. * @param {?object} props Initial props of the component instance. * @param {DOMElement} container DOM element to render into. * @return {ReactComponent} Component instance rendered in `container`. */ constructAndRenderComponent: function(constructor, props, container) { var element = ReactElement.createElement(constructor, props); return ReactMount.render(element, container); }, /** * Constructs a component instance of `constructor` with `initialProps` and * renders it into a container node identified by supplied `id`. * * @param {function} componentConstructor React component constructor * @param {?object} props Initial props of the component instance. * @param {string} id ID of the DOM element to render into. * @return {ReactComponent} Component instance rendered in the container node. */ constructAndRenderComponentByID: function(constructor, props, id) { var domNode = document.getElementById(id); ("production" !== "development" ? invariant( domNode, 'Tried to get element with id of "%s" but it is not present on the page.', id ) : invariant(domNode)); return ReactMount.constructAndRenderComponent(constructor, props, domNode); }, /** * Registers a container node into which React components will be rendered. * This also creates the "reactRoot" ID that will be assigned to the element * rendered within. * * @param {DOMElement} container DOM element to register as a container. * @return {string} The "reactRoot" ID of elements rendered within. */ registerContainer: function(container) { var reactRootID = getReactRootID(container); if (reactRootID) { // If one exists, make sure it is a valid "reactRoot" ID. reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID); } if (!reactRootID) { // No valid "reactRoot" ID found, create one. reactRootID = ReactInstanceHandles.createReactRootID(); } containersByReactRootID[reactRootID] = container; return reactRootID; }, /** * Unmounts and destroys the React component rendered in the `container`. * * @param {DOMElement} container DOM element containing a React component. * @return {boolean} True if a component was found in and unmounted from * `container` */ unmountComponentAtNode: function(container) { // Various parts of our code (such as ReactCompositeComponent's // _renderValidatedComponent) assume that calls to render aren't nested; // verify that that's the case. (Strictly speaking, unmounting won't cause a // render but we still don't expect to be in a render call here.) ("production" !== "development" ? warning( ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function of ' + 'props and state; triggering nested component updates from render is ' + 'not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate.' ) : null); ("production" !== "development" ? invariant( container && ( (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE) ), 'unmountComponentAtNode(...): Target container is not a DOM element.' ) : invariant(container && ( (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE) ))); var reactRootID = getReactRootID(container); var component = instancesByReactRootID[reactRootID]; if (!component) { return false; } ReactMount.unmountComponentFromNode(component, container); delete instancesByReactRootID[reactRootID]; delete containersByReactRootID[reactRootID]; if ("production" !== "development") { delete rootElementsByReactRootID[reactRootID]; } return true; }, /** * Unmounts a component and removes it from the DOM. * * @param {ReactComponent} instance React component instance. * @param {DOMElement} container DOM element to unmount from. * @final * @internal * @see {ReactMount.unmountComponentAtNode} */ unmountComponentFromNode: function(instance, container) { ReactReconciler.unmountComponent(instance); if (container.nodeType === DOC_NODE_TYPE) { container = container.documentElement; } // http://jsperf.com/emptying-a-node while (container.lastChild) { container.removeChild(container.lastChild); } }, /** * Finds the container DOM element that contains React component to which the * supplied DOM `id` belongs. * * @param {string} id The ID of an element rendered by a React component. * @return {?DOMElement} DOM element that contains the `id`. */ findReactContainerForID: function(id) { var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id); var container = containersByReactRootID[reactRootID]; if ("production" !== "development") { var rootElement = rootElementsByReactRootID[reactRootID]; if (rootElement && rootElement.parentNode !== container) { ("production" !== "development" ? invariant( // Call internalGetID here because getID calls isValid which calls // findReactContainerForID (this function). internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.' ) : invariant(// Call internalGetID here because getID calls isValid which calls // findReactContainerForID (this function). internalGetID(rootElement) === reactRootID)); var containerChild = container.firstChild; if (containerChild && reactRootID === internalGetID(containerChild)) { // If the container has a new child with the same ID as the old // root element, then rootElementsByReactRootID[reactRootID] is // just stale and needs to be updated. The case that deserves a // warning is when the container is empty. rootElementsByReactRootID[reactRootID] = containerChild; } else { ("production" !== "development" ? warning( false, 'ReactMount: Root element has been removed from its original ' + 'container. New container:', rootElement.parentNode ) : null); } } } return container; }, /** * Finds an element rendered by React with the supplied ID. * * @param {string} id ID of a DOM node in the React component. * @return {DOMElement} Root DOM node of the React component. */ findReactNodeByID: function(id) { var reactRoot = ReactMount.findReactContainerForID(id); return ReactMount.findComponentRoot(reactRoot, id); }, /** * True if the supplied `node` is rendered by React. * * @param {*} node DOM Element to check. * @return {boolean} True if the DOM Element appears to be rendered by React. * @internal */ isRenderedByReact: function(node) { if (node.nodeType !== 1) { // Not a DOMElement, therefore not a React component return false; } var id = ReactMount.getID(node); return id ? id.charAt(0) === SEPARATOR : false; }, /** * Traverses up the ancestors of the supplied node to find a node that is a * DOM representation of a React component. * * @param {*} node * @return {?DOMEventTarget} * @internal */ getFirstReactDOM: function(node) { var current = node; while (current && current.parentNode !== current) { if (ReactMount.isRenderedByReact(current)) { return current; } current = current.parentNode; } return null; }, /** * Finds a node with the supplied `targetID` inside of the supplied * `ancestorNode`. Exploits the ID naming scheme to perform the search * quickly. * * @param {DOMEventTarget} ancestorNode Search from this root. * @pararm {string} targetID ID of the DOM representation of the component. * @return {DOMEventTarget} DOM node with the supplied `targetID`. * @internal */ findComponentRoot: function(ancestorNode, targetID) { var firstChildren = findComponentRootReusableArray; var childIndex = 0; var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode; firstChildren[0] = deepestAncestor.firstChild; firstChildren.length = 1; while (childIndex < firstChildren.length) { var child = firstChildren[childIndex++]; var targetChild; while (child) { var childID = ReactMount.getID(child); if (childID) { // Even if we find the node we're looking for, we finish looping // through its siblings to ensure they're cached so that we don't have // to revisit this node again. Otherwise, we make n^2 calls to getID // when visiting the many children of a single node in order. if (targetID === childID) { targetChild = child; } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) { // If we find a child whose ID is an ancestor of the given ID, // then we can be sure that we only want to search the subtree // rooted at this child, so we can throw out the rest of the // search state. firstChildren.length = childIndex = 0; firstChildren.push(child.firstChild); } } else { // If this child had no ID, then there's a chance that it was // injected automatically by the browser, as when a `<table>` // element sprouts an extra `<tbody>` child as a side effect of // `.innerHTML` parsing. Optimistically continue down this // branch, but not before examining the other siblings. firstChildren.push(child.firstChild); } child = child.nextSibling; } if (targetChild) { // Emptying firstChildren/findComponentRootReusableArray is // not necessary for correctness, but it helps the GC reclaim // any nodes that were left at the end of the search. firstChildren.length = 0; return targetChild; } } firstChildren.length = 0; ("production" !== "development" ? invariant( false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode) ) : invariant(false)); }, _mountImageIntoNode: function(markup, container, shouldReuseMarkup) { ("production" !== "development" ? invariant( container && ( (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE) ), 'mountComponentIntoNode(...): Target container is not valid.' ) : invariant(container && ( (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE) ))); if (shouldReuseMarkup) { var rootElement = getReactRootElementInContainer(container); if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) { return; } else { var checksum = rootElement.getAttribute( ReactMarkupChecksum.CHECKSUM_ATTR_NAME ); rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); var rootMarkup = rootElement.outerHTML; rootElement.setAttribute( ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum ); var diffIndex = firstDifferenceIndex(markup, rootMarkup); var difference = ' (client) ' + markup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20); ("production" !== "development" ? invariant( container.nodeType !== DOC_NODE_TYPE, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference ) : invariant(container.nodeType !== DOC_NODE_TYPE)); if ("production" !== "development") { ("production" !== "development" ? warning( false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference ) : null); } } } ("production" !== "development" ? invariant( container.nodeType !== DOC_NODE_TYPE, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See React.renderToString() for server rendering.' ) : invariant(container.nodeType !== DOC_NODE_TYPE)); setInnerHTML(container, markup); }, /** * React ID utilities. */ getReactRootID: getReactRootID, getID: getID, setID: setID, getNode: getNode, getNodeFromInstance: getNodeFromInstance, purgeID: purgeID }; ReactPerf.measureMethods(ReactMount, 'ReactMount', { _renderNewRootComponent: '_renderNewRootComponent', _mountImageIntoNode: '_mountImageIntoNode' }); module.exports = ReactMount; },{"10":10,"109":109,"115":115,"129":129,"134":134,"135":135,"148":148,"151":151,"154":154,"30":30,"39":39,"57":57,"58":58,"59":59,"66":66,"67":67,"69":69,"75":75,"81":81,"86":86,"87":87}],71:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactMultiChild * @typechecks static-only */ 'use strict'; var ReactComponentEnvironment = _dereq_(36); var ReactMultiChildUpdateTypes = _dereq_(72); var ReactReconciler = _dereq_(81); var ReactChildReconciler = _dereq_(31); /** * Updating children of a component may trigger recursive updates. The depth is * used to batch recursive updates to render markup more efficiently. * * @type {number} * @private */ var updateDepth = 0; /** * Queue of update configuration objects. * * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`. * * @type {array<object>} * @private */ var updateQueue = []; /** * Queue of markup to be rendered. * * @type {array<string>} * @private */ var markupQueue = []; /** * Enqueues markup to be rendered and inserted at a supplied index. * * @param {string} parentID ID of the parent component. * @param {string} markup Markup that renders into an element. * @param {number} toIndex Destination index. * @private */ function enqueueMarkup(parentID, markup, toIndex) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.INSERT_MARKUP, markupIndex: markupQueue.push(markup) - 1, textContent: null, fromIndex: null, toIndex: toIndex }); } /** * Enqueues moving an existing element to another index. * * @param {string} parentID ID of the parent component. * @param {number} fromIndex Source index of the existing element. * @param {number} toIndex Destination index of the element. * @private */ function enqueueMove(parentID, fromIndex, toIndex) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.MOVE_EXISTING, markupIndex: null, textContent: null, fromIndex: fromIndex, toIndex: toIndex }); } /** * Enqueues removing an element at an index. * * @param {string} parentID ID of the parent component. * @param {number} fromIndex Index of the element to remove. * @private */ function enqueueRemove(parentID, fromIndex) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.REMOVE_NODE, markupIndex: null, textContent: null, fromIndex: fromIndex, toIndex: null }); } /** * Enqueues setting the text content. * * @param {string} parentID ID of the parent component. * @param {string} textContent Text content to set. * @private */ function enqueueTextContent(parentID, textContent) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.TEXT_CONTENT, markupIndex: null, textContent: textContent, fromIndex: null, toIndex: null }); } /** * Processes any enqueued updates. * * @private */ function processQueue() { if (updateQueue.length) { ReactComponentEnvironment.processChildrenUpdates( updateQueue, markupQueue ); clearQueue(); } } /** * Clears any enqueued updates. * * @private */ function clearQueue() { updateQueue.length = 0; markupQueue.length = 0; } /** * ReactMultiChild are capable of reconciling multiple children. * * @class ReactMultiChild * @internal */ var ReactMultiChild = { /** * Provides common functionality for components that must reconcile multiple * children. This is used by `ReactDOMComponent` to mount, update, and * unmount child components. * * @lends {ReactMultiChild.prototype} */ Mixin: { /** * Generates a "mount image" for each of the supplied children. In the case * of `ReactDOMComponent`, a mount image is a string of markup. * * @param {?object} nestedChildren Nested child maps. * @return {array} An array of mounted representations. * @internal */ mountChildren: function(nestedChildren, transaction, context) { var children = ReactChildReconciler.instantiateChildren( nestedChildren, transaction, context ); this._renderedChildren = children; var mountImages = []; var index = 0; for (var name in children) { if (children.hasOwnProperty(name)) { var child = children[name]; // Inlined for performance, see `ReactInstanceHandles.createReactID`. var rootID = this._rootNodeID + name; var mountImage = ReactReconciler.mountComponent( child, rootID, transaction, context ); child._mountIndex = index; mountImages.push(mountImage); index++; } } return mountImages; }, /** * Replaces any rendered children with a text content string. * * @param {string} nextContent String of content. * @internal */ updateTextContent: function(nextContent) { updateDepth++; var errorThrown = true; try { var prevChildren = this._renderedChildren; // Remove any rendered children. ReactChildReconciler.unmountChildren(prevChildren); // TODO: The setTextContent operation should be enough for (var name in prevChildren) { if (prevChildren.hasOwnProperty(name)) { this._unmountChildByName(prevChildren[name], name); } } // Set new text content. this.setTextContent(nextContent); errorThrown = false; } finally { updateDepth--; if (!updateDepth) { if (errorThrown) { clearQueue(); } else { processQueue(); } } } }, /** * Updates the rendered children with new children. * * @param {?object} nextNestedChildren Nested child maps. * @param {ReactReconcileTransaction} transaction * @internal */ updateChildren: function(nextNestedChildren, transaction, context) { updateDepth++; var errorThrown = true; try { this._updateChildren(nextNestedChildren, transaction, context); errorThrown = false; } finally { updateDepth--; if (!updateDepth) { if (errorThrown) { clearQueue(); } else { processQueue(); } } } }, /** * Improve performance by isolating this hot code path from the try/catch * block in `updateChildren`. * * @param {?object} nextNestedChildren Nested child maps. * @param {ReactReconcileTransaction} transaction * @final * @protected */ _updateChildren: function(nextNestedChildren, transaction, context) { var prevChildren = this._renderedChildren; var nextChildren = ReactChildReconciler.updateChildren( prevChildren, nextNestedChildren, transaction, context ); this._renderedChildren = nextChildren; if (!nextChildren && !prevChildren) { return; } var name; // `nextIndex` will increment for each child in `nextChildren`, but // `lastIndex` will be the last index visited in `prevChildren`. var lastIndex = 0; var nextIndex = 0; for (name in nextChildren) { if (!nextChildren.hasOwnProperty(name)) { continue; } var prevChild = prevChildren && prevChildren[name]; var nextChild = nextChildren[name]; if (prevChild === nextChild) { this.moveChild(prevChild, nextIndex, lastIndex); lastIndex = Math.max(prevChild._mountIndex, lastIndex); prevChild._mountIndex = nextIndex; } else { if (prevChild) { // Update `lastIndex` before `_mountIndex` gets unset by unmounting. lastIndex = Math.max(prevChild._mountIndex, lastIndex); this._unmountChildByName(prevChild, name); } // The child must be instantiated before it's mounted. this._mountChildByNameAtIndex( nextChild, name, nextIndex, transaction, context ); } nextIndex++; } // Remove children that are no longer present. for (name in prevChildren) { if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) { this._unmountChildByName(prevChildren[name], name); } } }, /** * Unmounts all rendered children. This should be used to clean up children * when this component is unmounted. * * @internal */ unmountChildren: function() { var renderedChildren = this._renderedChildren; ReactChildReconciler.unmountChildren(renderedChildren); this._renderedChildren = null; }, /** * Moves a child component to the supplied index. * * @param {ReactComponent} child Component to move. * @param {number} toIndex Destination index of the element. * @param {number} lastIndex Last index visited of the siblings of `child`. * @protected */ moveChild: function(child, toIndex, lastIndex) { // If the index of `child` is less than `lastIndex`, then it needs to // be moved. Otherwise, we do not need to move it because a child will be // inserted or moved before `child`. if (child._mountIndex < lastIndex) { enqueueMove(this._rootNodeID, child._mountIndex, toIndex); } }, /** * Creates a child component. * * @param {ReactComponent} child Component to create. * @param {string} mountImage Markup to insert. * @protected */ createChild: function(child, mountImage) { enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex); }, /** * Removes a child component. * * @param {ReactComponent} child Child to remove. * @protected */ removeChild: function(child) { enqueueRemove(this._rootNodeID, child._mountIndex); }, /** * Sets this text content string. * * @param {string} textContent Text content to set. * @protected */ setTextContent: function(textContent) { enqueueTextContent(this._rootNodeID, textContent); }, /** * Mounts a child with the supplied name. * * NOTE: This is part of `updateChildren` and is here for readability. * * @param {ReactComponent} child Component to mount. * @param {string} name Name of the child. * @param {number} index Index at which to insert the child. * @param {ReactReconcileTransaction} transaction * @private */ _mountChildByNameAtIndex: function( child, name, index, transaction, context) { // Inlined for performance, see `ReactInstanceHandles.createReactID`. var rootID = this._rootNodeID + name; var mountImage = ReactReconciler.mountComponent( child, rootID, transaction, context ); child._mountIndex = index; this.createChild(child, mountImage); }, /** * Unmounts a rendered child by name. * * NOTE: This is part of `updateChildren` and is here for readability. * * @param {ReactComponent} child Component to unmount. * @param {string} name Name of the child in `this._renderedChildren`. * @private */ _unmountChildByName: function(child, name) { this.removeChild(child); child._mountIndex = null; } } }; module.exports = ReactMultiChild; },{"31":31,"36":36,"72":72,"81":81}],72:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactMultiChildUpdateTypes */ 'use strict'; var keyMirror = _dereq_(140); /** * When a component's children are updated, a series of update configuration * objects are created in order to batch and serialize the required changes. * * Enumerates all the possible types of update configurations. * * @internal */ var ReactMultiChildUpdateTypes = keyMirror({ INSERT_MARKUP: null, MOVE_EXISTING: null, REMOVE_NODE: null, TEXT_CONTENT: null }); module.exports = ReactMultiChildUpdateTypes; },{"140":140}],73:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactNativeComponent */ 'use strict'; var assign = _dereq_(27); var invariant = _dereq_(135); var autoGenerateWrapperClass = null; var genericComponentClass = null; // This registry keeps track of wrapper classes around native tags var tagToComponentClass = {}; var textComponentClass = null; var ReactNativeComponentInjection = { // This accepts a class that receives the tag string. This is a catch all // that can render any kind of tag. injectGenericComponentClass: function(componentClass) { genericComponentClass = componentClass; }, // This accepts a text component class that takes the text string to be // rendered as props. injectTextComponentClass: function(componentClass) { textComponentClass = componentClass; }, // This accepts a keyed object with classes as values. Each key represents a // tag. That particular tag will use this class instead of the generic one. injectComponentClasses: function(componentClasses) { assign(tagToComponentClass, componentClasses); }, // Temporary hack since we expect DOM refs to behave like composites, // for this release. injectAutoWrapper: function(wrapperFactory) { autoGenerateWrapperClass = wrapperFactory; } }; /** * Get a composite component wrapper class for a specific tag. * * @param {ReactElement} element The tag for which to get the class. * @return {function} The React class constructor function. */ function getComponentClassForElement(element) { if (typeof element.type === 'function') { return element.type; } var tag = element.type; var componentClass = tagToComponentClass[tag]; if (componentClass == null) { tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag); } return componentClass; } /** * Get a native internal component class for a specific tag. * * @param {ReactElement} element The element to create. * @return {function} The internal class constructor function. */ function createInternalComponent(element) { ("production" !== "development" ? invariant( genericComponentClass, 'There is no registered component for the tag %s', element.type ) : invariant(genericComponentClass)); return new genericComponentClass(element.type, element.props); } /** * @param {ReactText} text * @return {ReactComponent} */ function createInstanceForText(text) { return new textComponentClass(text); } /** * @param {ReactComponent} component * @return {boolean} */ function isTextComponent(component) { return component instanceof textComponentClass; } var ReactNativeComponent = { getComponentClassForElement: getComponentClassForElement, createInternalComponent: createInternalComponent, createInstanceForText: createInstanceForText, isTextComponent: isTextComponent, injection: ReactNativeComponentInjection }; module.exports = ReactNativeComponent; },{"135":135,"27":27}],74:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactOwner */ 'use strict'; var invariant = _dereq_(135); /** * ReactOwners are capable of storing references to owned components. * * All components are capable of //being// referenced by owner components, but * only ReactOwner components are capable of //referencing// owned components. * The named reference is known as a "ref". * * Refs are available when mounted and updated during reconciliation. * * var MyComponent = React.createClass({ * render: function() { * return ( * <div onClick={this.handleClick}> * <CustomComponent ref="custom" /> * </div> * ); * }, * handleClick: function() { * this.refs.custom.handleClick(); * }, * componentDidMount: function() { * this.refs.custom.initialize(); * } * }); * * Refs should rarely be used. When refs are used, they should only be done to * control data that is not handled by React's data flow. * * @class ReactOwner */ var ReactOwner = { /** * @param {?object} object * @return {boolean} True if `object` is a valid owner. * @final */ isValidOwner: function(object) { return !!( (object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function') ); }, /** * Adds a component by ref to an owner component. * * @param {ReactComponent} component Component to reference. * @param {string} ref Name by which to refer to the component. * @param {ReactOwner} owner Component on which to record the ref. * @final * @internal */ addComponentAsRefTo: function(component, ref, owner) { ("production" !== "development" ? invariant( ReactOwner.isValidOwner(owner), 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to add a ref to a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.' ) : invariant(ReactOwner.isValidOwner(owner))); owner.attachRef(ref, component); }, /** * Removes a component by ref from an owner component. * * @param {ReactComponent} component Component to dereference. * @param {string} ref Name of the ref to remove. * @param {ReactOwner} owner Component on which the ref is recorded. * @final * @internal */ removeComponentAsRefFrom: function(component, ref, owner) { ("production" !== "development" ? invariant( ReactOwner.isValidOwner(owner), 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to remove a ref to a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.' ) : invariant(ReactOwner.isValidOwner(owner))); // Check that `component` is still the current ref because we do not want to // detach the ref if another component stole it. if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) { owner.detachRef(ref); } } }; module.exports = ReactOwner; },{"135":135}],75:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactPerf * @typechecks static-only */ 'use strict'; /** * ReactPerf is a general AOP system designed to measure performance. This * module only has the hooks: see ReactDefaultPerf for the analysis tool. */ var ReactPerf = { /** * Boolean to enable/disable measurement. Set to false by default to prevent * accidental logging and perf loss. */ enableMeasure: false, /** * Holds onto the measure function in use. By default, don't measure * anything, but we'll override this if we inject a measure function. */ storedMeasure: _noMeasure, /** * @param {object} object * @param {string} objectName * @param {object<string>} methodNames */ measureMethods: function(object, objectName, methodNames) { if ("production" !== "development") { for (var key in methodNames) { if (!methodNames.hasOwnProperty(key)) { continue; } object[key] = ReactPerf.measure( objectName, methodNames[key], object[key] ); } } }, /** * Use this to wrap methods you want to measure. Zero overhead in production. * * @param {string} objName * @param {string} fnName * @param {function} func * @return {function} */ measure: function(objName, fnName, func) { if ("production" !== "development") { var measuredFunc = null; var wrapper = function() { if (ReactPerf.enableMeasure) { if (!measuredFunc) { measuredFunc = ReactPerf.storedMeasure(objName, fnName, func); } return measuredFunc.apply(this, arguments); } return func.apply(this, arguments); }; wrapper.displayName = objName + '_' + fnName; return wrapper; } return func; }, injection: { /** * @param {function} measure */ injectMeasure: function(measure) { ReactPerf.storedMeasure = measure; } } }; /** * Simply passes through the measured function, without measuring it. * * @param {string} objName * @param {string} fnName * @param {function} func * @return {function} */ function _noMeasure(objName, fnName, func) { return func; } module.exports = ReactPerf; },{}],76:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactPropTypeLocationNames */ 'use strict'; var ReactPropTypeLocationNames = {}; if ("production" !== "development") { ReactPropTypeLocationNames = { prop: 'prop', context: 'context', childContext: 'child context' }; } module.exports = ReactPropTypeLocationNames; },{}],77:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactPropTypeLocations */ 'use strict'; var keyMirror = _dereq_(140); var ReactPropTypeLocations = keyMirror({ prop: null, context: null, childContext: null }); module.exports = ReactPropTypeLocations; },{"140":140}],78:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactPropTypes */ 'use strict'; var ReactElement = _dereq_(57); var ReactFragment = _dereq_(63); var ReactPropTypeLocationNames = _dereq_(76); var emptyFunction = _dereq_(114); /** * Collection of methods that allow declaration and validation of props that are * supplied to React components. Example usage: * * var Props = require('ReactPropTypes'); * var MyArticle = React.createClass({ * propTypes: { * // An optional string prop named "description". * description: Props.string, * * // A required enum prop named "category". * category: Props.oneOf(['News','Photos']).isRequired, * * // A prop named "dialog" that requires an instance of Dialog. * dialog: Props.instanceOf(Dialog).isRequired * }, * render: function() { ... } * }); * * A more formal specification of how these methods are used: * * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) * decl := ReactPropTypes.{type}(.isRequired)? * * Each and every declaration produces a function with the same signature. This * allows the creation of custom validation functions. For example: * * var MyLink = React.createClass({ * propTypes: { * // An optional string or URI prop named "href". * href: function(props, propName, componentName) { * var propValue = props[propName]; * if (propValue != null && typeof propValue !== 'string' && * !(propValue instanceof URI)) { * return new Error( * 'Expected a string or an URI for ' + propName + ' in ' + * componentName * ); * } * } * }, * render: function() {...} * }); * * @internal */ var ANONYMOUS = '<<anonymous>>'; var elementTypeChecker = createElementTypeChecker(); var nodeTypeChecker = createNodeChecker(); var ReactPropTypes = { array: createPrimitiveTypeChecker('array'), bool: createPrimitiveTypeChecker('boolean'), func: createPrimitiveTypeChecker('function'), number: createPrimitiveTypeChecker('number'), object: createPrimitiveTypeChecker('object'), string: createPrimitiveTypeChecker('string'), any: createAnyTypeChecker(), arrayOf: createArrayOfTypeChecker, element: elementTypeChecker, instanceOf: createInstanceTypeChecker, node: nodeTypeChecker, objectOf: createObjectOfTypeChecker, oneOf: createEnumTypeChecker, oneOfType: createUnionTypeChecker, shape: createShapeTypeChecker }; function createChainableTypeChecker(validate) { function checkType(isRequired, props, propName, componentName, location) { componentName = componentName || ANONYMOUS; if (props[propName] == null) { var locationName = ReactPropTypeLocationNames[location]; if (isRequired) { return new Error( ("Required " + locationName + " `" + propName + "` was not specified in ") + ("`" + componentName + "`.") ); } return null; } else { return validate(props, propName, componentName, location); } } var chainedCheckType = checkType.bind(null, false); chainedCheckType.isRequired = checkType.bind(null, true); return chainedCheckType; } function createPrimitiveTypeChecker(expectedType) { function validate(props, propName, componentName, location) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== expectedType) { var locationName = ReactPropTypeLocationNames[location]; // `propValue` being instance of, say, date/regexp, pass the 'object' // check, but we can offer a more precise error message here rather than // 'of type `object`'. var preciseType = getPreciseType(propValue); return new Error( ("Invalid " + locationName + " `" + propName + "` of type `" + preciseType + "` ") + ("supplied to `" + componentName + "`, expected `" + expectedType + "`.") ); } return null; } return createChainableTypeChecker(validate); } function createAnyTypeChecker() { return createChainableTypeChecker(emptyFunction.thatReturns(null)); } function createArrayOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location) { var propValue = props[propName]; if (!Array.isArray(propValue)) { var locationName = ReactPropTypeLocationNames[location]; var propType = getPropType(propValue); return new Error( ("Invalid " + locationName + " `" + propName + "` of type ") + ("`" + propType + "` supplied to `" + componentName + "`, expected an array.") ); } for (var i = 0; i < propValue.length; i++) { var error = typeChecker(propValue, i, componentName, location); if (error instanceof Error) { return error; } } return null; } return createChainableTypeChecker(validate); } function createElementTypeChecker() { function validate(props, propName, componentName, location) { if (!ReactElement.isValidElement(props[propName])) { var locationName = ReactPropTypeLocationNames[location]; return new Error( ("Invalid " + locationName + " `" + propName + "` supplied to ") + ("`" + componentName + "`, expected a ReactElement.") ); } return null; } return createChainableTypeChecker(validate); } function createInstanceTypeChecker(expectedClass) { function validate(props, propName, componentName, location) { if (!(props[propName] instanceof expectedClass)) { var locationName = ReactPropTypeLocationNames[location]; var expectedClassName = expectedClass.name || ANONYMOUS; return new Error( ("Invalid " + locationName + " `" + propName + "` supplied to ") + ("`" + componentName + "`, expected instance of `" + expectedClassName + "`.") ); } return null; } return createChainableTypeChecker(validate); } function createEnumTypeChecker(expectedValues) { function validate(props, propName, componentName, location) { var propValue = props[propName]; for (var i = 0; i < expectedValues.length; i++) { if (propValue === expectedValues[i]) { return null; } } var locationName = ReactPropTypeLocationNames[location]; var valuesString = JSON.stringify(expectedValues); return new Error( ("Invalid " + locationName + " `" + propName + "` of value `" + propValue + "` ") + ("supplied to `" + componentName + "`, expected one of " + valuesString + ".") ); } return createChainableTypeChecker(validate); } function createObjectOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { var locationName = ReactPropTypeLocationNames[location]; return new Error( ("Invalid " + locationName + " `" + propName + "` of type ") + ("`" + propType + "` supplied to `" + componentName + "`, expected an object.") ); } for (var key in propValue) { if (propValue.hasOwnProperty(key)) { var error = typeChecker(propValue, key, componentName, location); if (error instanceof Error) { return error; } } } return null; } return createChainableTypeChecker(validate); } function createUnionTypeChecker(arrayOfTypeCheckers) { function validate(props, propName, componentName, location) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (checker(props, propName, componentName, location) == null) { return null; } } var locationName = ReactPropTypeLocationNames[location]; return new Error( ("Invalid " + locationName + " `" + propName + "` supplied to ") + ("`" + componentName + "`.") ); } return createChainableTypeChecker(validate); } function createNodeChecker() { function validate(props, propName, componentName, location) { if (!isNode(props[propName])) { var locationName = ReactPropTypeLocationNames[location]; return new Error( ("Invalid " + locationName + " `" + propName + "` supplied to ") + ("`" + componentName + "`, expected a ReactNode.") ); } return null; } return createChainableTypeChecker(validate); } function createShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { var locationName = ReactPropTypeLocationNames[location]; return new Error( ("Invalid " + locationName + " `" + propName + "` of type `" + propType + "` ") + ("supplied to `" + componentName + "`, expected `object`.") ); } for (var key in shapeTypes) { var checker = shapeTypes[key]; if (!checker) { continue; } var error = checker(propValue, key, componentName, location); if (error) { return error; } } return null; } return createChainableTypeChecker(validate); } function isNode(propValue) { switch (typeof propValue) { case 'number': case 'string': case 'undefined': return true; case 'boolean': return !propValue; case 'object': if (Array.isArray(propValue)) { return propValue.every(isNode); } if (propValue === null || ReactElement.isValidElement(propValue)) { return true; } propValue = ReactFragment.extractIfFragment(propValue); for (var k in propValue) { if (!isNode(propValue[k])) { return false; } } return true; default: return false; } } // Equivalent of `typeof` but with special handling for array and regexp. function getPropType(propValue) { var propType = typeof propValue; if (Array.isArray(propValue)) { return 'array'; } if (propValue instanceof RegExp) { // Old webkits (at least until Android 4.0) return 'function' rather than // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ // passes PropTypes.object. return 'object'; } return propType; } // This handles more types than `getPropType`. Only used for error messages. // See `createPrimitiveTypeChecker`. function getPreciseType(propValue) { var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { return 'date'; } else if (propValue instanceof RegExp) { return 'regexp'; } } return propType; } module.exports = ReactPropTypes; },{"114":114,"57":57,"63":63,"76":76}],79:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactPutListenerQueue */ 'use strict'; var PooledClass = _dereq_(28); var ReactBrowserEventEmitter = _dereq_(30); var assign = _dereq_(27); function ReactPutListenerQueue() { this.listenersToPut = []; } assign(ReactPutListenerQueue.prototype, { enqueuePutListener: function(rootNodeID, propKey, propValue) { this.listenersToPut.push({ rootNodeID: rootNodeID, propKey: propKey, propValue: propValue }); }, putListeners: function() { for (var i = 0; i < this.listenersToPut.length; i++) { var listenerToPut = this.listenersToPut[i]; ReactBrowserEventEmitter.putListener( listenerToPut.rootNodeID, listenerToPut.propKey, listenerToPut.propValue ); } }, reset: function() { this.listenersToPut.length = 0; }, destructor: function() { this.reset(); } }); PooledClass.addPoolingTo(ReactPutListenerQueue); module.exports = ReactPutListenerQueue; },{"27":27,"28":28,"30":30}],80:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactReconcileTransaction * @typechecks static-only */ 'use strict'; var CallbackQueue = _dereq_(6); var PooledClass = _dereq_(28); var ReactBrowserEventEmitter = _dereq_(30); var ReactInputSelection = _dereq_(65); var ReactPutListenerQueue = _dereq_(79); var Transaction = _dereq_(103); var assign = _dereq_(27); /** * Ensures that, when possible, the selection range (currently selected text * input) is not disturbed by performing the transaction. */ var SELECTION_RESTORATION = { /** * @return {Selection} Selection information. */ initialize: ReactInputSelection.getSelectionInformation, /** * @param {Selection} sel Selection information returned from `initialize`. */ close: ReactInputSelection.restoreSelection }; /** * Suppresses events (blur/focus) that could be inadvertently dispatched due to * high level DOM manipulations (like temporarily removing a text input from the * DOM). */ var EVENT_SUPPRESSION = { /** * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before * the reconciliation. */ initialize: function() { var currentlyEnabled = ReactBrowserEventEmitter.isEnabled(); ReactBrowserEventEmitter.setEnabled(false); return currentlyEnabled; }, /** * @param {boolean} previouslyEnabled Enabled status of * `ReactBrowserEventEmitter` before the reconciliation occured. `close` * restores the previous value. */ close: function(previouslyEnabled) { ReactBrowserEventEmitter.setEnabled(previouslyEnabled); } }; /** * Provides a queue for collecting `componentDidMount` and * `componentDidUpdate` callbacks during the the transaction. */ var ON_DOM_READY_QUEUEING = { /** * Initializes the internal `onDOMReady` queue. */ initialize: function() { this.reactMountReady.reset(); }, /** * After DOM is flushed, invoke all registered `onDOMReady` callbacks. */ close: function() { this.reactMountReady.notifyAll(); } }; var PUT_LISTENER_QUEUEING = { initialize: function() { this.putListenerQueue.reset(); }, close: function() { this.putListenerQueue.putListeners(); } }; /** * Executed within the scope of the `Transaction` instance. Consider these as * being member methods, but with an implied ordering while being isolated from * each other. */ var TRANSACTION_WRAPPERS = [ PUT_LISTENER_QUEUEING, SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING ]; /** * Currently: * - The order that these are listed in the transaction is critical: * - Suppresses events. * - Restores selection range. * * Future: * - Restore document/overflow scroll positions that were unintentionally * modified via DOM insertions above the top viewport boundary. * - Implement/integrate with customized constraint based layout system and keep * track of which dimensions must be remeasured. * * @class ReactReconcileTransaction */ function ReactReconcileTransaction() { this.reinitializeTransaction(); // Only server-side rendering really needs this option (see // `ReactServerRendering`), but server-side uses // `ReactServerRenderingTransaction` instead. This option is here so that it's // accessible and defaults to false when `ReactDOMComponent` and // `ReactTextComponent` checks it in `mountComponent`.` this.renderToStaticMarkup = false; this.reactMountReady = CallbackQueue.getPooled(null); this.putListenerQueue = ReactPutListenerQueue.getPooled(); } var Mixin = { /** * @see Transaction * @abstract * @final * @return {array<object>} List of operation wrap proceedures. * TODO: convert to array<TransactionWrapper> */ getTransactionWrappers: function() { return TRANSACTION_WRAPPERS; }, /** * @return {object} The queue to collect `onDOMReady` callbacks with. */ getReactMountReady: function() { return this.reactMountReady; }, getPutListenerQueue: function() { return this.putListenerQueue; }, /** * `PooledClass` looks for this, and will invoke this before allowing this * instance to be resused. */ destructor: function() { CallbackQueue.release(this.reactMountReady); this.reactMountReady = null; ReactPutListenerQueue.release(this.putListenerQueue); this.putListenerQueue = null; } }; assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin); PooledClass.addPoolingTo(ReactReconcileTransaction); module.exports = ReactReconcileTransaction; },{"103":103,"27":27,"28":28,"30":30,"6":6,"65":65,"79":79}],81:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactReconciler */ 'use strict'; var ReactRef = _dereq_(82); var ReactElementValidator = _dereq_(58); /** * Helper to call ReactRef.attachRefs with this composite component, split out * to avoid allocations in the transaction mount-ready queue. */ function attachRefs() { ReactRef.attachRefs(this, this._currentElement); } var ReactReconciler = { /** * Initializes the component, renders markup, and registers event listeners. * * @param {ReactComponent} internalInstance * @param {string} rootID DOM ID of the root node. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction * @return {?string} Rendered markup to be inserted into the DOM. * @final * @internal */ mountComponent: function(internalInstance, rootID, transaction, context) { var markup = internalInstance.mountComponent(rootID, transaction, context); if ("production" !== "development") { ReactElementValidator.checkAndWarnForMutatedProps( internalInstance._currentElement ); } transaction.getReactMountReady().enqueue(attachRefs, internalInstance); return markup; }, /** * Releases any resources allocated by `mountComponent`. * * @final * @internal */ unmountComponent: function(internalInstance) { ReactRef.detachRefs(internalInstance, internalInstance._currentElement); internalInstance.unmountComponent(); }, /** * Update a component using a new element. * * @param {ReactComponent} internalInstance * @param {ReactElement} nextElement * @param {ReactReconcileTransaction} transaction * @param {object} context * @internal */ receiveComponent: function( internalInstance, nextElement, transaction, context ) { var prevElement = internalInstance._currentElement; if (nextElement === prevElement && nextElement._owner != null) { // Since elements are immutable after the owner is rendered, // we can do a cheap identity compare here to determine if this is a // superfluous reconcile. It's possible for state to be mutable but such // change should trigger an update of the owner which would recreate // the element. We explicitly check for the existence of an owner since // it's possible for an element created outside a composite to be // deeply mutated and reused. return; } if ("production" !== "development") { ReactElementValidator.checkAndWarnForMutatedProps(nextElement); } var refsChanged = ReactRef.shouldUpdateRefs( prevElement, nextElement ); if (refsChanged) { ReactRef.detachRefs(internalInstance, prevElement); } internalInstance.receiveComponent(nextElement, transaction, context); if (refsChanged) { transaction.getReactMountReady().enqueue(attachRefs, internalInstance); } }, /** * Flush any dirty changes in a component. * * @param {ReactComponent} internalInstance * @param {ReactReconcileTransaction} transaction * @internal */ performUpdateIfNecessary: function( internalInstance, transaction ) { internalInstance.performUpdateIfNecessary(transaction); } }; module.exports = ReactReconciler; },{"58":58,"82":82}],82:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactRef */ 'use strict'; var ReactOwner = _dereq_(74); var ReactRef = {}; function attachRef(ref, component, owner) { if (typeof ref === 'function') { ref(component.getPublicInstance()); } else { // Legacy ref ReactOwner.addComponentAsRefTo(component, ref, owner); } } function detachRef(ref, component, owner) { if (typeof ref === 'function') { ref(null); } else { // Legacy ref ReactOwner.removeComponentAsRefFrom(component, ref, owner); } } ReactRef.attachRefs = function(instance, element) { var ref = element.ref; if (ref != null) { attachRef(ref, instance, element._owner); } }; ReactRef.shouldUpdateRefs = function(prevElement, nextElement) { // If either the owner or a `ref` has changed, make sure the newest owner // has stored a reference to `this`, and the previous owner (if different) // has forgotten the reference to `this`. We use the element instead // of the public this.props because the post processing cannot determine // a ref. The ref conceptually lives on the element. // TODO: Should this even be possible? The owner cannot change because // it's forbidden by shouldUpdateReactComponent. The ref can change // if you swap the keys of but not the refs. Reconsider where this check // is made. It probably belongs where the key checking and // instantiateReactComponent is done. return ( nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref ); }; ReactRef.detachRefs = function(instance, element) { var ref = element.ref; if (ref != null) { detachRef(ref, instance, element._owner); } }; module.exports = ReactRef; },{"74":74}],83:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactRootIndex * @typechecks */ 'use strict'; var ReactRootIndexInjection = { /** * @param {function} _createReactRootIndex */ injectCreateReactRootIndex: function(_createReactRootIndex) { ReactRootIndex.createReactRootIndex = _createReactRootIndex; } }; var ReactRootIndex = { createReactRootIndex: null, injection: ReactRootIndexInjection }; module.exports = ReactRootIndex; },{}],84:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks static-only * @providesModule ReactServerRendering */ 'use strict'; var ReactElement = _dereq_(57); var ReactInstanceHandles = _dereq_(66); var ReactMarkupChecksum = _dereq_(69); var ReactServerRenderingTransaction = _dereq_(85); var emptyObject = _dereq_(115); var instantiateReactComponent = _dereq_(134); var invariant = _dereq_(135); /** * @param {ReactElement} element * @return {string} the HTML markup */ function renderToString(element) { ("production" !== "development" ? invariant( ReactElement.isValidElement(element), 'renderToString(): You must pass a valid ReactElement.' ) : invariant(ReactElement.isValidElement(element))); var transaction; try { var id = ReactInstanceHandles.createReactRootID(); transaction = ReactServerRenderingTransaction.getPooled(false); return transaction.perform(function() { var componentInstance = instantiateReactComponent(element, null); var markup = componentInstance.mountComponent(id, transaction, emptyObject); return ReactMarkupChecksum.addChecksumToMarkup(markup); }, null); } finally { ReactServerRenderingTransaction.release(transaction); } } /** * @param {ReactElement} element * @return {string} the HTML markup, without the extra React ID and checksum * (for generating static pages) */ function renderToStaticMarkup(element) { ("production" !== "development" ? invariant( ReactElement.isValidElement(element), 'renderToStaticMarkup(): You must pass a valid ReactElement.' ) : invariant(ReactElement.isValidElement(element))); var transaction; try { var id = ReactInstanceHandles.createReactRootID(); transaction = ReactServerRenderingTransaction.getPooled(true); return transaction.perform(function() { var componentInstance = instantiateReactComponent(element, null); return componentInstance.mountComponent(id, transaction, emptyObject); }, null); } finally { ReactServerRenderingTransaction.release(transaction); } } module.exports = { renderToString: renderToString, renderToStaticMarkup: renderToStaticMarkup }; },{"115":115,"134":134,"135":135,"57":57,"66":66,"69":69,"85":85}],85:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactServerRenderingTransaction * @typechecks */ 'use strict'; var PooledClass = _dereq_(28); var CallbackQueue = _dereq_(6); var ReactPutListenerQueue = _dereq_(79); var Transaction = _dereq_(103); var assign = _dereq_(27); var emptyFunction = _dereq_(114); /** * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks * during the performing of the transaction. */ var ON_DOM_READY_QUEUEING = { /** * Initializes the internal `onDOMReady` queue. */ initialize: function() { this.reactMountReady.reset(); }, close: emptyFunction }; var PUT_LISTENER_QUEUEING = { initialize: function() { this.putListenerQueue.reset(); }, close: emptyFunction }; /** * Executed within the scope of the `Transaction` instance. Consider these as * being member methods, but with an implied ordering while being isolated from * each other. */ var TRANSACTION_WRAPPERS = [ PUT_LISTENER_QUEUEING, ON_DOM_READY_QUEUEING ]; /** * @class ReactServerRenderingTransaction * @param {boolean} renderToStaticMarkup */ function ReactServerRenderingTransaction(renderToStaticMarkup) { this.reinitializeTransaction(); this.renderToStaticMarkup = renderToStaticMarkup; this.reactMountReady = CallbackQueue.getPooled(null); this.putListenerQueue = ReactPutListenerQueue.getPooled(); } var Mixin = { /** * @see Transaction * @abstract * @final * @return {array} Empty list of operation wrap proceedures. */ getTransactionWrappers: function() { return TRANSACTION_WRAPPERS; }, /** * @return {object} The queue to collect `onDOMReady` callbacks with. */ getReactMountReady: function() { return this.reactMountReady; }, getPutListenerQueue: function() { return this.putListenerQueue; }, /** * `PooledClass` looks for this, and will invoke this before allowing this * instance to be resused. */ destructor: function() { CallbackQueue.release(this.reactMountReady); this.reactMountReady = null; ReactPutListenerQueue.release(this.putListenerQueue); this.putListenerQueue = null; } }; assign( ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin ); PooledClass.addPoolingTo(ReactServerRenderingTransaction); module.exports = ReactServerRenderingTransaction; },{"103":103,"114":114,"27":27,"28":28,"6":6,"79":79}],86:[function(_dereq_,module,exports){ /** * Copyright 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactUpdateQueue */ 'use strict'; var ReactLifeCycle = _dereq_(68); var ReactCurrentOwner = _dereq_(39); var ReactElement = _dereq_(57); var ReactInstanceMap = _dereq_(67); var ReactUpdates = _dereq_(87); var assign = _dereq_(27); var invariant = _dereq_(135); var warning = _dereq_(154); function enqueueUpdate(internalInstance) { if (internalInstance !== ReactLifeCycle.currentlyMountingInstance) { // If we're in a componentWillMount handler, don't enqueue a rerender // because ReactUpdates assumes we're in a browser context (which is // wrong for server rendering) and we're about to do a render anyway. // See bug in #1740. ReactUpdates.enqueueUpdate(internalInstance); } } function getInternalInstanceReadyForUpdate(publicInstance, callerName) { ("production" !== "development" ? invariant( ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName ) : invariant(ReactCurrentOwner.current == null)); var internalInstance = ReactInstanceMap.get(publicInstance); if (!internalInstance) { if ("production" !== "development") { // Only warn when we have a callerName. Otherwise we should be silent. // We're probably calling from enqueueCallback. We don't want to warn // there because we already warned for the corresponding lifecycle method. ("production" !== "development" ? warning( !callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted ' + 'component. This is a no-op.', callerName, callerName ) : null); } return null; } if (internalInstance === ReactLifeCycle.currentlyUnmountingInstance) { return null; } return internalInstance; } /** * ReactUpdateQueue allows for state updates to be scheduled into a later * reconciliation step. */ var ReactUpdateQueue = { /** * Enqueue a callback that will be executed after all the pending updates * have processed. * * @param {ReactClass} publicInstance The instance to use as `this` context. * @param {?function} callback Called after state is updated. * @internal */ enqueueCallback: function(publicInstance, callback) { ("production" !== "development" ? invariant( typeof callback === 'function', 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.' ) : invariant(typeof callback === 'function')); var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); // Previously we would throw an error if we didn't have an internal // instance. Since we want to make it a no-op instead, we mirror the same // behavior we have in other enqueue* methods. // We also need to ignore callbacks in componentWillMount. See // enqueueUpdates. if (!internalInstance || internalInstance === ReactLifeCycle.currentlyMountingInstance) { return null; } if (internalInstance._pendingCallbacks) { internalInstance._pendingCallbacks.push(callback); } else { internalInstance._pendingCallbacks = [callback]; } // TODO: The callback here is ignored when setState is called from // componentWillMount. Either fix it or disallow doing so completely in // favor of getInitialState. Alternatively, we can disallow // componentWillMount during server-side rendering. enqueueUpdate(internalInstance); }, enqueueCallbackInternal: function(internalInstance, callback) { ("production" !== "development" ? invariant( typeof callback === 'function', 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.' ) : invariant(typeof callback === 'function')); if (internalInstance._pendingCallbacks) { internalInstance._pendingCallbacks.push(callback); } else { internalInstance._pendingCallbacks = [callback]; } enqueueUpdate(internalInstance); }, /** * Forces an update. This should only be invoked when it is known with * certainty that we are **not** in a DOM transaction. * * You may want to call this when you know that some deeper aspect of the * component's state has changed but `setState` was not called. * * This will not invoke `shouldUpdateComponent`, but it will invoke * `componentWillUpdate` and `componentDidUpdate`. * * @param {ReactClass} publicInstance The instance that should rerender. * @internal */ enqueueForceUpdate: function(publicInstance) { var internalInstance = getInternalInstanceReadyForUpdate( publicInstance, 'forceUpdate' ); if (!internalInstance) { return; } internalInstance._pendingForceUpdate = true; enqueueUpdate(internalInstance); }, /** * Replaces all of the state. Always use this or `setState` to mutate state. * You should treat `this.state` as immutable. * * There is no guarantee that `this.state` will be immediately updated, so * accessing `this.state` after calling this method may return the old value. * * @param {ReactClass} publicInstance The instance that should rerender. * @param {object} completeState Next state. * @internal */ enqueueReplaceState: function(publicInstance, completeState) { var internalInstance = getInternalInstanceReadyForUpdate( publicInstance, 'replaceState' ); if (!internalInstance) { return; } internalInstance._pendingStateQueue = [completeState]; internalInstance._pendingReplaceState = true; enqueueUpdate(internalInstance); }, /** * Sets a subset of the state. This only exists because _pendingState is * internal. This provides a merging strategy that is not available to deep * properties which is confusing. TODO: Expose pendingState or don't use it * during the merge. * * @param {ReactClass} publicInstance The instance that should rerender. * @param {object} partialState Next partial state to be merged with state. * @internal */ enqueueSetState: function(publicInstance, partialState) { var internalInstance = getInternalInstanceReadyForUpdate( publicInstance, 'setState' ); if (!internalInstance) { return; } var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []); queue.push(partialState); enqueueUpdate(internalInstance); }, /** * Sets a subset of the props. * * @param {ReactClass} publicInstance The instance that should rerender. * @param {object} partialProps Subset of the next props. * @internal */ enqueueSetProps: function(publicInstance, partialProps) { var internalInstance = getInternalInstanceReadyForUpdate( publicInstance, 'setProps' ); if (!internalInstance) { return; } ("production" !== "development" ? invariant( internalInstance._isTopLevel, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.' ) : invariant(internalInstance._isTopLevel)); // Merge with the pending element if it exists, otherwise with existing // element props. var element = internalInstance._pendingElement || internalInstance._currentElement; var props = assign({}, element.props, partialProps); internalInstance._pendingElement = ReactElement.cloneAndReplaceProps( element, props ); enqueueUpdate(internalInstance); }, /** * Replaces all of the props. * * @param {ReactClass} publicInstance The instance that should rerender. * @param {object} props New props. * @internal */ enqueueReplaceProps: function(publicInstance, props) { var internalInstance = getInternalInstanceReadyForUpdate( publicInstance, 'replaceProps' ); if (!internalInstance) { return; } ("production" !== "development" ? invariant( internalInstance._isTopLevel, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.' ) : invariant(internalInstance._isTopLevel)); // Merge with the pending element if it exists, otherwise with existing // element props. var element = internalInstance._pendingElement || internalInstance._currentElement; internalInstance._pendingElement = ReactElement.cloneAndReplaceProps( element, props ); enqueueUpdate(internalInstance); }, enqueueElementInternal: function(internalInstance, newElement) { internalInstance._pendingElement = newElement; enqueueUpdate(internalInstance); } }; module.exports = ReactUpdateQueue; },{"135":135,"154":154,"27":27,"39":39,"57":57,"67":67,"68":68,"87":87}],87:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactUpdates */ 'use strict'; var CallbackQueue = _dereq_(6); var PooledClass = _dereq_(28); var ReactCurrentOwner = _dereq_(39); var ReactPerf = _dereq_(75); var ReactReconciler = _dereq_(81); var Transaction = _dereq_(103); var assign = _dereq_(27); var invariant = _dereq_(135); var warning = _dereq_(154); var dirtyComponents = []; var asapCallbackQueue = CallbackQueue.getPooled(); var asapEnqueued = false; var batchingStrategy = null; function ensureInjected() { ("production" !== "development" ? invariant( ReactUpdates.ReactReconcileTransaction && batchingStrategy, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy' ) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy)); } var NESTED_UPDATES = { initialize: function() { this.dirtyComponentsLength = dirtyComponents.length; }, close: function() { if (this.dirtyComponentsLength !== dirtyComponents.length) { // Additional updates were enqueued by componentDidUpdate handlers or // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run // these new updates so that if A's componentDidUpdate calls setState on // B, B will update before the callback A's updater provided when calling // setState. dirtyComponents.splice(0, this.dirtyComponentsLength); flushBatchedUpdates(); } else { dirtyComponents.length = 0; } } }; var UPDATE_QUEUEING = { initialize: function() { this.callbackQueue.reset(); }, close: function() { this.callbackQueue.notifyAll(); } }; var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; function ReactUpdatesFlushTransaction() { this.reinitializeTransaction(); this.dirtyComponentsLength = null; this.callbackQueue = CallbackQueue.getPooled(); this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(); } assign( ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, { getTransactionWrappers: function() { return TRANSACTION_WRAPPERS; }, destructor: function() { this.dirtyComponentsLength = null; CallbackQueue.release(this.callbackQueue); this.callbackQueue = null; ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction); this.reconcileTransaction = null; }, perform: function(method, scope, a) { // Essentially calls `this.reconcileTransaction.perform(method, scope, a)` // with this transaction's wrappers around it. return Transaction.Mixin.perform.call( this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a ); } }); PooledClass.addPoolingTo(ReactUpdatesFlushTransaction); function batchedUpdates(callback, a, b, c, d) { ensureInjected(); batchingStrategy.batchedUpdates(callback, a, b, c, d); } /** * Array comparator for ReactComponents by mount ordering. * * @param {ReactComponent} c1 first component you're comparing * @param {ReactComponent} c2 second component you're comparing * @return {number} Return value usable by Array.prototype.sort(). */ function mountOrderComparator(c1, c2) { return c1._mountOrder - c2._mountOrder; } function runBatchedUpdates(transaction) { var len = transaction.dirtyComponentsLength; ("production" !== "development" ? invariant( len === dirtyComponents.length, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length ) : invariant(len === dirtyComponents.length)); // Since reconciling a component higher in the owner hierarchy usually (not // always -- see shouldComponentUpdate()) will reconcile children, reconcile // them before their children by sorting the array. dirtyComponents.sort(mountOrderComparator); for (var i = 0; i < len; i++) { // If a component is unmounted before pending changes apply, it will still // be here, but we assume that it has cleared its _pendingCallbacks and // that performUpdateIfNecessary is a noop. var component = dirtyComponents[i]; // If performUpdateIfNecessary happens to enqueue any new updates, we // shouldn't execute the callbacks until the next render happens, so // stash the callbacks first var callbacks = component._pendingCallbacks; component._pendingCallbacks = null; ReactReconciler.performUpdateIfNecessary( component, transaction.reconcileTransaction ); if (callbacks) { for (var j = 0; j < callbacks.length; j++) { transaction.callbackQueue.enqueue( callbacks[j], component.getPublicInstance() ); } } } } var flushBatchedUpdates = function() { // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents // array and perform any updates enqueued by mount-ready handlers (i.e., // componentDidUpdate) but we need to check here too in order to catch // updates enqueued by setState callbacks and asap calls. while (dirtyComponents.length || asapEnqueued) { if (dirtyComponents.length) { var transaction = ReactUpdatesFlushTransaction.getPooled(); transaction.perform(runBatchedUpdates, null, transaction); ReactUpdatesFlushTransaction.release(transaction); } if (asapEnqueued) { asapEnqueued = false; var queue = asapCallbackQueue; asapCallbackQueue = CallbackQueue.getPooled(); queue.notifyAll(); CallbackQueue.release(queue); } } }; flushBatchedUpdates = ReactPerf.measure( 'ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates ); /** * Mark a component as needing a rerender, adding an optional callback to a * list of functions which will be executed once the rerender occurs. */ function enqueueUpdate(component) { ensureInjected(); // Various parts of our code (such as ReactCompositeComponent's // _renderValidatedComponent) assume that calls to render aren't nested; // verify that that's the case. (This is called by each top-level update // function, like setProps, setState, forceUpdate, etc.; creation and // destruction of top-level components is guarded in ReactMount.) ("production" !== "development" ? warning( ReactCurrentOwner.current == null, 'enqueueUpdate(): Render methods should be a pure function of props ' + 'and state; triggering nested component updates from render is not ' + 'allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate.' ) : null); if (!batchingStrategy.isBatchingUpdates) { batchingStrategy.batchedUpdates(enqueueUpdate, component); return; } dirtyComponents.push(component); } /** * Enqueue a callback to be run at the end of the current batching cycle. Throws * if no updates are currently being performed. */ function asap(callback, context) { ("production" !== "development" ? invariant( batchingStrategy.isBatchingUpdates, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.' ) : invariant(batchingStrategy.isBatchingUpdates)); asapCallbackQueue.enqueue(callback, context); asapEnqueued = true; } var ReactUpdatesInjection = { injectReconcileTransaction: function(ReconcileTransaction) { ("production" !== "development" ? invariant( ReconcileTransaction, 'ReactUpdates: must provide a reconcile transaction class' ) : invariant(ReconcileTransaction)); ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; }, injectBatchingStrategy: function(_batchingStrategy) { ("production" !== "development" ? invariant( _batchingStrategy, 'ReactUpdates: must provide a batching strategy' ) : invariant(_batchingStrategy)); ("production" !== "development" ? invariant( typeof _batchingStrategy.batchedUpdates === 'function', 'ReactUpdates: must provide a batchedUpdates() function' ) : invariant(typeof _batchingStrategy.batchedUpdates === 'function')); ("production" !== "development" ? invariant( typeof _batchingStrategy.isBatchingUpdates === 'boolean', 'ReactUpdates: must provide an isBatchingUpdates boolean attribute' ) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean')); batchingStrategy = _batchingStrategy; } }; var ReactUpdates = { /** * React references `ReactReconcileTransaction` using this property in order * to allow dependency injection. * * @internal */ ReactReconcileTransaction: null, batchedUpdates: batchedUpdates, enqueueUpdate: enqueueUpdate, flushBatchedUpdates: flushBatchedUpdates, injection: ReactUpdatesInjection, asap: asap }; module.exports = ReactUpdates; },{"103":103,"135":135,"154":154,"27":27,"28":28,"39":39,"6":6,"75":75,"81":81}],88:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SVGDOMPropertyConfig */ /*jslint bitwise: true*/ 'use strict'; var DOMProperty = _dereq_(10); var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE; var SVGDOMPropertyConfig = { Properties: { clipPath: MUST_USE_ATTRIBUTE, cx: MUST_USE_ATTRIBUTE, cy: MUST_USE_ATTRIBUTE, d: MUST_USE_ATTRIBUTE, dx: MUST_USE_ATTRIBUTE, dy: MUST_USE_ATTRIBUTE, fill: MUST_USE_ATTRIBUTE, fillOpacity: MUST_USE_ATTRIBUTE, fontFamily: MUST_USE_ATTRIBUTE, fontSize: MUST_USE_ATTRIBUTE, fx: MUST_USE_ATTRIBUTE, fy: MUST_USE_ATTRIBUTE, gradientTransform: MUST_USE_ATTRIBUTE, gradientUnits: MUST_USE_ATTRIBUTE, markerEnd: MUST_USE_ATTRIBUTE, markerMid: MUST_USE_ATTRIBUTE, markerStart: MUST_USE_ATTRIBUTE, offset: MUST_USE_ATTRIBUTE, opacity: MUST_USE_ATTRIBUTE, patternContentUnits: MUST_USE_ATTRIBUTE, patternUnits: MUST_USE_ATTRIBUTE, points: MUST_USE_ATTRIBUTE, preserveAspectRatio: MUST_USE_ATTRIBUTE, r: MUST_USE_ATTRIBUTE, rx: MUST_USE_ATTRIBUTE, ry: MUST_USE_ATTRIBUTE, spreadMethod: MUST_USE_ATTRIBUTE, stopColor: MUST_USE_ATTRIBUTE, stopOpacity: MUST_USE_ATTRIBUTE, stroke: MUST_USE_ATTRIBUTE, strokeDasharray: MUST_USE_ATTRIBUTE, strokeLinecap: MUST_USE_ATTRIBUTE, strokeOpacity: MUST_USE_ATTRIBUTE, strokeWidth: MUST_USE_ATTRIBUTE, textAnchor: MUST_USE_ATTRIBUTE, transform: MUST_USE_ATTRIBUTE, version: MUST_USE_ATTRIBUTE, viewBox: MUST_USE_ATTRIBUTE, x1: MUST_USE_ATTRIBUTE, x2: MUST_USE_ATTRIBUTE, x: MUST_USE_ATTRIBUTE, y1: MUST_USE_ATTRIBUTE, y2: MUST_USE_ATTRIBUTE, y: MUST_USE_ATTRIBUTE }, DOMAttributeNames: { clipPath: 'clip-path', fillOpacity: 'fill-opacity', fontFamily: 'font-family', fontSize: 'font-size', gradientTransform: 'gradientTransform', gradientUnits: 'gradientUnits', markerEnd: 'marker-end', markerMid: 'marker-mid', markerStart: 'marker-start', patternContentUnits: 'patternContentUnits', patternUnits: 'patternUnits', preserveAspectRatio: 'preserveAspectRatio', spreadMethod: 'spreadMethod', stopColor: 'stop-color', stopOpacity: 'stop-opacity', strokeDasharray: 'stroke-dasharray', strokeLinecap: 'stroke-linecap', strokeOpacity: 'stroke-opacity', strokeWidth: 'stroke-width', textAnchor: 'text-anchor', viewBox: 'viewBox' } }; module.exports = SVGDOMPropertyConfig; },{"10":10}],89:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SelectEventPlugin */ 'use strict'; var EventConstants = _dereq_(15); var EventPropagators = _dereq_(20); var ReactInputSelection = _dereq_(65); var SyntheticEvent = _dereq_(95); var getActiveElement = _dereq_(121); var isTextInputElement = _dereq_(138); var keyOf = _dereq_(141); var shallowEqual = _dereq_(150); var topLevelTypes = EventConstants.topLevelTypes; var eventTypes = { select: { phasedRegistrationNames: { bubbled: keyOf({onSelect: null}), captured: keyOf({onSelectCapture: null}) }, dependencies: [ topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange ] } }; var activeElement = null; var activeElementID = null; var lastSelection = null; var mouseDown = false; /** * Get an object which is a unique representation of the current selection. * * The return value will not be consistent across nodes or browsers, but * two identical selections on the same node will return identical objects. * * @param {DOMElement} node * @param {object} */ function getSelection(node) { if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) { return { start: node.selectionStart, end: node.selectionEnd }; } else if (window.getSelection) { var selection = window.getSelection(); return { anchorNode: selection.anchorNode, anchorOffset: selection.anchorOffset, focusNode: selection.focusNode, focusOffset: selection.focusOffset }; } else if (document.selection) { var range = document.selection.createRange(); return { parentElement: range.parentElement(), text: range.text, top: range.boundingTop, left: range.boundingLeft }; } } /** * Poll selection to see whether it's changed. * * @param {object} nativeEvent * @return {?SyntheticEvent} */ function constructSelectEvent(nativeEvent) { // Ensure we have the right element, and that the user is not dragging a // selection (this matches native `select` event behavior). In HTML5, select // fires only on input and textarea thus if there's no focused element we // won't dispatch. if (mouseDown || activeElement == null || activeElement !== getActiveElement()) { return null; } // Only fire when selection has actually changed. var currentSelection = getSelection(activeElement); if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { lastSelection = currentSelection; var syntheticEvent = SyntheticEvent.getPooled( eventTypes.select, activeElementID, nativeEvent ); syntheticEvent.type = 'select'; syntheticEvent.target = activeElement; EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent); return syntheticEvent; } } /** * This plugin creates an `onSelect` event that normalizes select events * across form elements. * * Supported elements are: * - input (see `isTextInputElement`) * - textarea * - contentEditable * * This differs from native browser implementations in the following ways: * - Fires on contentEditable fields as well as inputs. * - Fires for collapsed selection. * - Fires after user input. */ var SelectEventPlugin = { eventTypes: eventTypes, /** * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @see {EventPluginHub.extractEvents} */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { switch (topLevelType) { // Track the input node that has focus. case topLevelTypes.topFocus: if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') { activeElement = topLevelTarget; activeElementID = topLevelTargetID; lastSelection = null; } break; case topLevelTypes.topBlur: activeElement = null; activeElementID = null; lastSelection = null; break; // Don't fire the event while the user is dragging. This matches the // semantics of the native select event. case topLevelTypes.topMouseDown: mouseDown = true; break; case topLevelTypes.topContextMenu: case topLevelTypes.topMouseUp: mouseDown = false; return constructSelectEvent(nativeEvent); // Chrome and IE fire non-standard event when selection is changed (and // sometimes when it hasn't). // Firefox doesn't support selectionchange, so check selection status // after each key entry. The selection changes after keydown and before // keyup, but we check on keydown as well in the case of holding down a // key, when multiple keydown events are fired but only one keyup is. case topLevelTypes.topSelectionChange: case topLevelTypes.topKeyDown: case topLevelTypes.topKeyUp: return constructSelectEvent(nativeEvent); } } }; module.exports = SelectEventPlugin; },{"121":121,"138":138,"141":141,"15":15,"150":150,"20":20,"65":65,"95":95}],90:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ServerReactRootIndex * @typechecks */ 'use strict'; /** * Size of the reactRoot ID space. We generate random numbers for React root * IDs and if there's a collision the events and DOM update system will * get confused. In the future we need a way to generate GUIDs but for * now this will work on a smaller scale. */ var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53); var ServerReactRootIndex = { createReactRootIndex: function() { return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX); } }; module.exports = ServerReactRootIndex; },{}],91:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SimpleEventPlugin */ 'use strict'; var EventConstants = _dereq_(15); var EventPluginUtils = _dereq_(19); var EventPropagators = _dereq_(20); var SyntheticClipboardEvent = _dereq_(92); var SyntheticEvent = _dereq_(95); var SyntheticFocusEvent = _dereq_(96); var SyntheticKeyboardEvent = _dereq_(98); var SyntheticMouseEvent = _dereq_(99); var SyntheticDragEvent = _dereq_(94); var SyntheticTouchEvent = _dereq_(100); var SyntheticUIEvent = _dereq_(101); var SyntheticWheelEvent = _dereq_(102); var getEventCharCode = _dereq_(122); var invariant = _dereq_(135); var keyOf = _dereq_(141); var warning = _dereq_(154); var topLevelTypes = EventConstants.topLevelTypes; var eventTypes = { blur: { phasedRegistrationNames: { bubbled: keyOf({onBlur: true}), captured: keyOf({onBlurCapture: true}) } }, click: { phasedRegistrationNames: { bubbled: keyOf({onClick: true}), captured: keyOf({onClickCapture: true}) } }, contextMenu: { phasedRegistrationNames: { bubbled: keyOf({onContextMenu: true}), captured: keyOf({onContextMenuCapture: true}) } }, copy: { phasedRegistrationNames: { bubbled: keyOf({onCopy: true}), captured: keyOf({onCopyCapture: true}) } }, cut: { phasedRegistrationNames: { bubbled: keyOf({onCut: true}), captured: keyOf({onCutCapture: true}) } }, doubleClick: { phasedRegistrationNames: { bubbled: keyOf({onDoubleClick: true}), captured: keyOf({onDoubleClickCapture: true}) } }, drag: { phasedRegistrationNames: { bubbled: keyOf({onDrag: true}), captured: keyOf({onDragCapture: true}) } }, dragEnd: { phasedRegistrationNames: { bubbled: keyOf({onDragEnd: true}), captured: keyOf({onDragEndCapture: true}) } }, dragEnter: { phasedRegistrationNames: { bubbled: keyOf({onDragEnter: true}), captured: keyOf({onDragEnterCapture: true}) } }, dragExit: { phasedRegistrationNames: { bubbled: keyOf({onDragExit: true}), captured: keyOf({onDragExitCapture: true}) } }, dragLeave: { phasedRegistrationNames: { bubbled: keyOf({onDragLeave: true}), captured: keyOf({onDragLeaveCapture: true}) } }, dragOver: { phasedRegistrationNames: { bubbled: keyOf({onDragOver: true}), captured: keyOf({onDragOverCapture: true}) } }, dragStart: { phasedRegistrationNames: { bubbled: keyOf({onDragStart: true}), captured: keyOf({onDragStartCapture: true}) } }, drop: { phasedRegistrationNames: { bubbled: keyOf({onDrop: true}), captured: keyOf({onDropCapture: true}) } }, focus: { phasedRegistrationNames: { bubbled: keyOf({onFocus: true}), captured: keyOf({onFocusCapture: true}) } }, input: { phasedRegistrationNames: { bubbled: keyOf({onInput: true}), captured: keyOf({onInputCapture: true}) } }, keyDown: { phasedRegistrationNames: { bubbled: keyOf({onKeyDown: true}), captured: keyOf({onKeyDownCapture: true}) } }, keyPress: { phasedRegistrationNames: { bubbled: keyOf({onKeyPress: true}), captured: keyOf({onKeyPressCapture: true}) } }, keyUp: { phasedRegistrationNames: { bubbled: keyOf({onKeyUp: true}), captured: keyOf({onKeyUpCapture: true}) } }, load: { phasedRegistrationNames: { bubbled: keyOf({onLoad: true}), captured: keyOf({onLoadCapture: true}) } }, error: { phasedRegistrationNames: { bubbled: keyOf({onError: true}), captured: keyOf({onErrorCapture: true}) } }, // Note: We do not allow listening to mouseOver events. Instead, use the // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`. mouseDown: { phasedRegistrationNames: { bubbled: keyOf({onMouseDown: true}), captured: keyOf({onMouseDownCapture: true}) } }, mouseMove: { phasedRegistrationNames: { bubbled: keyOf({onMouseMove: true}), captured: keyOf({onMouseMoveCapture: true}) } }, mouseOut: { phasedRegistrationNames: { bubbled: keyOf({onMouseOut: true}), captured: keyOf({onMouseOutCapture: true}) } }, mouseOver: { phasedRegistrationNames: { bubbled: keyOf({onMouseOver: true}), captured: keyOf({onMouseOverCapture: true}) } }, mouseUp: { phasedRegistrationNames: { bubbled: keyOf({onMouseUp: true}), captured: keyOf({onMouseUpCapture: true}) } }, paste: { phasedRegistrationNames: { bubbled: keyOf({onPaste: true}), captured: keyOf({onPasteCapture: true}) } }, reset: { phasedRegistrationNames: { bubbled: keyOf({onReset: true}), captured: keyOf({onResetCapture: true}) } }, scroll: { phasedRegistrationNames: { bubbled: keyOf({onScroll: true}), captured: keyOf({onScrollCapture: true}) } }, submit: { phasedRegistrationNames: { bubbled: keyOf({onSubmit: true}), captured: keyOf({onSubmitCapture: true}) } }, touchCancel: { phasedRegistrationNames: { bubbled: keyOf({onTouchCancel: true}), captured: keyOf({onTouchCancelCapture: true}) } }, touchEnd: { phasedRegistrationNames: { bubbled: keyOf({onTouchEnd: true}), captured: keyOf({onTouchEndCapture: true}) } }, touchMove: { phasedRegistrationNames: { bubbled: keyOf({onTouchMove: true}), captured: keyOf({onTouchMoveCapture: true}) } }, touchStart: { phasedRegistrationNames: { bubbled: keyOf({onTouchStart: true}), captured: keyOf({onTouchStartCapture: true}) } }, wheel: { phasedRegistrationNames: { bubbled: keyOf({onWheel: true}), captured: keyOf({onWheelCapture: true}) } } }; var topLevelEventsToDispatchConfig = { topBlur: eventTypes.blur, topClick: eventTypes.click, topContextMenu: eventTypes.contextMenu, topCopy: eventTypes.copy, topCut: eventTypes.cut, topDoubleClick: eventTypes.doubleClick, topDrag: eventTypes.drag, topDragEnd: eventTypes.dragEnd, topDragEnter: eventTypes.dragEnter, topDragExit: eventTypes.dragExit, topDragLeave: eventTypes.dragLeave, topDragOver: eventTypes.dragOver, topDragStart: eventTypes.dragStart, topDrop: eventTypes.drop, topError: eventTypes.error, topFocus: eventTypes.focus, topInput: eventTypes.input, topKeyDown: eventTypes.keyDown, topKeyPress: eventTypes.keyPress, topKeyUp: eventTypes.keyUp, topLoad: eventTypes.load, topMouseDown: eventTypes.mouseDown, topMouseMove: eventTypes.mouseMove, topMouseOut: eventTypes.mouseOut, topMouseOver: eventTypes.mouseOver, topMouseUp: eventTypes.mouseUp, topPaste: eventTypes.paste, topReset: eventTypes.reset, topScroll: eventTypes.scroll, topSubmit: eventTypes.submit, topTouchCancel: eventTypes.touchCancel, topTouchEnd: eventTypes.touchEnd, topTouchMove: eventTypes.touchMove, topTouchStart: eventTypes.touchStart, topWheel: eventTypes.wheel }; for (var type in topLevelEventsToDispatchConfig) { topLevelEventsToDispatchConfig[type].dependencies = [type]; } var SimpleEventPlugin = { eventTypes: eventTypes, /** * Same as the default implementation, except cancels the event when return * value is false. This behavior will be disabled in a future release. * * @param {object} Event to be dispatched. * @param {function} Application-level callback. * @param {string} domID DOM ID to pass to the callback. */ executeDispatch: function(event, listener, domID) { var returnValue = EventPluginUtils.executeDispatch(event, listener, domID); ("production" !== "development" ? warning( typeof returnValue !== 'boolean', 'Returning `false` from an event handler is deprecated and will be ' + 'ignored in a future release. Instead, manually call ' + 'e.stopPropagation() or e.preventDefault(), as appropriate.' ) : null); if (returnValue === false) { event.stopPropagation(); event.preventDefault(); } }, /** * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @see {EventPluginHub.extractEvents} */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; if (!dispatchConfig) { return null; } var EventConstructor; switch (topLevelType) { case topLevelTypes.topInput: case topLevelTypes.topLoad: case topLevelTypes.topError: case topLevelTypes.topReset: case topLevelTypes.topSubmit: // HTML Events // @see http://www.w3.org/TR/html5/index.html#events-0 EventConstructor = SyntheticEvent; break; case topLevelTypes.topKeyPress: // FireFox creates a keypress event for function keys too. This removes // the unwanted keypress events. Enter is however both printable and // non-printable. One would expect Tab to be as well (but it isn't). if (getEventCharCode(nativeEvent) === 0) { return null; } /* falls through */ case topLevelTypes.topKeyDown: case topLevelTypes.topKeyUp: EventConstructor = SyntheticKeyboardEvent; break; case topLevelTypes.topBlur: case topLevelTypes.topFocus: EventConstructor = SyntheticFocusEvent; break; case topLevelTypes.topClick: // Firefox creates a click event on right mouse clicks. This removes the // unwanted click events. if (nativeEvent.button === 2) { return null; } /* falls through */ case topLevelTypes.topContextMenu: case topLevelTypes.topDoubleClick: case topLevelTypes.topMouseDown: case topLevelTypes.topMouseMove: case topLevelTypes.topMouseOut: case topLevelTypes.topMouseOver: case topLevelTypes.topMouseUp: EventConstructor = SyntheticMouseEvent; break; case topLevelTypes.topDrag: case topLevelTypes.topDragEnd: case topLevelTypes.topDragEnter: case topLevelTypes.topDragExit: case topLevelTypes.topDragLeave: case topLevelTypes.topDragOver: case topLevelTypes.topDragStart: case topLevelTypes.topDrop: EventConstructor = SyntheticDragEvent; break; case topLevelTypes.topTouchCancel: case topLevelTypes.topTouchEnd: case topLevelTypes.topTouchMove: case topLevelTypes.topTouchStart: EventConstructor = SyntheticTouchEvent; break; case topLevelTypes.topScroll: EventConstructor = SyntheticUIEvent; break; case topLevelTypes.topWheel: EventConstructor = SyntheticWheelEvent; break; case topLevelTypes.topCopy: case topLevelTypes.topCut: case topLevelTypes.topPaste: EventConstructor = SyntheticClipboardEvent; break; } ("production" !== "development" ? invariant( EventConstructor, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType ) : invariant(EventConstructor)); var event = EventConstructor.getPooled( dispatchConfig, topLevelTargetID, nativeEvent ); EventPropagators.accumulateTwoPhaseDispatches(event); return event; } }; module.exports = SimpleEventPlugin; },{"100":100,"101":101,"102":102,"122":122,"135":135,"141":141,"15":15,"154":154,"19":19,"20":20,"92":92,"94":94,"95":95,"96":96,"98":98,"99":99}],92:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticClipboardEvent * @typechecks static-only */ 'use strict'; var SyntheticEvent = _dereq_(95); /** * @interface Event * @see http://www.w3.org/TR/clipboard-apis/ */ var ClipboardEventInterface = { clipboardData: function(event) { return ( 'clipboardData' in event ? event.clipboardData : window.clipboardData ); } }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); module.exports = SyntheticClipboardEvent; },{"95":95}],93:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticCompositionEvent * @typechecks static-only */ 'use strict'; var SyntheticEvent = _dereq_(95); /** * @interface Event * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents */ var CompositionEventInterface = { data: null }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticCompositionEvent( dispatchConfig, dispatchMarker, nativeEvent) { SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticEvent.augmentClass( SyntheticCompositionEvent, CompositionEventInterface ); module.exports = SyntheticCompositionEvent; },{"95":95}],94:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticDragEvent * @typechecks static-only */ 'use strict'; var SyntheticMouseEvent = _dereq_(99); /** * @interface DragEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var DragEventInterface = { dataTransfer: null }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface); module.exports = SyntheticDragEvent; },{"99":99}],95:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticEvent * @typechecks static-only */ 'use strict'; var PooledClass = _dereq_(28); var assign = _dereq_(27); var emptyFunction = _dereq_(114); var getEventTarget = _dereq_(125); /** * @interface Event * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var EventInterface = { type: null, target: getEventTarget, // currentTarget is set when dispatching; no use in copying it here currentTarget: emptyFunction.thatReturnsNull, eventPhase: null, bubbles: null, cancelable: null, timeStamp: function(event) { return event.timeStamp || Date.now(); }, defaultPrevented: null, isTrusted: null }; /** * Synthetic events are dispatched by event plugins, typically in response to a * top-level event delegation handler. * * These systems should generally use pooling to reduce the frequency of garbage * collection. The system should check `isPersistent` to determine whether the * event should be released into the pool after being dispatched. Users that * need a persisted event should invoke `persist`. * * Synthetic events (and subclasses) implement the DOM Level 3 Events API by * normalizing browser quirks. Subclasses do not necessarily have to implement a * DOM interface; custom application-specific events can also subclass this. * * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. */ function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) { this.dispatchConfig = dispatchConfig; this.dispatchMarker = dispatchMarker; this.nativeEvent = nativeEvent; var Interface = this.constructor.Interface; for (var propName in Interface) { if (!Interface.hasOwnProperty(propName)) { continue; } var normalize = Interface[propName]; if (normalize) { this[propName] = normalize(nativeEvent); } else { this[propName] = nativeEvent[propName]; } } var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; if (defaultPrevented) { this.isDefaultPrevented = emptyFunction.thatReturnsTrue; } else { this.isDefaultPrevented = emptyFunction.thatReturnsFalse; } this.isPropagationStopped = emptyFunction.thatReturnsFalse; } assign(SyntheticEvent.prototype, { preventDefault: function() { this.defaultPrevented = true; var event = this.nativeEvent; if (event.preventDefault) { event.preventDefault(); } else { event.returnValue = false; } this.isDefaultPrevented = emptyFunction.thatReturnsTrue; }, stopPropagation: function() { var event = this.nativeEvent; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; } this.isPropagationStopped = emptyFunction.thatReturnsTrue; }, /** * We release all dispatched `SyntheticEvent`s after each event loop, adding * them back into the pool. This allows a way to hold onto a reference that * won't be added back into the pool. */ persist: function() { this.isPersistent = emptyFunction.thatReturnsTrue; }, /** * Checks if this event should be released back into the pool. * * @return {boolean} True if this should not be released, false otherwise. */ isPersistent: emptyFunction.thatReturnsFalse, /** * `PooledClass` looks for `destructor` on each instance it releases. */ destructor: function() { var Interface = this.constructor.Interface; for (var propName in Interface) { this[propName] = null; } this.dispatchConfig = null; this.dispatchMarker = null; this.nativeEvent = null; } }); SyntheticEvent.Interface = EventInterface; /** * Helper to reduce boilerplate when creating subclasses. * * @param {function} Class * @param {?object} Interface */ SyntheticEvent.augmentClass = function(Class, Interface) { var Super = this; var prototype = Object.create(Super.prototype); assign(prototype, Class.prototype); Class.prototype = prototype; Class.prototype.constructor = Class; Class.Interface = assign({}, Super.Interface, Interface); Class.augmentClass = Super.augmentClass; PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler); }; PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler); module.exports = SyntheticEvent; },{"114":114,"125":125,"27":27,"28":28}],96:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticFocusEvent * @typechecks static-only */ 'use strict'; var SyntheticUIEvent = _dereq_(101); /** * @interface FocusEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var FocusEventInterface = { relatedTarget: null }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); module.exports = SyntheticFocusEvent; },{"101":101}],97:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticInputEvent * @typechecks static-only */ 'use strict'; var SyntheticEvent = _dereq_(95); /** * @interface Event * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 * /#events-inputevents */ var InputEventInterface = { data: null }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticInputEvent( dispatchConfig, dispatchMarker, nativeEvent) { SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticEvent.augmentClass( SyntheticInputEvent, InputEventInterface ); module.exports = SyntheticInputEvent; },{"95":95}],98:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticKeyboardEvent * @typechecks static-only */ 'use strict'; var SyntheticUIEvent = _dereq_(101); var getEventCharCode = _dereq_(122); var getEventKey = _dereq_(123); var getEventModifierState = _dereq_(124); /** * @interface KeyboardEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var KeyboardEventInterface = { key: getEventKey, location: null, ctrlKey: null, shiftKey: null, altKey: null, metaKey: null, repeat: null, locale: null, getModifierState: getEventModifierState, // Legacy Interface charCode: function(event) { // `charCode` is the result of a KeyPress event and represents the value of // the actual printable character. // KeyPress is deprecated, but its replacement is not yet final and not // implemented in any major browser. Only KeyPress has charCode. if (event.type === 'keypress') { return getEventCharCode(event); } return 0; }, keyCode: function(event) { // `keyCode` is the result of a KeyDown/Up event and represents the value of // physical keyboard key. // The actual meaning of the value depends on the users' keyboard layout // which cannot be detected. Assuming that it is a US keyboard layout // provides a surprisingly accurate mapping for US and European users. // Due to this, it is left to the user to implement at this time. if (event.type === 'keydown' || event.type === 'keyup') { return event.keyCode; } return 0; }, which: function(event) { // `which` is an alias for either `keyCode` or `charCode` depending on the // type of the event. if (event.type === 'keypress') { return getEventCharCode(event); } if (event.type === 'keydown' || event.type === 'keyup') { return event.keyCode; } return 0; } }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); module.exports = SyntheticKeyboardEvent; },{"101":101,"122":122,"123":123,"124":124}],99:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticMouseEvent * @typechecks static-only */ 'use strict'; var SyntheticUIEvent = _dereq_(101); var ViewportMetrics = _dereq_(104); var getEventModifierState = _dereq_(124); /** * @interface MouseEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var MouseEventInterface = { screenX: null, screenY: null, clientX: null, clientY: null, ctrlKey: null, shiftKey: null, altKey: null, metaKey: null, getModifierState: getEventModifierState, button: function(event) { // Webkit, Firefox, IE9+ // which: 1 2 3 // button: 0 1 2 (standard) var button = event.button; if ('which' in event) { return button; } // IE<9 // which: undefined // button: 0 0 0 // button: 1 4 2 (onmouseup) return button === 2 ? 2 : button === 4 ? 1 : 0; }, buttons: null, relatedTarget: function(event) { return event.relatedTarget || ( ((event.fromElement === event.srcElement ? event.toElement : event.fromElement)) ); }, // "Proprietary" Interface. pageX: function(event) { return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft; }, pageY: function(event) { return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop; } }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); module.exports = SyntheticMouseEvent; },{"101":101,"104":104,"124":124}],100:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticTouchEvent * @typechecks static-only */ 'use strict'; var SyntheticUIEvent = _dereq_(101); var getEventModifierState = _dereq_(124); /** * @interface TouchEvent * @see http://www.w3.org/TR/touch-events/ */ var TouchEventInterface = { touches: null, targetTouches: null, changedTouches: null, altKey: null, metaKey: null, ctrlKey: null, shiftKey: null, getModifierState: getEventModifierState }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); module.exports = SyntheticTouchEvent; },{"101":101,"124":124}],101:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticUIEvent * @typechecks static-only */ 'use strict'; var SyntheticEvent = _dereq_(95); var getEventTarget = _dereq_(125); /** * @interface UIEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var UIEventInterface = { view: function(event) { if (event.view) { return event.view; } var target = getEventTarget(event); if (target != null && target.window === target) { // target is a window object return target; } var doc = target.ownerDocument; // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. if (doc) { return doc.defaultView || doc.parentWindow; } else { return window; } }, detail: function(event) { return event.detail || 0; } }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticEvent} */ function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); module.exports = SyntheticUIEvent; },{"125":125,"95":95}],102:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SyntheticWheelEvent * @typechecks static-only */ 'use strict'; var SyntheticMouseEvent = _dereq_(99); /** * @interface WheelEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var WheelEventInterface = { deltaX: function(event) { return ( 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). 'wheelDeltaX' in event ? -event.wheelDeltaX : 0 ); }, deltaY: function(event) { return ( 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). 'wheelDelta' in event ? -event.wheelDelta : 0 ); }, deltaZ: null, // Browsers without "deltaMode" is reporting in raw wheel delta where one // notch on the scroll is always +/- 120, roughly equivalent to pixels. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. deltaMode: null }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticMouseEvent} */ function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); module.exports = SyntheticWheelEvent; },{"99":99}],103:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule Transaction */ 'use strict'; var invariant = _dereq_(135); /** * `Transaction` creates a black box that is able to wrap any method such that * certain invariants are maintained before and after the method is invoked * (Even if an exception is thrown while invoking the wrapped method). Whoever * instantiates a transaction can provide enforcers of the invariants at * creation time. The `Transaction` class itself will supply one additional * automatic invariant for you - the invariant that any transaction instance * should not be run while it is already being run. You would typically create a * single instance of a `Transaction` for reuse multiple times, that potentially * is used to wrap several different methods. Wrappers are extremely simple - * they only require implementing two methods. * * <pre> * wrappers (injected at creation time) * + + * | | * +-----------------|--------|--------------+ * | v | | * | +---------------+ | | * | +--| wrapper1 |---|----+ | * | | +---------------+ v | | * | | +-------------+ | | * | | +----| wrapper2 |--------+ | * | | | +-------------+ | | | * | | | | | | * | v v v v | wrapper * | +---+ +---+ +---------+ +---+ +---+ | invariants * perform(anyMethod) | | | | | | | | | | | | maintained * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|--------> * | | | | | | | | | | | | * | | | | | | | | | | | | * | | | | | | | | | | | | * | +---+ +---+ +---------+ +---+ +---+ | * | initialize close | * +-----------------------------------------+ * </pre> * * Use cases: * - Preserving the input selection ranges before/after reconciliation. * Restoring selection even in the event of an unexpected error. * - Deactivating events while rearranging the DOM, preventing blurs/focuses, * while guaranteeing that afterwards, the event system is reactivated. * - Flushing a queue of collected DOM mutations to the main UI thread after a * reconciliation takes place in a worker thread. * - Invoking any collected `componentDidUpdate` callbacks after rendering new * content. * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue * to preserve the `scrollTop` (an automatic scroll aware DOM). * - (Future use case): Layout calculations before and after DOM updates. * * Transactional plugin API: * - A module that has an `initialize` method that returns any precomputation. * - and a `close` method that accepts the precomputation. `close` is invoked * when the wrapped process is completed, or has failed. * * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules * that implement `initialize` and `close`. * @return {Transaction} Single transaction for reuse in thread. * * @class Transaction */ var Mixin = { /** * Sets up this instance so that it is prepared for collecting metrics. Does * so such that this setup method may be used on an instance that is already * initialized, in a way that does not consume additional memory upon reuse. * That can be useful if you decide to make your subclass of this mixin a * "PooledClass". */ reinitializeTransaction: function() { this.transactionWrappers = this.getTransactionWrappers(); if (!this.wrapperInitData) { this.wrapperInitData = []; } else { this.wrapperInitData.length = 0; } this._isInTransaction = false; }, _isInTransaction: false, /** * @abstract * @return {Array<TransactionWrapper>} Array of transaction wrappers. */ getTransactionWrappers: null, isInTransaction: function() { return !!this._isInTransaction; }, /** * Executes the function within a safety window. Use this for the top level * methods that result in large amounts of computation/mutations that would * need to be safety checked. * * @param {function} method Member of scope to call. * @param {Object} scope Scope to invoke from. * @param {Object?=} args... Arguments to pass to the method (optional). * Helps prevent need to bind in many cases. * @return Return value from `method`. */ perform: function(method, scope, a, b, c, d, e, f) { ("production" !== "development" ? invariant( !this.isInTransaction(), 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.' ) : invariant(!this.isInTransaction())); var errorThrown; var ret; try { this._isInTransaction = true; // Catching errors makes debugging more difficult, so we start with // errorThrown set to true before setting it to false after calling // close -- if it's still set to true in the finally block, it means // one of these calls threw. errorThrown = true; this.initializeAll(0); ret = method.call(scope, a, b, c, d, e, f); errorThrown = false; } finally { try { if (errorThrown) { // If `method` throws, prefer to show that stack trace over any thrown // by invoking `closeAll`. try { this.closeAll(0); } catch (err) { } } else { // Since `method` didn't throw, we don't want to silence the exception // here. this.closeAll(0); } } finally { this._isInTransaction = false; } } return ret; }, initializeAll: function(startIndex) { var transactionWrappers = this.transactionWrappers; for (var i = startIndex; i < transactionWrappers.length; i++) { var wrapper = transactionWrappers[i]; try { // Catching errors makes debugging more difficult, so we start with the // OBSERVED_ERROR state before overwriting it with the real return value // of initialize -- if it's still set to OBSERVED_ERROR in the finally // block, it means wrapper.initialize threw. this.wrapperInitData[i] = Transaction.OBSERVED_ERROR; this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null; } finally { if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) { // The initializer for wrapper i threw an error; initialize the // remaining wrappers but silence any exceptions from them to ensure // that the first error is the one to bubble up. try { this.initializeAll(i + 1); } catch (err) { } } } } }, /** * Invokes each of `this.transactionWrappers.close[i]` functions, passing into * them the respective return values of `this.transactionWrappers.init[i]` * (`close`rs that correspond to initializers that failed will not be * invoked). */ closeAll: function(startIndex) { ("production" !== "development" ? invariant( this.isInTransaction(), 'Transaction.closeAll(): Cannot close transaction when none are open.' ) : invariant(this.isInTransaction())); var transactionWrappers = this.transactionWrappers; for (var i = startIndex; i < transactionWrappers.length; i++) { var wrapper = transactionWrappers[i]; var initData = this.wrapperInitData[i]; var errorThrown; try { // Catching errors makes debugging more difficult, so we start with // errorThrown set to true before setting it to false after calling // close -- if it's still set to true in the finally block, it means // wrapper.close threw. errorThrown = true; if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) { wrapper.close.call(this, initData); } errorThrown = false; } finally { if (errorThrown) { // The closer for wrapper i threw an error; close the remaining // wrappers but silence any exceptions from them to ensure that the // first error is the one to bubble up. try { this.closeAll(i + 1); } catch (e) { } } } } this.wrapperInitData.length = 0; } }; var Transaction = { Mixin: Mixin, /** * Token to look for to determine if an error occured. */ OBSERVED_ERROR: {} }; module.exports = Transaction; },{"135":135}],104:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ViewportMetrics */ 'use strict'; var ViewportMetrics = { currentScrollLeft: 0, currentScrollTop: 0, refreshScrollValues: function(scrollPosition) { ViewportMetrics.currentScrollLeft = scrollPosition.x; ViewportMetrics.currentScrollTop = scrollPosition.y; } }; module.exports = ViewportMetrics; },{}],105:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule accumulateInto */ 'use strict'; var invariant = _dereq_(135); /** * * Accumulates items that must not be null or undefined into the first one. This * is used to conserve memory by avoiding array allocations, and thus sacrifices * API cleanness. Since `current` can be null before being passed in and not * null after this function, make sure to assign it back to `current`: * * `a = accumulateInto(a, b);` * * This API should be sparingly used. Try `accumulate` for something cleaner. * * @return {*|array<*>} An accumulation of items. */ function accumulateInto(current, next) { ("production" !== "development" ? invariant( next != null, 'accumulateInto(...): Accumulated items must not be null or undefined.' ) : invariant(next != null)); if (current == null) { return next; } // Both are not empty. Warning: Never call x.concat(y) when you are not // certain that x is an Array (x could be a string with concat method). var currentIsArray = Array.isArray(current); var nextIsArray = Array.isArray(next); if (currentIsArray && nextIsArray) { current.push.apply(current, next); return current; } if (currentIsArray) { current.push(next); return current; } if (nextIsArray) { // A bit too dangerous to mutate `next`. return [current].concat(next); } return [current, next]; } module.exports = accumulateInto; },{"135":135}],106:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule adler32 */ /* jslint bitwise:true */ 'use strict'; var MOD = 65521; // This is a clean-room implementation of adler32 designed for detecting // if markup is not what we expect it to be. It does not need to be // cryptographically strong, only reasonably good at detecting if markup // generated on the server is different than that on the client. function adler32(data) { var a = 1; var b = 0; for (var i = 0; i < data.length; i++) { a = (a + data.charCodeAt(i)) % MOD; b = (b + a) % MOD; } return a | (b << 16); } module.exports = adler32; },{}],107:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule camelize * @typechecks */ var _hyphenPattern = /-(.)/g; /** * Camelcases a hyphenated string, for example: * * > camelize('background-color') * < "backgroundColor" * * @param {string} string * @return {string} */ function camelize(string) { return string.replace(_hyphenPattern, function(_, character) { return character.toUpperCase(); }); } module.exports = camelize; },{}],108:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule camelizeStyleName * @typechecks */ "use strict"; var camelize = _dereq_(107); var msPattern = /^-ms-/; /** * Camelcases a hyphenated CSS property name, for example: * * > camelizeStyleName('background-color') * < "backgroundColor" * > camelizeStyleName('-moz-transition') * < "MozTransition" * > camelizeStyleName('-ms-transition') * < "msTransition" * * As Andi Smith suggests * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix * is converted to lowercase `ms`. * * @param {string} string * @return {string} */ function camelizeStyleName(string) { return camelize(string.replace(msPattern, 'ms-')); } module.exports = camelizeStyleName; },{"107":107}],109:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule containsNode * @typechecks */ var isTextNode = _dereq_(139); /*jslint bitwise:true */ /** * Checks if a given DOM node contains or is another DOM node. * * @param {?DOMNode} outerNode Outer DOM node. * @param {?DOMNode} innerNode Inner DOM node. * @return {boolean} True if `outerNode` contains or is `innerNode`. */ function containsNode(outerNode, innerNode) { if (!outerNode || !innerNode) { return false; } else if (outerNode === innerNode) { return true; } else if (isTextNode(outerNode)) { return false; } else if (isTextNode(innerNode)) { return containsNode(outerNode, innerNode.parentNode); } else if (outerNode.contains) { return outerNode.contains(innerNode); } else if (outerNode.compareDocumentPosition) { return !!(outerNode.compareDocumentPosition(innerNode) & 16); } else { return false; } } module.exports = containsNode; },{"139":139}],110:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule createArrayFromMixed * @typechecks */ var toArray = _dereq_(152); /** * Perform a heuristic test to determine if an object is "array-like". * * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" * Joshu replied: "Mu." * * This function determines if its argument has "array nature": it returns * true if the argument is an actual array, an `arguments' object, or an * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). * * It will return false for other array-like objects like Filelist. * * @param {*} obj * @return {boolean} */ function hasArrayNature(obj) { return ( // not null/false !!obj && // arrays are objects, NodeLists are functions in Safari (typeof obj == 'object' || typeof obj == 'function') && // quacks like an array ('length' in obj) && // not window !('setInterval' in obj) && // no DOM node should be considered an array-like // a 'select' element has 'length' and 'item' properties on IE8 (typeof obj.nodeType != 'number') && ( // a real array (// HTMLCollection/NodeList (Array.isArray(obj) || // arguments ('callee' in obj) || 'item' in obj)) ) ); } /** * Ensure that the argument is an array by wrapping it in an array if it is not. * Creates a copy of the argument if it is already an array. * * This is mostly useful idiomatically: * * var createArrayFromMixed = require('createArrayFromMixed'); * * function takesOneOrMoreThings(things) { * things = createArrayFromMixed(things); * ... * } * * This allows you to treat `things' as an array, but accept scalars in the API. * * If you need to convert an array-like object, like `arguments`, into an array * use toArray instead. * * @param {*} obj * @return {array} */ function createArrayFromMixed(obj) { if (!hasArrayNature(obj)) { return [obj]; } else if (Array.isArray(obj)) { return obj.slice(); } else { return toArray(obj); } } module.exports = createArrayFromMixed; },{"152":152}],111:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule createFullPageComponent * @typechecks */ 'use strict'; // Defeat circular references by requiring this directly. var ReactClass = _dereq_(33); var ReactElement = _dereq_(57); var invariant = _dereq_(135); /** * Create a component that will throw an exception when unmounted. * * Components like <html> <head> and <body> can't be removed or added * easily in a cross-browser way, however it's valuable to be able to * take advantage of React's reconciliation for styling and <title> * management. So we just document it and throw in dangerous cases. * * @param {string} tag The tag to wrap * @return {function} convenience constructor of new component */ function createFullPageComponent(tag) { var elementFactory = ReactElement.createFactory(tag); var FullPageComponent = ReactClass.createClass({ tagName: tag.toUpperCase(), displayName: 'ReactFullPageComponent' + tag, componentWillUnmount: function() { ("production" !== "development" ? invariant( false, '%s tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, <head>, ' + 'and <body>) reliably and efficiently. To fix this, have a single ' + 'top-level component that never unmounts render these elements.', this.constructor.displayName ) : invariant(false)); }, render: function() { return elementFactory(this.props); } }); return FullPageComponent; } module.exports = createFullPageComponent; },{"135":135,"33":33,"57":57}],112:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule createNodesFromMarkup * @typechecks */ /*jslint evil: true, sub: true */ var ExecutionEnvironment = _dereq_(21); var createArrayFromMixed = _dereq_(110); var getMarkupWrap = _dereq_(127); var invariant = _dereq_(135); /** * Dummy container used to render all markup. */ var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; /** * Pattern used by `getNodeName`. */ var nodeNamePattern = /^\s*<(\w+)/; /** * Extracts the `nodeName` of the first element in a string of markup. * * @param {string} markup String of markup. * @return {?string} Node name of the supplied markup. */ function getNodeName(markup) { var nodeNameMatch = markup.match(nodeNamePattern); return nodeNameMatch && nodeNameMatch[1].toLowerCase(); } /** * Creates an array containing the nodes rendered from the supplied markup. The * optionally supplied `handleScript` function will be invoked once for each * <script> element that is rendered. If no `handleScript` function is supplied, * an exception is thrown if any <script> elements are rendered. * * @param {string} markup A string of valid HTML markup. * @param {?function} handleScript Invoked once for each rendered <script>. * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes. */ function createNodesFromMarkup(markup, handleScript) { var node = dummyNode; ("production" !== "development" ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode)); var nodeName = getNodeName(markup); var wrap = nodeName && getMarkupWrap(nodeName); if (wrap) { node.innerHTML = wrap[1] + markup + wrap[2]; var wrapDepth = wrap[0]; while (wrapDepth--) { node = node.lastChild; } } else { node.innerHTML = markup; } var scripts = node.getElementsByTagName('script'); if (scripts.length) { ("production" !== "development" ? invariant( handleScript, 'createNodesFromMarkup(...): Unexpected <script> element rendered.' ) : invariant(handleScript)); createArrayFromMixed(scripts).forEach(handleScript); } var nodes = createArrayFromMixed(node.childNodes); while (node.lastChild) { node.removeChild(node.lastChild); } return nodes; } module.exports = createNodesFromMarkup; },{"110":110,"127":127,"135":135,"21":21}],113:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule dangerousStyleValue * @typechecks static-only */ 'use strict'; var CSSProperty = _dereq_(4); var isUnitlessNumber = CSSProperty.isUnitlessNumber; /** * Convert a value into the proper css writable value. The style name `name` * should be logical (no hyphens), as specified * in `CSSProperty.isUnitlessNumber`. * * @param {string} name CSS property name such as `topMargin`. * @param {*} value CSS property value such as `10px`. * @return {string} Normalized style value with dimensions applied. */ function dangerousStyleValue(name, value) { // Note that we've removed escapeTextForBrowser() calls here since the // whole string will be escaped when the attribute is injected into // the markup. If you provide unsafe user data here they can inject // arbitrary CSS which may be problematic (I couldn't repro this): // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/ // This is not an XSS hole but instead a potential CSS injection issue // which has lead to a greater discussion about how we're going to // trust URLs moving forward. See #2115901 var isEmpty = value == null || typeof value === 'boolean' || value === ''; if (isEmpty) { return ''; } var isNonNumeric = isNaN(value); if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) { return '' + value; // cast to string } if (typeof value === 'string') { value = value.trim(); } return value + 'px'; } module.exports = dangerousStyleValue; },{"4":4}],114:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule emptyFunction */ function makeEmptyFunction(arg) { return function() { return arg; }; } /** * This function accepts and discards inputs; it has no side effects. This is * primarily useful idiomatically for overridable function endpoints which * always need to be callable, since JS lacks a null-call idiom ala Cocoa. */ function emptyFunction() {} emptyFunction.thatReturns = makeEmptyFunction; emptyFunction.thatReturnsFalse = makeEmptyFunction(false); emptyFunction.thatReturnsTrue = makeEmptyFunction(true); emptyFunction.thatReturnsNull = makeEmptyFunction(null); emptyFunction.thatReturnsThis = function() { return this; }; emptyFunction.thatReturnsArgument = function(arg) { return arg; }; module.exports = emptyFunction; },{}],115:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule emptyObject */ "use strict"; var emptyObject = {}; if ("production" !== "development") { Object.freeze(emptyObject); } module.exports = emptyObject; },{}],116:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule escapeTextContentForBrowser */ 'use strict'; var ESCAPE_LOOKUP = { '&': '&amp;', '>': '&gt;', '<': '&lt;', '"': '&quot;', '\'': '&#x27;' }; var ESCAPE_REGEX = /[&><"']/g; function escaper(match) { return ESCAPE_LOOKUP[match]; } /** * Escapes text to prevent scripting attacks. * * @param {*} text Text value to escape. * @return {string} An escaped string. */ function escapeTextContentForBrowser(text) { return ('' + text).replace(ESCAPE_REGEX, escaper); } module.exports = escapeTextContentForBrowser; },{}],117:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule findDOMNode * @typechecks static-only */ 'use strict'; var ReactCurrentOwner = _dereq_(39); var ReactInstanceMap = _dereq_(67); var ReactMount = _dereq_(70); var invariant = _dereq_(135); var isNode = _dereq_(137); var warning = _dereq_(154); /** * Returns the DOM node rendered by this element. * * @param {ReactComponent|DOMElement} componentOrElement * @return {DOMElement} The root node of this element. */ function findDOMNode(componentOrElement) { if ("production" !== "development") { var owner = ReactCurrentOwner.current; if (owner !== null) { ("production" !== "development" ? warning( owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component' ) : null); owner._warnedAboutRefsInRender = true; } } if (componentOrElement == null) { return null; } if (isNode(componentOrElement)) { return componentOrElement; } if (ReactInstanceMap.has(componentOrElement)) { return ReactMount.getNodeFromInstance(componentOrElement); } ("production" !== "development" ? invariant( componentOrElement.render == null || typeof componentOrElement.render !== 'function', 'Component (with keys: %s) contains `render` method ' + 'but is not mounted in the DOM', Object.keys(componentOrElement) ) : invariant(componentOrElement.render == null || typeof componentOrElement.render !== 'function')); ("production" !== "development" ? invariant( false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement) ) : invariant(false)); } module.exports = findDOMNode; },{"135":135,"137":137,"154":154,"39":39,"67":67,"70":70}],118:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule flattenChildren */ 'use strict'; var traverseAllChildren = _dereq_(153); var warning = _dereq_(154); /** * @param {function} traverseContext Context passed through traversal. * @param {?ReactComponent} child React child component. * @param {!string} name String name of key path to child. */ function flattenSingleChildIntoContext(traverseContext, child, name) { // We found a component instance. var result = traverseContext; var keyUnique = !result.hasOwnProperty(name); if ("production" !== "development") { ("production" !== "development" ? warning( keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name ) : null); } if (keyUnique && child != null) { result[name] = child; } } /** * Flattens children that are typically specified as `props.children`. Any null * children will not be included in the resulting object. * @return {!object} flattened children keyed by name. */ function flattenChildren(children) { if (children == null) { return children; } var result = {}; traverseAllChildren(children, flattenSingleChildIntoContext, result); return result; } module.exports = flattenChildren; },{"153":153,"154":154}],119:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule focusNode */ "use strict"; /** * @param {DOMElement} node input/textarea to focus */ function focusNode(node) { // IE8 can throw "Can't move focus to the control because it is invisible, // not enabled, or of a type that does not accept the focus." for all kinds of // reasons that are too expensive and fragile to test. try { node.focus(); } catch(e) { } } module.exports = focusNode; },{}],120:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule forEachAccumulated */ 'use strict'; /** * @param {array} an "accumulation" of items which is either an Array or * a single item. Useful when paired with the `accumulate` module. This is a * simple utility that allows us to reason about a collection of items, but * handling the case when there is exactly one item (and we do not need to * allocate an array). */ var forEachAccumulated = function(arr, cb, scope) { if (Array.isArray(arr)) { arr.forEach(cb, scope); } else if (arr) { cb.call(scope, arr); } }; module.exports = forEachAccumulated; },{}],121:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getActiveElement * @typechecks */ /** * Same as document.activeElement but wraps in a try-catch block. In IE it is * not safe to call document.activeElement if there is nothing focused. * * The activeElement will be null only if the document body is not yet defined. */ function getActiveElement() /*?DOMElement*/ { try { return document.activeElement || document.body; } catch (e) { return document.body; } } module.exports = getActiveElement; },{}],122:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getEventCharCode * @typechecks static-only */ 'use strict'; /** * `charCode` represents the actual "character code" and is safe to use with * `String.fromCharCode`. As such, only keys that correspond to printable * characters produce a valid `charCode`, the only exception to this is Enter. * The Tab-key is considered non-printable and does not have a `charCode`, * presumably because it does not produce a tab-character in browsers. * * @param {object} nativeEvent Native browser event. * @return {string} Normalized `charCode` property. */ function getEventCharCode(nativeEvent) { var charCode; var keyCode = nativeEvent.keyCode; if ('charCode' in nativeEvent) { charCode = nativeEvent.charCode; // FF does not set `charCode` for the Enter-key, check against `keyCode`. if (charCode === 0 && keyCode === 13) { charCode = 13; } } else { // IE8 does not implement `charCode`, but `keyCode` has the correct value. charCode = keyCode; } // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. // Must not discard the (non-)printable Enter-key. if (charCode >= 32 || charCode === 13) { return charCode; } return 0; } module.exports = getEventCharCode; },{}],123:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getEventKey * @typechecks static-only */ 'use strict'; var getEventCharCode = _dereq_(122); /** * Normalization of deprecated HTML5 `key` values * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names */ var normalizeKey = { 'Esc': 'Escape', 'Spacebar': ' ', 'Left': 'ArrowLeft', 'Up': 'ArrowUp', 'Right': 'ArrowRight', 'Down': 'ArrowDown', 'Del': 'Delete', 'Win': 'OS', 'Menu': 'ContextMenu', 'Apps': 'ContextMenu', 'Scroll': 'ScrollLock', 'MozPrintableKey': 'Unidentified' }; /** * Translation from legacy `keyCode` to HTML5 `key` * Only special keys supported, all others depend on keyboard layout or browser * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names */ var translateToKey = { 8: 'Backspace', 9: 'Tab', 12: 'Clear', 13: 'Enter', 16: 'Shift', 17: 'Control', 18: 'Alt', 19: 'Pause', 20: 'CapsLock', 27: 'Escape', 32: ' ', 33: 'PageUp', 34: 'PageDown', 35: 'End', 36: 'Home', 37: 'ArrowLeft', 38: 'ArrowUp', 39: 'ArrowRight', 40: 'ArrowDown', 45: 'Insert', 46: 'Delete', 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6', 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12', 144: 'NumLock', 145: 'ScrollLock', 224: 'Meta' }; /** * @param {object} nativeEvent Native browser event. * @return {string} Normalized `key` property. */ function getEventKey(nativeEvent) { if (nativeEvent.key) { // Normalize inconsistent values reported by browsers due to // implementations of a working draft specification. // FireFox implements `key` but returns `MozPrintableKey` for all // printable characters (normalized to `Unidentified`), ignore it. var key = normalizeKey[nativeEvent.key] || nativeEvent.key; if (key !== 'Unidentified') { return key; } } // Browser does not implement `key`, polyfill as much of it as we can. if (nativeEvent.type === 'keypress') { var charCode = getEventCharCode(nativeEvent); // The enter-key is technically both printable and non-printable and can // thus be captured by `keypress`, no other non-printable key should. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); } if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { // While user keyboard layout determines the actual meaning of each // `keyCode` value, almost all function keys have a universal value. return translateToKey[nativeEvent.keyCode] || 'Unidentified'; } return ''; } module.exports = getEventKey; },{"122":122}],124:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getEventModifierState * @typechecks static-only */ 'use strict'; /** * Translation from modifier key to the associated property in the event. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers */ var modifierKeyToProp = { 'Alt': 'altKey', 'Control': 'ctrlKey', 'Meta': 'metaKey', 'Shift': 'shiftKey' }; // IE8 does not implement getModifierState so we simply map it to the only // modifier keys exposed by the event itself, does not support Lock-keys. // Currently, all major browsers except Chrome seems to support Lock-keys. function modifierStateGetter(keyArg) { /*jshint validthis:true */ var syntheticEvent = this; var nativeEvent = syntheticEvent.nativeEvent; if (nativeEvent.getModifierState) { return nativeEvent.getModifierState(keyArg); } var keyProp = modifierKeyToProp[keyArg]; return keyProp ? !!nativeEvent[keyProp] : false; } function getEventModifierState(nativeEvent) { return modifierStateGetter; } module.exports = getEventModifierState; },{}],125:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getEventTarget * @typechecks static-only */ 'use strict'; /** * Gets the target node from a native browser event by accounting for * inconsistencies in browser DOM APIs. * * @param {object} nativeEvent Native browser event. * @return {DOMEventTarget} Target node. */ function getEventTarget(nativeEvent) { var target = nativeEvent.target || nativeEvent.srcElement || window; // Safari may fire events on text nodes (Node.TEXT_NODE is 3). // @see http://www.quirksmode.org/js/events_properties.html return target.nodeType === 3 ? target.parentNode : target; } module.exports = getEventTarget; },{}],126:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getIteratorFn * @typechecks static-only */ 'use strict'; /* global Symbol */ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. /** * Returns the iterator method function contained on the iterable object. * * Be sure to invoke the function with the iterable as context: * * var iteratorFn = getIteratorFn(myIterable); * if (iteratorFn) { * var iterator = iteratorFn.call(myIterable); * ... * } * * @param {?object} maybeIterable * @return {?function} */ function getIteratorFn(maybeIterable) { var iteratorFn = maybeIterable && ( (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]) ); if (typeof iteratorFn === 'function') { return iteratorFn; } } module.exports = getIteratorFn; },{}],127:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getMarkupWrap */ var ExecutionEnvironment = _dereq_(21); var invariant = _dereq_(135); /** * Dummy container used to detect which wraps are necessary. */ var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; /** * Some browsers cannot use `innerHTML` to render certain elements standalone, * so we wrap them, render the wrapped nodes, then extract the desired node. * * In IE8, certain elements cannot render alone, so wrap all elements ('*'). */ var shouldWrap = { // Force wrapping for SVG elements because if they get created inside a <div>, // they will be initialized in the wrong namespace (and will not display). 'circle': true, 'clipPath': true, 'defs': true, 'ellipse': true, 'g': true, 'line': true, 'linearGradient': true, 'path': true, 'polygon': true, 'polyline': true, 'radialGradient': true, 'rect': true, 'stop': true, 'text': true }; var selectWrap = [1, '<select multiple="true">', '</select>']; var tableWrap = [1, '<table>', '</table>']; var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>']; var svgWrap = [1, '<svg>', '</svg>']; var markupWrap = { '*': [1, '?<div>', '</div>'], 'area': [1, '<map>', '</map>'], 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'], 'legend': [1, '<fieldset>', '</fieldset>'], 'param': [1, '<object>', '</object>'], 'tr': [2, '<table><tbody>', '</tbody></table>'], 'optgroup': selectWrap, 'option': selectWrap, 'caption': tableWrap, 'colgroup': tableWrap, 'tbody': tableWrap, 'tfoot': tableWrap, 'thead': tableWrap, 'td': trWrap, 'th': trWrap, 'circle': svgWrap, 'clipPath': svgWrap, 'defs': svgWrap, 'ellipse': svgWrap, 'g': svgWrap, 'line': svgWrap, 'linearGradient': svgWrap, 'path': svgWrap, 'polygon': svgWrap, 'polyline': svgWrap, 'radialGradient': svgWrap, 'rect': svgWrap, 'stop': svgWrap, 'text': svgWrap }; /** * Gets the markup wrap configuration for the supplied `nodeName`. * * NOTE: This lazily detects which wraps are necessary for the current browser. * * @param {string} nodeName Lowercase `nodeName`. * @return {?array} Markup wrap configuration, if applicable. */ function getMarkupWrap(nodeName) { ("production" !== "development" ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode)); if (!markupWrap.hasOwnProperty(nodeName)) { nodeName = '*'; } if (!shouldWrap.hasOwnProperty(nodeName)) { if (nodeName === '*') { dummyNode.innerHTML = '<link />'; } else { dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>'; } shouldWrap[nodeName] = !dummyNode.firstChild; } return shouldWrap[nodeName] ? markupWrap[nodeName] : null; } module.exports = getMarkupWrap; },{"135":135,"21":21}],128:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getNodeForCharacterOffset */ 'use strict'; /** * Given any node return the first leaf node without children. * * @param {DOMElement|DOMTextNode} node * @return {DOMElement|DOMTextNode} */ function getLeafNode(node) { while (node && node.firstChild) { node = node.firstChild; } return node; } /** * Get the next sibling within a container. This will walk up the * DOM if a node's siblings have been exhausted. * * @param {DOMElement|DOMTextNode} node * @return {?DOMElement|DOMTextNode} */ function getSiblingNode(node) { while (node) { if (node.nextSibling) { return node.nextSibling; } node = node.parentNode; } } /** * Get object describing the nodes which contain characters at offset. * * @param {DOMElement|DOMTextNode} root * @param {number} offset * @return {?object} */ function getNodeForCharacterOffset(root, offset) { var node = getLeafNode(root); var nodeStart = 0; var nodeEnd = 0; while (node) { if (node.nodeType === 3) { nodeEnd = nodeStart + node.textContent.length; if (nodeStart <= offset && nodeEnd >= offset) { return { node: node, offset: offset - nodeStart }; } nodeStart = nodeEnd; } node = getLeafNode(getSiblingNode(node)); } } module.exports = getNodeForCharacterOffset; },{}],129:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getReactRootElementInContainer */ 'use strict'; var DOC_NODE_TYPE = 9; /** * @param {DOMElement|DOMDocument} container DOM element that may contain * a React component * @return {?*} DOM element that may have the reactRoot ID, or null. */ function getReactRootElementInContainer(container) { if (!container) { return null; } if (container.nodeType === DOC_NODE_TYPE) { return container.documentElement; } else { return container.firstChild; } } module.exports = getReactRootElementInContainer; },{}],130:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getTextContentAccessor */ 'use strict'; var ExecutionEnvironment = _dereq_(21); var contentKey = null; /** * Gets the key used to access text content on a DOM node. * * @return {?string} Key used to access text content. * @internal */ function getTextContentAccessor() { if (!contentKey && ExecutionEnvironment.canUseDOM) { // Prefer textContent to innerText because many browsers support both but // SVG <text> elements don't support innerText even when <div> does. contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; } return contentKey; } module.exports = getTextContentAccessor; },{"21":21}],131:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getUnboundedScrollPosition * @typechecks */ "use strict"; /** * Gets the scroll position of the supplied element or window. * * The return values are unbounded, unlike `getScrollPosition`. This means they * may be negative or exceed the element boundaries (which is possible using * inertial scrolling). * * @param {DOMWindow|DOMElement} scrollable * @return {object} Map with `x` and `y` keys. */ function getUnboundedScrollPosition(scrollable) { if (scrollable === window) { return { x: window.pageXOffset || document.documentElement.scrollLeft, y: window.pageYOffset || document.documentElement.scrollTop }; } return { x: scrollable.scrollLeft, y: scrollable.scrollTop }; } module.exports = getUnboundedScrollPosition; },{}],132:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule hyphenate * @typechecks */ var _uppercasePattern = /([A-Z])/g; /** * Hyphenates a camelcased string, for example: * * > hyphenate('backgroundColor') * < "background-color" * * For CSS style names, use `hyphenateStyleName` instead which works properly * with all vendor prefixes, including `ms`. * * @param {string} string * @return {string} */ function hyphenate(string) { return string.replace(_uppercasePattern, '-$1').toLowerCase(); } module.exports = hyphenate; },{}],133:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule hyphenateStyleName * @typechecks */ "use strict"; var hyphenate = _dereq_(132); var msPattern = /^ms-/; /** * Hyphenates a camelcased CSS property name, for example: * * > hyphenateStyleName('backgroundColor') * < "background-color" * > hyphenateStyleName('MozTransition') * < "-moz-transition" * > hyphenateStyleName('msTransition') * < "-ms-transition" * * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix * is converted to `-ms-`. * * @param {string} string * @return {string} */ function hyphenateStyleName(string) { return hyphenate(string).replace(msPattern, '-ms-'); } module.exports = hyphenateStyleName; },{"132":132}],134:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule instantiateReactComponent * @typechecks static-only */ 'use strict'; var ReactCompositeComponent = _dereq_(37); var ReactEmptyComponent = _dereq_(59); var ReactNativeComponent = _dereq_(73); var assign = _dereq_(27); var invariant = _dereq_(135); var warning = _dereq_(154); // To avoid a cyclic dependency, we create the final class in this module var ReactCompositeComponentWrapper = function() { }; assign( ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, { _instantiateReactComponent: instantiateReactComponent } ); /** * Check if the type reference is a known internal type. I.e. not a user * provided composite type. * * @param {function} type * @return {boolean} Returns true if this is a valid internal type. */ function isInternalComponentType(type) { return ( typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function' ); } /** * Given a ReactNode, create an instance that will actually be mounted. * * @param {ReactNode} node * @param {*} parentCompositeType The composite type that resolved this. * @return {object} A new instance of the element's constructor. * @protected */ function instantiateReactComponent(node, parentCompositeType) { var instance; if (node === null || node === false) { node = ReactEmptyComponent.emptyElement; } if (typeof node === 'object') { var element = node; if ("production" !== "development") { ("production" !== "development" ? warning( element && (typeof element.type === 'function' || typeof element.type === 'string'), 'Only functions or strings can be mounted as React components.' ) : null); } // Special case string values if (parentCompositeType === element.type && typeof element.type === 'string') { // Avoid recursion if the wrapper renders itself. instance = ReactNativeComponent.createInternalComponent(element); // All native components are currently wrapped in a composite so we're // safe to assume that this is what we should instantiate. } else if (isInternalComponentType(element.type)) { // This is temporarily available for custom components that are not string // represenations. I.e. ART. Once those are updated to use the string // representation, we can drop this code path. instance = new element.type(element); } else { instance = new ReactCompositeComponentWrapper(); } } else if (typeof node === 'string' || typeof node === 'number') { instance = ReactNativeComponent.createInstanceForText(node); } else { ("production" !== "development" ? invariant( false, 'Encountered invalid React node of type %s', typeof node ) : invariant(false)); } if ("production" !== "development") { ("production" !== "development" ? warning( typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.' ) : null); } // Sets up the instance. This can probably just move into the constructor now. instance.construct(node); // These two fields are used by the DOM and ART diffing algorithms // respectively. Instead of using expandos on components, we should be // storing the state needed by the diffing algorithms elsewhere. instance._mountIndex = 0; instance._mountImage = null; if ("production" !== "development") { instance._isOwnerNecessary = false; instance._warnedAboutRefsInRender = false; } // Internal instances should fully constructed at this point, so they should // not get any new fields added to them at this point. if ("production" !== "development") { if (Object.preventExtensions) { Object.preventExtensions(instance); } } return instance; } module.exports = instantiateReactComponent; },{"135":135,"154":154,"27":27,"37":37,"59":59,"73":73}],135:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule invariant */ "use strict"; /** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ var invariant = function(condition, format, a, b, c, d, e, f) { if ("production" !== "development") { if (format === undefined) { throw new Error('invariant requires an error message argument'); } } if (!condition) { var error; if (format === undefined) { error = new Error( 'Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.' ); } else { var args = [a, b, c, d, e, f]; var argIndex = 0; error = new Error( 'Invariant Violation: ' + format.replace(/%s/g, function() { return args[argIndex++]; }) ); } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } }; module.exports = invariant; },{}],136:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isEventSupported */ 'use strict'; var ExecutionEnvironment = _dereq_(21); var useHasFeature; if (ExecutionEnvironment.canUseDOM) { useHasFeature = document.implementation && document.implementation.hasFeature && // always returns true in newer browsers as per the standard. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature document.implementation.hasFeature('', '') !== true; } /** * Checks if an event is supported in the current execution environment. * * NOTE: This will not work correctly for non-generic events such as `change`, * `reset`, `load`, `error`, and `select`. * * Borrows from Modernizr. * * @param {string} eventNameSuffix Event name, e.g. "click". * @param {?boolean} capture Check if the capture phase is supported. * @return {boolean} True if the event is supported. * @internal * @license Modernizr 3.0.0pre (Custom Build) | MIT */ function isEventSupported(eventNameSuffix, capture) { if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { return false; } var eventName = 'on' + eventNameSuffix; var isSupported = eventName in document; if (!isSupported) { var element = document.createElement('div'); element.setAttribute(eventName, 'return;'); isSupported = typeof element[eventName] === 'function'; } if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { // This is the only way to test support for the `wheel` event in IE9+. isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); } return isSupported; } module.exports = isEventSupported; },{"21":21}],137:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isNode * @typechecks */ /** * @param {*} object The object to check. * @return {boolean} Whether or not the object is a DOM node. */ function isNode(object) { return !!(object && ( ((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')) )); } module.exports = isNode; },{}],138:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isTextInputElement */ 'use strict'; /** * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary */ var supportedInputTypes = { 'color': true, 'date': true, 'datetime': true, 'datetime-local': true, 'email': true, 'month': true, 'number': true, 'password': true, 'range': true, 'search': true, 'tel': true, 'text': true, 'time': true, 'url': true, 'week': true }; function isTextInputElement(elem) { return elem && ( (elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA') ); } module.exports = isTextInputElement; },{}],139:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isTextNode * @typechecks */ var isNode = _dereq_(137); /** * @param {*} object The object to check. * @return {boolean} Whether or not the object is a DOM text node. */ function isTextNode(object) { return isNode(object) && object.nodeType == 3; } module.exports = isTextNode; },{"137":137}],140:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyMirror * @typechecks static-only */ 'use strict'; var invariant = _dereq_(135); /** * Constructs an enumeration with keys equal to their value. * * For example: * * var COLORS = keyMirror({blue: null, red: null}); * var myColor = COLORS.blue; * var isColorValid = !!COLORS[myColor]; * * The last line could not be performed if the values of the generated enum were * not equal to their keys. * * Input: {key1: val1, key2: val2} * Output: {key1: key1, key2: key2} * * @param {object} obj * @return {object} */ var keyMirror = function(obj) { var ret = {}; var key; ("production" !== "development" ? invariant( obj instanceof Object && !Array.isArray(obj), 'keyMirror(...): Argument must be an object.' ) : invariant(obj instanceof Object && !Array.isArray(obj))); for (key in obj) { if (!obj.hasOwnProperty(key)) { continue; } ret[key] = key; } return ret; }; module.exports = keyMirror; },{"135":135}],141:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyOf */ /** * Allows extraction of a minified key. Let's the build system minify keys * without loosing the ability to dynamically use key strings as values * themselves. Pass in an object with a single key/val pair and it will return * you the string key of that single record. Suppose you want to grab the * value for a key 'className' inside of an object. Key/val minification may * have aliased that key to be 'xa12'. keyOf({className: null}) will return * 'xa12' in that case. Resolve keys you want to use once at startup time, then * reuse those resolutions. */ var keyOf = function(oneKeyObj) { var key; for (key in oneKeyObj) { if (!oneKeyObj.hasOwnProperty(key)) { continue; } return key; } return null; }; module.exports = keyOf; },{}],142:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule mapObject */ 'use strict'; var hasOwnProperty = Object.prototype.hasOwnProperty; /** * Executes the provided `callback` once for each enumerable own property in the * object and constructs a new object from the results. The `callback` is * invoked with three arguments: * * - the property value * - the property name * - the object being traversed * * Properties that are added after the call to `mapObject` will not be visited * by `callback`. If the values of existing properties are changed, the value * passed to `callback` will be the value at the time `mapObject` visits them. * Properties that are deleted before being visited are not visited. * * @grep function objectMap() * @grep function objMap() * * @param {?object} object * @param {function} callback * @param {*} context * @return {?object} */ function mapObject(object, callback, context) { if (!object) { return null; } var result = {}; for (var name in object) { if (hasOwnProperty.call(object, name)) { result[name] = callback.call(context, object[name], name, object); } } return result; } module.exports = mapObject; },{}],143:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule memoizeStringOnly * @typechecks static-only */ 'use strict'; /** * Memoizes the return value of a function that accepts one string argument. * * @param {function} callback * @return {function} */ function memoizeStringOnly(callback) { var cache = {}; return function(string) { if (!cache.hasOwnProperty(string)) { cache[string] = callback.call(this, string); } return cache[string]; }; } module.exports = memoizeStringOnly; },{}],144:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule onlyChild */ 'use strict'; var ReactElement = _dereq_(57); var invariant = _dereq_(135); /** * Returns the first child in a collection of children and verifies that there * is only one child in the collection. The current implementation of this * function assumes that a single child gets passed without a wrapper, but the * purpose of this helper function is to abstract away the particular structure * of children. * * @param {?object} children Child collection structure. * @return {ReactComponent} The first and only `ReactComponent` contained in the * structure. */ function onlyChild(children) { ("production" !== "development" ? invariant( ReactElement.isValidElement(children), 'onlyChild must be passed a children with exactly one child.' ) : invariant(ReactElement.isValidElement(children))); return children; } module.exports = onlyChild; },{"135":135,"57":57}],145:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule performance * @typechecks */ "use strict"; var ExecutionEnvironment = _dereq_(21); var performance; if (ExecutionEnvironment.canUseDOM) { performance = window.performance || window.msPerformance || window.webkitPerformance; } module.exports = performance || {}; },{"21":21}],146:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule performanceNow * @typechecks */ var performance = _dereq_(145); /** * Detect if we can use `window.performance.now()` and gracefully fallback to * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now * because of Facebook's testing infrastructure. */ if (!performance || !performance.now) { performance = Date; } var performanceNow = performance.now.bind(performance); module.exports = performanceNow; },{"145":145}],147:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule quoteAttributeValueForBrowser */ 'use strict'; var escapeTextContentForBrowser = _dereq_(116); /** * Escapes attribute value to prevent scripting attacks. * * @param {*} value Value to escape. * @return {string} An escaped string. */ function quoteAttributeValueForBrowser(value) { return '"' + escapeTextContentForBrowser(value) + '"'; } module.exports = quoteAttributeValueForBrowser; },{"116":116}],148:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule setInnerHTML */ /* globals MSApp */ 'use strict'; var ExecutionEnvironment = _dereq_(21); var WHITESPACE_TEST = /^[ \r\n\t\f]/; var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; /** * Set the innerHTML property of a node, ensuring that whitespace is preserved * even in IE8. * * @param {DOMElement} node * @param {string} html * @internal */ var setInnerHTML = function(node, html) { node.innerHTML = html; }; // Win8 apps: Allow all html to be inserted if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { setInnerHTML = function(node, html) { MSApp.execUnsafeLocalFunction(function() { node.innerHTML = html; }); }; } if (ExecutionEnvironment.canUseDOM) { // IE8: When updating a just created node with innerHTML only leading // whitespace is removed. When updating an existing node with innerHTML // whitespace in root TextNodes is also collapsed. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html // Feature detection; only IE8 is known to behave improperly like this. var testElement = document.createElement('div'); testElement.innerHTML = ' '; if (testElement.innerHTML === '') { setInnerHTML = function(node, html) { // Magic theory: IE8 supposedly differentiates between added and updated // nodes when processing innerHTML, innerHTML on updated nodes suffers // from worse whitespace behavior. Re-adding a node like this triggers // the initial and more favorable whitespace behavior. // TODO: What to do on a detached node? if (node.parentNode) { node.parentNode.replaceChild(node, node); } // We also implement a workaround for non-visible tags disappearing into // thin air on IE8, this only happens if there is no visible text // in-front of the non-visible tags. Piggyback on the whitespace fix // and simply check if any non-visible tags appear in the source. if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) { // Recover leading whitespace by temporarily prepending any character. // \uFEFF has the potential advantage of being zero-width/invisible. node.innerHTML = '\uFEFF' + html; // deleteData leaves an empty `TextNode` which offsets the index of all // children. Definitely want to avoid this. var textNode = node.firstChild; if (textNode.data.length === 1) { node.removeChild(textNode); } else { textNode.deleteData(0, 1); } } else { node.innerHTML = html; } }; } } module.exports = setInnerHTML; },{"21":21}],149:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule setTextContent */ 'use strict'; var ExecutionEnvironment = _dereq_(21); var escapeTextContentForBrowser = _dereq_(116); var setInnerHTML = _dereq_(148); /** * Set the textContent property of a node, ensuring that whitespace is preserved * even in IE8. innerText is a poor substitute for textContent and, among many * issues, inserts <br> instead of the literal newline chars. innerHTML behaves * as it should. * * @param {DOMElement} node * @param {string} text * @internal */ var setTextContent = function(node, text) { node.textContent = text; }; if (ExecutionEnvironment.canUseDOM) { if (!('textContent' in document.documentElement)) { setTextContent = function(node, text) { setInnerHTML(node, escapeTextContentForBrowser(text)); }; } } module.exports = setTextContent; },{"116":116,"148":148,"21":21}],150:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule shallowEqual */ 'use strict'; /** * Performs equality by iterating through keys on an object and returning * false when any key has values which are not strictly equal between * objA and objB. Returns true when the values of all keys are strictly equal. * * @return {boolean} */ function shallowEqual(objA, objB) { if (objA === objB) { return true; } var key; // Test for A's keys different from B. for (key in objA) { if (objA.hasOwnProperty(key) && (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) { return false; } } // Test for B's keys missing from A. for (key in objB) { if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) { return false; } } return true; } module.exports = shallowEqual; },{}],151:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule shouldUpdateReactComponent * @typechecks static-only */ 'use strict'; var warning = _dereq_(154); /** * Given a `prevElement` and `nextElement`, determines if the existing * instance should be updated as opposed to being destroyed or replaced by a new * instance. Both arguments are elements. This ensures that this logic can * operate on stateless trees without any backing instance. * * @param {?object} prevElement * @param {?object} nextElement * @return {boolean} True if the existing instance should be updated. * @protected */ function shouldUpdateReactComponent(prevElement, nextElement) { if (prevElement != null && nextElement != null) { var prevType = typeof prevElement; var nextType = typeof nextElement; if (prevType === 'string' || prevType === 'number') { return (nextType === 'string' || nextType === 'number'); } else { if (nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key) { var ownersMatch = prevElement._owner === nextElement._owner; var prevName = null; var nextName = null; var nextDisplayName = null; if ("production" !== "development") { if (!ownersMatch) { if (prevElement._owner != null && prevElement._owner.getPublicInstance() != null && prevElement._owner.getPublicInstance().constructor != null) { prevName = prevElement._owner.getPublicInstance().constructor.displayName; } if (nextElement._owner != null && nextElement._owner.getPublicInstance() != null && nextElement._owner.getPublicInstance().constructor != null) { nextName = nextElement._owner.getPublicInstance().constructor.displayName; } if (nextElement.type != null && nextElement.type.displayName != null) { nextDisplayName = nextElement.type.displayName; } if (nextElement.type != null && typeof nextElement.type === 'string') { nextDisplayName = nextElement.type; } if (typeof nextElement.type !== 'string' || nextElement.type === 'input' || nextElement.type === 'textarea') { if ((prevElement._owner != null && prevElement._owner._isOwnerNecessary === false) || (nextElement._owner != null && nextElement._owner._isOwnerNecessary === false)) { if (prevElement._owner != null) { prevElement._owner._isOwnerNecessary = true; } if (nextElement._owner != null) { nextElement._owner._isOwnerNecessary = true; } ("production" !== "development" ? warning( false, '<%s /> is being rendered by both %s and %s using the same ' + 'key (%s) in the same place. Currently, this means that ' + 'they don\'t preserve state. This behavior should be very ' + 'rare so we\'re considering deprecating it. Please contact ' + 'the React team and explain your use case so that we can ' + 'take that into consideration.', nextDisplayName || 'Unknown Component', prevName || '[Unknown]', nextName || '[Unknown]', prevElement.key ) : null); } } } } return ownersMatch; } } } return false; } module.exports = shouldUpdateReactComponent; },{"154":154}],152:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule toArray * @typechecks */ var invariant = _dereq_(135); /** * Convert array-like objects to arrays. * * This API assumes the caller knows the contents of the data type. For less * well defined inputs use createArrayFromMixed. * * @param {object|function|filelist} obj * @return {array} */ function toArray(obj) { var length = obj.length; // Some browse builtin objects can report typeof 'function' (e.g. NodeList in // old versions of Safari). ("production" !== "development" ? invariant( !Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function'), 'toArray: Array-like object expected' ) : invariant(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function'))); ("production" !== "development" ? invariant( typeof length === 'number', 'toArray: Object needs a length property' ) : invariant(typeof length === 'number')); ("production" !== "development" ? invariant( length === 0 || (length - 1) in obj, 'toArray: Object should have keys for indices' ) : invariant(length === 0 || (length - 1) in obj)); // Old IE doesn't give collections access to hasOwnProperty. Assume inputs // without method will throw during the slice call and skip straight to the // fallback. if (obj.hasOwnProperty) { try { return Array.prototype.slice.call(obj); } catch (e) { // IE < 9 does not support Array#slice on collections objects } } // Fall back to copying key by key. This assumes all keys have a value, // so will not preserve sparsely populated inputs. var ret = Array(length); for (var ii = 0; ii < length; ii++) { ret[ii] = obj[ii]; } return ret; } module.exports = toArray; },{"135":135}],153:[function(_dereq_,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule traverseAllChildren */ 'use strict'; var ReactElement = _dereq_(57); var ReactFragment = _dereq_(63); var ReactInstanceHandles = _dereq_(66); var getIteratorFn = _dereq_(126); var invariant = _dereq_(135); var warning = _dereq_(154); var SEPARATOR = ReactInstanceHandles.SEPARATOR; var SUBSEPARATOR = ':'; /** * TODO: Test that a single child and an array with one item have the same key * pattern. */ var userProvidedKeyEscaperLookup = { '=': '=0', '.': '=1', ':': '=2' }; var userProvidedKeyEscapeRegex = /[=.:]/g; var didWarnAboutMaps = false; function userProvidedKeyEscaper(match) { return userProvidedKeyEscaperLookup[match]; } /** * Generate a key string that identifies a component within a set. * * @param {*} component A component that could contain a manual key. * @param {number} index Index that is used if a manual key is not provided. * @return {string} */ function getComponentKey(component, index) { if (component && component.key != null) { // Explicit key return wrapUserProvidedKey(component.key); } // Implicit key determined by the index in the set return index.toString(36); } /** * Escape a component key so that it is safe to use in a reactid. * * @param {*} key Component key to be escaped. * @return {string} An escaped string. */ function escapeUserProvidedKey(text) { return ('' + text).replace( userProvidedKeyEscapeRegex, userProvidedKeyEscaper ); } /** * Wrap a `key` value explicitly provided by the user to distinguish it from * implicitly-generated keys generated by a component's index in its parent. * * @param {string} key Value of a user-provided `key` attribute * @return {string} */ function wrapUserProvidedKey(key) { return '$' + escapeUserProvidedKey(key); } /** * @param {?*} children Children tree container. * @param {!string} nameSoFar Name of the key path so far. * @param {!number} indexSoFar Number of children encountered until this point. * @param {!function} callback Callback to invoke with each child found. * @param {?*} traverseContext Used to pass information throughout the traversal * process. * @return {!number} The number of children in this subtree. */ function traverseAllChildrenImpl( children, nameSoFar, indexSoFar, callback, traverseContext ) { var type = typeof children; if (type === 'undefined' || type === 'boolean') { // All of the above are perceived as null. children = null; } if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) { callback( traverseContext, children, // If it's the only child, treat the name as if it was wrapped in an array // so that it's consistent if the number of children grows. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar, indexSoFar ); return 1; } var child, nextName, nextIndex; var subtreeCount = 0; // Count of children found in the current subtree. if (Array.isArray(children)) { for (var i = 0; i < children.length; i++) { child = children[i]; nextName = ( (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) + getComponentKey(child, i) ); nextIndex = indexSoFar + subtreeCount; subtreeCount += traverseAllChildrenImpl( child, nextName, nextIndex, callback, traverseContext ); } } else { var iteratorFn = getIteratorFn(children); if (iteratorFn) { var iterator = iteratorFn.call(children); var step; if (iteratorFn !== children.entries) { var ii = 0; while (!(step = iterator.next()).done) { child = step.value; nextName = ( (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) + getComponentKey(child, ii++) ); nextIndex = indexSoFar + subtreeCount; subtreeCount += traverseAllChildrenImpl( child, nextName, nextIndex, callback, traverseContext ); } } else { if ("production" !== "development") { ("production" !== "development" ? warning( didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.' ) : null); didWarnAboutMaps = true; } // Iterator will provide entry [k,v] tuples rather than values. while (!(step = iterator.next()).done) { var entry = step.value; if (entry) { child = entry[1]; nextName = ( (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0) ); nextIndex = indexSoFar + subtreeCount; subtreeCount += traverseAllChildrenImpl( child, nextName, nextIndex, callback, traverseContext ); } } } } else if (type === 'object') { ("production" !== "development" ? invariant( children.nodeType !== 1, 'traverseAllChildren(...): Encountered an invalid child; DOM ' + 'elements are not valid children of React components.' ) : invariant(children.nodeType !== 1)); var fragment = ReactFragment.extract(children); for (var key in fragment) { if (fragment.hasOwnProperty(key)) { child = fragment[key]; nextName = ( (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) + wrapUserProvidedKey(key) + SUBSEPARATOR + getComponentKey(child, 0) ); nextIndex = indexSoFar + subtreeCount; subtreeCount += traverseAllChildrenImpl( child, nextName, nextIndex, callback, traverseContext ); } } } } return subtreeCount; } /** * Traverses children that are typically specified as `props.children`, but * might also be specified through attributes: * * - `traverseAllChildren(this.props.children, ...)` * - `traverseAllChildren(this.props.leftPanelChildren, ...)` * * The `traverseContext` is an optional argument that is passed through the * entire traversal. It can be used to store accumulations or anything else that * the callback might find relevant. * * @param {?*} children Children tree object. * @param {!function} callback To invoke upon traversing each child. * @param {?*} traverseContext Context for traversal. * @return {!number} The number of children in this subtree. */ function traverseAllChildren(children, callback, traverseContext) { if (children == null) { return 0; } return traverseAllChildrenImpl(children, '', 0, callback, traverseContext); } module.exports = traverseAllChildren; },{"126":126,"135":135,"154":154,"57":57,"63":63,"66":66}],154:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule warning */ "use strict"; var emptyFunction = _dereq_(114); /** * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths. */ var warning = emptyFunction; if ("production" !== "development") { warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]); if (format === undefined) { throw new Error( '`warning(condition, format, ...args)` requires a warning ' + 'message argument' ); } if (format.length < 10 || /^[s\W]*$/.test(format)) { throw new Error( 'The warning format should be able to uniquely identify this ' + 'warning. Please, use a more descriptive format than: ' + format ); } if (format.indexOf('Failed Composite propType: ') === 0) { return; // Ignore CompositeComponent proptype check. } if (!condition) { var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];}); console.warn(message); try { // --- Welcome to debugging React --- // This error was thrown as a convenience so that you can use this stack // to find the callsite that caused this warning to fire. throw new Error(message); } catch(x) {} } }; } module.exports = warning; },{"114":114}]},{},[1])(1) });
adrianton3/brainfuckgolf
lib/react/react.js
JavaScript
mit
600,572
"use strict"; /** * @fileOverview * EC Diffie-Hellman operations on Curve25519. */ /* * Copyright (c) 2014 Mega Limited * under the MIT License. * * Authors: Guy K. Kloss * * You should have received a copy of the license along with this program. */ var core = require('./core'); var utils = require('./utils'); var curve255 = require('./curve255'); /** * @exports jodid25519/dh * EC Diffie-Hellman operations on Curve25519. * * @description * EC Diffie-Hellman operations on Curve25519. */ var ns = {}; function _toString(vector) { var u = new Uint16Array(vector); return (new Buffer(new Uint8Array(u.buffer))); } function _fromString(vector) { if (Buffer.isBuffer(vector)) { var u = new Uint8Array(vector); return (new Uint16Array(u.buffer)); } var result = new Array(16); for (var i = 0, l = 0; i < vector.length; i += 2) { result[l] = (vector.charCodeAt(i + 1) << 8) | vector.charCodeAt(i); l++; } return result; } /** * Computes a key through scalar multiplication of a point on the curve 25519. * * This function is used for the DH key-exchange protocol. It computes a * key based on a secret key with a public component (opponent's public key * or curve base point if not given) by using scalar multiplication. * * Before multiplication, some bit operations are applied to the * private key to ensure it is a valid Curve25519 secret key. * It is the user's responsibility to make sure that the private * key is a uniformly random, secret value. * * @function * @param privateComponent {string} * Private point as byte string on the curve. * @param publicComponent {string} * Public point as byte string on the curve. If not given, the curve's * base point is used. * @returns {string} * Key point as byte string resulting from scalar product. */ ns.computeKey = function(privateComponent, publicComponent) { if (publicComponent) { return _toString(curve255.curve25519(_fromString(privateComponent), _fromString(publicComponent))); } else { return _toString(curve255.curve25519(_fromString(privateComponent))); } }; /** * Computes the public key to a private key on the curve 25519. * * Before multiplication, some bit operations are applied to the * private key to ensure it is a valid Curve25519 secret key. * It is the user's responsibility to make sure that the private * key is a uniformly random, secret value. * * @function * @param privateKey {string} * Private point as byte string on the curve. * @returns {string} * Public key point as byte string resulting from scalar product. */ ns.publicKey = function(privateKey) { return _toString(curve255.curve25519(_fromString(privateKey))); }; /** * Generates a new random private key of 32 bytes length (256 bit). * * @function * @returns {string} * Byte string containing a new random private key seed. */ ns.generateKey = function() { return core.generateKey(true); }; module.exports = ns;
mcramer03/name_test
node_modules/grunt-bower-concat/node_modules/bower/lib/node_modules/jodid25519/lib/dh.js
JavaScript
mit
3,415
/** * Georgian translation for bootstrap-datepicker * Levan Melikishvili <levani0101@yahoo.com> */ ;(function($){ $.fn.datepicker.dates['ka'] = { days: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი", "კვირა"], daysShort: ["კვი", "ორშ", "სამ", "ოთხ", "ხუთ", "პარ", "შაბ", "კვი"], daysMin: ["კვ", "ორ", "სა", "ოთ", "ხუ", "პა", "შა", "კვ"], months: ["იანვარი", "თებერვალი", "მარტი", "აპრილი", "მაისი", "ივნისი", "ივლისი", "აგვისტო", "სექტემბერი", "ოქტომები", "ნოემბერი", "დეკემბერი"], monthsShort: ["იან", "თებ", "მარ", "აპრ", "მაი", "ივნ", "ივლ", "აგვ", "სექ", "ოქტ", "ნოე", "დეკ"], today: "დღეს", clear: "გასუფთავება", weekStart: 1, format: "dd.mm.yyyy" }; }(jQuery));
anshulverma/cdnjs
ajax/libs/bootstrap-datepicker/1.3.0-rc.4/js/locales/bootstrap-datepicker.ka.js
JavaScript
mit
1,261
var liquidmetal = require('liquidmetal'); onmessage = function(e) { var start = new Date().getTime(), query = e.data.query, index = e.data.index, term = query.replace(/\//g, ' ').toUpperCase().trim(), ranked = index.map(function(endpoint) { try { var i = endpoint.description.indexOf(" ", 16), source = endpoint.search_source || [endpoint.path_labeled.replace(/\//g, ' '), endpoint.group, endpoint.description.substring(0,i)].join(' ').toUpperCase().trim(), score = liquidmetal.score(source, term); endpoint.search_source = source; return [score, source, endpoint]; } catch (error) { if (console && console.warn) { console.warn("Failed to score endpoint", endpoint, error.message); } return [0, '', endpoint]; } }).filter(function(score){ return score[0] > 0; }).sort(function(a, b) { if (a[0] == b[0]) return 0; if (a[0] > b[0]) return -1; return 1; }), results = ranked.map(function(e){ return e[2]; }), end = new Date().getTime(); postMessage({query: query, results: results, ms: end-start}); };
Charlestownz40h/Silverdale
lib/search.js
JavaScript
mit
1,229
!function(e){return"object"==typeof exports&&"object"==typeof module?e(require("../lib/infer"),require("../lib/tern"),require("acorn/dist/walk"),require("./modules")):"function"==typeof define&&define.amd?define(["../lib/infer","../lib/tern","acorn/dist/walk","./modules"],e):void e(tern,tern,acorn.walk)}(function(e,r,o){"use strict";function t(r,t){function a(o,a,i){l||(l=new e.Obj(!0),l.origin=r.name,l.originNode=r.ast,t.addType(l));var o=l.defProp(o,i);o.origin=r.name,a.propagate(o)}var i=e.cx().parent.mod.modules,l=null;o.simple(r.ast,{ImportDeclaration:function(e){for(var o=i.resolveModule(e.source.value,r.name),t=0;t<e.specifiers.length;t++){var a=e.specifiers[t],l=r.scope.getProp(a.local.name);"ImportNamespaceSpecifier"==a.type?o.propagate(l):"ImportDefaultSpecifier"==a.type?(o.getProp("default").propagate(l),o.propagate(l,n)):o.getProp(a.imported.name).propagate(l)}},ExportAllDeclaration:function(e){var o=i.resolveModule(e.source.value,r.name);o.forAllProps(function(e,r,o){o&&a(e,r,r.originNode)})},ExportDefaultDeclaration:function(o){var t=o.declaration.id||o.declaration;a("default",e.expressionType({node:t,state:r.scope}),t)},ExportNamedDeclaration:function(e){var o=e.declaration;if(o)if("VariableDeclaration"==o.type)for(var t=0;t<o.declarations.length;++t){var n=o.declarations[t];"Identifier"==n.id.type&&a(n.id.name,r.scope.getProp(n.id.name),n.id)}else a(o.id.name,r.scope.getProp(o.id.name),o.id);if(e.specifiers.length)for(var l=e.source?i.resolveModule(e.source.value,r.name):r.scope,t=0;t<e.specifiers.length;t++){var p=e.specifiers[t];a(p.exported.name,l.getProp(p.local.name),p.local)}}})}function a(r){if("Literal"==r.type&&"string"==typeof r.value){var o=e.findExpressionAround(r.sourceFile.ast,null,r.end,null,function(e,r){return"ImportDeclaration"==r.type||/Export(All|Named)Declaration/.test(r.type)});if(o&&o.node.source==r)return r.value}}function i(r,o){if("Identifier"==r.type){var t=e.findExpressionAround(r.sourceFile.ast,null,r.end,null,"ImportDeclaration");if(!t)return;for(var a=t.node.specifiers,i=0;i<a.length;i++){var n=a[i];if(n.local==r){var l={name:t.node.source.value,prop:null};return"ImportDefaultSpecifier"==n.type?l.prop="default":"ImportSpecifier"==n.type&&(l.prop=n.imported.name),l}}}else if("ImportDeclaration"==r.type&&/^import\s+\{\s*([\w$]+\s*,\s*)*$/.test(r.sourceFile.text.slice(r.start,o)))return{name:r.source.value,prop:""}}var n=80;r.registerPlugin("es_modules",function(e){e.loadPlugin("modules"),e.mod.modules.on("getExports",t),e.mod.modules.modNameTests.push(a),e.mod.modules.importTests.push(i),e.mod.modules.completableTypes.Identifier=!0,e.mod.modules.completableTypes.Literal=!0,e.mod.modules.completableTypes.ImportDeclaration=!0})}); //# sourceMappingURL=es_modules.min.js.map
hare1039/cdnjs
ajax/libs/tern/0.21.0/plugin/es_modules.min.js
JavaScript
mit
2,764
YUI.add("widget-buttons",function(c){var i=c.Array,k=c.Lang,f=c.Object,a=c.Plugin.Button,j=c.Widget,n=c.WidgetStdMod,d=c.ClassNameManager.getClassName,e=k.isArray,m=k.isNumber,b=k.isString,h=k.isValue;function l(o){return !!o.getDOMNode;}function g(){if(!this._stdModNode){c.error("WidgetStdMod must be added to a Widget before WidgetButtons.");}this._buttonsHandles={};}g.ATTRS={buttons:{getter:"_getButtons",setter:"_setButtons",value:{}},defaultButton:{readOnly:true,value:null}};g.CLASS_NAMES={button:d("button"),buttons:j.getClassName("buttons"),primary:d("button","primary")};g.HTML_PARSER={buttons:function(o){return this._parseButtons(o);}};g.NON_BUTTON_NODE_CFG=["action","classNames","context","events","isDefault","section"];g.prototype={BUTTONS:{},BUTTONS_TEMPLATE:"<span />",DEFAULT_BUTTONS_SECTION:n.FOOTER,initializer:function(){this._mapButtons(this.get("buttons"));this._updateDefaultButton();this.after("buttonsChange",c.bind("_afterButtonsChange",this));c.after(this._bindUIButtons,this,"bindUI");c.after(this._syncUIButtons,this,"syncUI");},destructor:function(){f.each(this._buttonsHandles,function(o){o.detach();});delete this._buttonsHandles;delete this._buttonsMap;delete this._defaultButton;},addButton:function(q,t,o){var s=this.get("buttons"),r,p;if(!l(q)){q=this._mergeButtonConfig(q);t||(t=q.section);}t||(t=this.DEFAULT_BUTTONS_SECTION);r=s[t]||(s[t]=[]);m(o)||(o=r.length);r.splice(o,0,q);p=i.indexOf(r,q);this.set("buttons",s,{button:q,section:t,index:p,src:"add"});return this;},getButton:function(o,r){if(!h(o)){return;}var q=this._buttonsMap,p;r||(r=this.DEFAULT_BUTTONS_SECTION);if(m(o)){p=this.get("buttons");return p[r]&&p[r][o];}return arguments.length>1?q[r+":"+o]:q[o];},removeButton:function(p,r){if(!h(p)){return this;}var q=this.get("buttons"),o;if(m(p)){r||(r=this.DEFAULT_BUTTONS_SECTION);o=p;p=q[r][o];}else{if(b(p)){p=this.getButton.apply(this,arguments);}f.some(q,function(s,t){o=i.indexOf(s,p);if(o>-1){r=t;return true;}});}if(p&&o>-1){q[r].splice(o,1);this.set("buttons",q,{button:p,section:r,index:o,src:"remove"});}return this;},_bindUIButtons:function(){var o=c.bind("_afterContentChangeButtons",this);this.after({defaultButtonChange:c.bind("_afterDefaultButtonChange",this),visibleChange:c.bind("_afterVisibleChangeButtons",this),headerContentChange:o,bodyContentChange:o,footerContentChange:o});},_createButton:function(t){var q,p,w,s,v,r,o,u;if(l(t)){return c.one(t.getDOMNode()).plug(a);}q=c.merge({context:this,events:"click",label:t.value},t);p=c.merge(q);w=g.NON_BUTTON_NODE_CFG;for(s=0,v=w.length;s<v;s+=1){delete p[w[s]];}t=a.createNode(p);o=q.context;r=q.action;if(b(r)){r=c.bind(r,o);}u=t.on(q.events,r,o);this._buttonsHandles[c.stamp(t,true)]=u;t.setData("name",this._getButtonName(q));t.setData("default",this._getButtonDefault(q));i.each(i(q.classNames),t.addClass,t);return t;},_getButtonContainer:function(t,r){var u=n.SECTION_CLASS_NAMES[t],s=g.CLASS_NAMES.buttons,q=this.get("contentBox"),o,p;o="."+u+" ."+s;p=q.one(o);if(!p&&r){p=c.Node.create(this.BUTTONS_TEMPLATE);p.addClass(s);}return p;},_getButtonDefault:function(o){var p=l(o)?o.getData("default"):o.isDefault;if(b(p)){return p.toLowerCase()==="true";}return !!p;},_getButtonName:function(p){var o;if(l(p)){o=p.getData("name")||p.get("name");}else{o=p&&(p.name||p.type);}return o;},_getButtons:function(p){var o={};f.each(p,function(q,r){o[r]=q.concat();});return o;},_mapButton:function(p,s){var r=this._buttonsMap,o=this._getButtonName(p),q=this._getButtonDefault(p);if(o){r[o]=p;r[s+":"+o]=p;}q&&(this._defaultButton=p);},_mapButtons:function(o){this._buttonsMap={};this._defaultButton=null;f.each(o,function(r,s){var q,p;for(q=0,p=r.length;q<p;q+=1){this._mapButton(r[q],s);}},this);},_mergeButtonConfig:function(r){var o,u,q,t,s,p;r=b(r)?{name:r}:c.merge(r);if(r.srcNode){t=r.srcNode;s=t.get("tagName").toLowerCase();p=t.get(s==="input"?"value":"text");o={disabled:!!t.get("disabled"),isDefault:this._getButtonDefault(t),name:this._getButtonName(t)};p&&(o.label=p);c.mix(r,o,false,null,0,true);}q=this._getButtonName(r);u=this.BUTTONS&&this.BUTTONS[q];if(u){c.mix(r,u,false,null,0,true);}return r;},_parseButtons:function(q){var o="."+g.CLASS_NAMES.button,r=["header","body","footer"],p=null;i.each(r,function(v){var s=this._getButtonContainer(v),u=s&&s.all(o),t;if(!u||u.isEmpty()){return;}t=[];u.each(function(w){t.push({srcNode:w});});p||(p={});p[v]=t;},this);return p;},_setButtons:function(q){var p=this.DEFAULT_BUTTONS_SECTION,r={};function o(v,x){if(!e(v)){return;}var u,s,t,w;for(u=0,s=v.length;u<s;u+=1){t=v[u];w=x;if(!l(t)){t=this._mergeButtonConfig(t);w||(w=t.section);}t=this._createButton(t);w||(w=p);(r[w]||(r[w]=[])).push(t);}}if(e(q)){o.call(this,q);}else{f.each(q,o,this);}return r;},_syncUIButtons:function(){this._uiSetButtons(this.get("buttons"));this._uiSetDefaultButton(this.get("defaultButton"));this._uiSetVisibleButtons(this.get("visible"));},_uiInsertButton:function(q,t,p){var s=g.CLASS_NAMES.button,o=this._getButtonContainer(t,true),r=o.all("."+s);o.insertBefore(q,r.item(p));this.setStdModContent(t,o,"after");},_uiRemoveButton:function(s,v,p){var r=c.stamp(s,this),q=this._buttonsHandles,u=q[r],o,t;u&&u.detach();delete q[r];s.remove();p||(p={});if(!p.preserveContent){o=this._getButtonContainer(v);t=g.CLASS_NAMES.button;if(o&&o.all("."+t).isEmpty()){o.remove();this._updateContentButtons(v);}}},_uiSetButtons:function(o){var p=g.CLASS_NAMES.button,q=["header","body","footer"];i.each(q,function(y){var w=o[y]||[],t=w.length,z=this._getButtonContainer(y,t),x=false,s,u,v,r;if(!z){return;}s=z.all("."+p);for(u=0;u<t;u+=1){v=w[u];r=s?s.indexOf(v):-1;if(r>-1){s.splice(r,1);if(r!==u){z.insertBefore(v,u+1);x=true;}}else{z.appendChild(v);x=true;}}s.each(function(A){this._uiRemoveButton(A,y,{preserveContent:true});x=true;},this);if(t===0){z.remove();this._updateContentButtons(y);return;}if(x){this.setStdModContent(y,z,"after");}},this);},_uiSetDefaultButton:function(q,p){var o=g.CLASS_NAMES.primary;q&&q.addClass(o);p&&p.removeClass(o); },_uiSetVisibleButtons:function(p){if(!p){return;}var o=this.get("defaultButton");if(o){o.focus();}},_unMapButton:function(q,s){var r=this._buttonsMap,p=this._getButtonName(q),o;if(p){if(r[p]===q){delete r[p];}o=s+":"+p;if(r[o]===q){delete r[o];}}if(this._defaultButton===q){this._defaultButton=null;}},_updateDefaultButton:function(){var o=this._defaultButton;if(this.get("defaultButton")!==o){this._set("defaultButton",o);}},_updateContentButtons:function(p){var o=this.getStdModNode(p).get("childNodes");this.set(p+"Content",o.isEmpty()?null:o,{src:"buttons"});},_afterButtonsChange:function(s){var q=s.newVal,r=s.section,o=s.index,t=s.src,p;if(t==="add"){p=q[r][o];this._mapButton(p,r);this._updateDefaultButton();this._uiInsertButton(p,r,o);return;}if(t==="remove"){p=s.button;this._unMapButton(p,r);this._updateDefaultButton();this._uiRemoveButton(p,r);return;}this._mapButtons(q);this._updateDefaultButton();this._uiSetButtons(q);},_afterContentChangeButtons:function(p){var q=p.src,r=p.stdModPosition,o=!r||r===n.REPLACE;if(o&&q!=="buttons"&&q!==j.UI_SRC){this._uiSetButtons(this.get("buttons"));}},_afterDefaultButtonChange:function(o){this._uiSetDefaultButton(o.newVal,o.prevVal);},_afterVisibleChangeButtons:function(o){this._uiSetVisibleButtons(o.newVal);}};c.WidgetButtons=g;},"@VERSION@",{requires:["button-plugin","cssbutton","widget-stdmod"]});
IonicaBizauKitchen/cdnjs
ajax/libs/yui/3.6.0/widget-buttons/widget-buttons-min.js
JavaScript
mit
7,364
var Utils = require("../util"), Constants = Utils.Constants; /* The central directory file header */ module.exports = function () { var _verMade = 0x0A, _version = 0x0A, _flags = 0, _method = 0, _time = 0, _crc = 0, _compressedSize = 0, _size = 0, _fnameLen = 0, _extraLen = 0, _comLen = 0, _diskStart = 0, _inattr = 0, _attr = 0, _offset = 0; var _dataHeader = {}; function setTime(val) { var val = new Date(val); _time = (val.getFullYear() - 1980 & 0x7f) << 25 // b09-16 years from 1980 | (val.getMonth() + 1) << 21 // b05-08 month | val.getDay() << 16 // b00-04 hour // 2 bytes time | val.getHours() << 11 // b11-15 hour | val.getMinutes() << 5 // b05-10 minute | val.getSeconds() >> 1; // b00-04 seconds divided by 2 } setTime(+new Date()); return { get made () { return _verMade; }, set made (val) { _verMade = val; }, get version () { return _version; }, set version (val) { _version = val }, get flags () { return _flags }, set flags (val) { _flags = val; }, get method () { return _method; }, set method (val) { _method = val; }, get time () { return new Date( ((_time >> 25) & 0x7f) + 1980, ((_time >> 21) & 0x0f) - 1, (_time >> 16) & 0x1f, (_time >> 11) & 0x1f, (_time >> 5) & 0x3f, (_time & 0x1f) << 1 ); }, set time (val) { setTime(val); }, get crc () { return _crc; }, set crc (val) { _crc = val; }, get compressedSize () { return _compressedSize; }, set compressedSize (val) { _compressedSize = val; }, get size () { return _size; }, set size (val) { _size = val; }, get fileNameLength () { return _fnameLen; }, set fileNameLength (val) { _fnameLen = val; }, get extraLength () { return _extraLen }, set extraLength (val) { _extraLen = val; }, get commentLength () { return _comLen }, set commentLength (val) { _comLen = val }, get diskNumStart () { return _diskStart }, set diskNumStart (val) { _diskStart = val }, get inAttr () { return _inattr }, set inAttr (val) { _inattr = val }, get attr () { return _attr }, set attr (val) { _attr = val }, get offset () { return _offset }, set offset (val) { _offset = val }, get encripted () { return (_flags & 1) == 1 }, get entryHeaderSize () { return Constants.CENHDR + _fnameLen + _extraLen + _comLen; }, get realDataOffset () { return _offset + Constants.LOCHDR + _dataHeader.fnameLen + _dataHeader.extraLen; }, get dataHeader () { return _dataHeader; }, loadDataHeaderFromBinary : function(/*Buffer*/input) { var data = input.slice(_offset, _offset + Constants.LOCHDR); // 30 bytes and should start with "PK\003\004" if (data.readUInt32LE(0) != Constants.LOCSIG) { throw Utils.Errors.INVALID_LOC; } _dataHeader = { // version needed to extract version : data.readUInt16LE(Constants.LOCVER), // general purpose bit flag flags : data.readUInt16LE(Constants.LOCFLG), // compression method method : data.readUInt16LE(Constants.LOCHOW), // modification time (2 bytes time, 2 bytes date) time : data.readUInt32LE(Constants.LOCTIM), // uncompressed file crc-32 value crc : data.readUInt32LE(Constants.LOCCRC), // compressed size compressedSize : data.readUInt32LE(Constants.LOCSIZ), // uncompressed size size : data.readUInt32LE(Constants.LOCLEN), // filename length fnameLen : data.readUInt16LE(Constants.LOCNAM), // extra field length extraLen : data.readUInt16LE(Constants.LOCEXT) } }, loadFromBinary : function(/*Buffer*/data) { // data should be 46 bytes and start with "PK 01 02" if (data.length != Constants.CENHDR || data.readUInt32LE(0) != Constants.CENSIG) { throw Utils.Errors.INVALID_CEN; } // version made by _verMade = data.readUInt16LE(Constants.CENVEM); // version needed to extract _version = data.readUInt16LE(Constants.CENVER); // encrypt, decrypt flags _flags = data.readUInt16LE(Constants.CENFLG); // compression method _method = data.readUInt16LE(Constants.CENHOW); // modification time (2 bytes time, 2 bytes date) _time = data.readUInt32LE(Constants.CENTIM); // uncompressed file crc-32 value _crc = data.readUInt32LE(Constants.CENCRC); // compressed size _compressedSize = data.readUInt32LE(Constants.CENSIZ); // uncompressed size _size = data.readUInt32LE(Constants.CENLEN); // filename length _fnameLen = data.readUInt16LE(Constants.CENNAM); // extra field length _extraLen = data.readUInt16LE(Constants.CENEXT); // file comment length _comLen = data.readUInt16LE(Constants.CENCOM); // volume number start _diskStart = data.readUInt16LE(Constants.CENDSK); // internal file attributes _inattr = data.readUInt16LE(Constants.CENATT); // external file attributes _attr = data.readUInt32LE(Constants.CENATX); // LOC header offset _offset = data.readUInt32LE(Constants.CENOFF); }, dataHeaderToBinary : function() { // LOC header size (30 bytes) var data = new Buffer(Constants.LOCHDR); // "PK\003\004" data.writeUInt32LE(Constants.LOCSIG, 0); // version needed to extract data.writeUInt16LE(_version, Constants.LOCVER); // general purpose bit flag data.writeUInt16LE(_flags, Constants.LOCFLG); // compression method data.writeUInt16LE(_method, Constants.LOCHOW); // modification time (2 bytes time, 2 bytes date) data.writeUInt32LE(_time, Constants.LOCTIM); // uncompressed file crc-32 value data.writeUInt32LE(_crc, Constants.LOCCRC); // compressed size data.writeUInt32LE(_compressedSize, Constants.LOCSIZ); // uncompressed size data.writeUInt32LE(_size, Constants.LOCLEN); // filename length data.writeUInt16LE(_fnameLen, Constants.LOCNAM); // extra field length data.writeUInt16LE(_extraLen, Constants.LOCEXT); return data; }, entryHeaderToBinary : function() { // CEN header size (46 bytes) var data = new Buffer(Constants.CENHDR + _fnameLen + _extraLen + _comLen); // "PK\001\002" data.writeUInt32LE(Constants.CENSIG, 0); // version made by data.writeUInt16LE(_verMade, Constants.CENVEM); // version needed to extract data.writeUInt16LE(_version, Constants.CENVER); // encrypt, decrypt flags data.writeUInt16LE(_flags, Constants.CENFLG); // compression method data.writeUInt16LE(_method, Constants.CENHOW); // modification time (2 bytes time, 2 bytes date) data.writeUInt32LE(_time, Constants.CENTIM); // uncompressed file crc-32 value data.writeInt32LE(_crc, Constants.CENCRC, true); // compressed size data.writeUInt32LE(_compressedSize, Constants.CENSIZ); // uncompressed size data.writeUInt32LE(_size, Constants.CENLEN); // filename length data.writeUInt16LE(_fnameLen, Constants.CENNAM); // extra field length data.writeUInt16LE(_extraLen, Constants.CENEXT); // file comment length data.writeUInt16LE(_comLen, Constants.CENCOM); // volume number start data.writeUInt16LE(_diskStart, Constants.CENDSK); // internal file attributes data.writeUInt16LE(_inattr, Constants.CENATT); // external file attributes data.writeUInt32LE(_attr, Constants.CENATX); // LOC header offset data.writeUInt32LE(_offset, Constants.CENOFF); // fill all with data.fill(0x00, Constants.CENHDR); return data; }, toString : function() { return '{\n' + '\t"made" : ' + _verMade + ",\n" + '\t"version" : ' + _version + ",\n" + '\t"flags" : ' + _flags + ",\n" + '\t"method" : ' + Utils.methodToString(_method) + ",\n" + '\t"time" : ' + _time + ",\n" + '\t"crc" : 0x' + _crc.toString(16).toUpperCase() + ",\n" + '\t"compressedSize" : ' + _compressedSize + " bytes,\n" + '\t"size" : ' + _size + " bytes,\n" + '\t"fileNameLength" : ' + _fnameLen + ",\n" + '\t"extraLength" : ' + _extraLen + " bytes,\n" + '\t"commentLength" : ' + _comLen + " bytes,\n" + '\t"diskNumStart" : ' + _diskStart + ",\n" + '\t"inAttr" : ' + _inattr + ",\n" + '\t"attr" : ' + _attr + ",\n" + '\t"offset" : ' + _offset + ",\n" + '\t"entryHeaderSize" : ' + (Constants.CENHDR + _fnameLen + _extraLen + _comLen) + " bytes\n" + '}'; } } };
stefferd/autogarageooij
public/assets/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin/node_modules/bin-build/node_modules/download/node_modules/decompress-unzip/node_modules/adm-zip/headers/entryHeader.js
JavaScript
mit
10,447
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/anim-base/anim-base.js']) { __coverage__['build/anim-base/anim-base.js'] = {"path":"build/anim-base/anim-base.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},"b":{"1":[0,0],"2":[0,0],"3":[0,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,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],"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]},"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},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":40}}},"2":{"name":"(anonymous_2)","line":60,"loc":{"start":{"line":60,"column":13},"end":{"line":60,"column":24}}},"3":{"name":"(anonymous_3)","line":85,"loc":{"start":{"line":85,"column":28},"end":{"line":85,"column":50}}},"4":{"name":"(anonymous_4)","line":106,"loc":{"start":{"line":106,"column":17},"end":{"line":106,"column":38}}},"5":{"name":"(anonymous_5)","line":120,"loc":{"start":{"line":120,"column":28},"end":{"line":120,"column":87}}},"6":{"name":"(anonymous_6)","line":147,"loc":{"start":{"line":147,"column":28},"end":{"line":147,"column":48}}},"7":{"name":"(anonymous_7)","line":176,"loc":{"start":{"line":176,"column":20},"end":{"line":176,"column":35}}},"8":{"name":"(anonymous_8)","line":208,"loc":{"start":{"line":208,"column":20},"end":{"line":208,"column":34}}},"9":{"name":"(anonymous_9)","line":281,"loc":{"start":{"line":281,"column":20},"end":{"line":281,"column":31}}},"10":{"name":"(anonymous_10)","line":354,"loc":{"start":{"line":354,"column":17},"end":{"line":354,"column":28}}},"11":{"name":"(anonymous_11)","line":369,"loc":{"start":{"line":369,"column":19},"end":{"line":369,"column":30}}},"12":{"name":"(anonymous_12)","line":384,"loc":{"start":{"line":384,"column":18},"end":{"line":384,"column":29}}},"13":{"name":"(anonymous_13)","line":393,"loc":{"start":{"line":393,"column":25},"end":{"line":393,"column":36}}},"14":{"name":"(anonymous_14)","line":399,"loc":{"start":{"line":399,"column":24},"end":{"line":399,"column":35}}},"15":{"name":"(anonymous_15)","line":410,"loc":{"start":{"line":410,"column":23},"end":{"line":410,"column":34}}},"16":{"name":"(anonymous_16)","line":433,"loc":{"start":{"line":433,"column":13},"end":{"line":433,"column":24}}},"17":{"name":"(anonymous_17)","line":449,"loc":{"start":{"line":449,"column":15},"end":{"line":449,"column":26}}},"18":{"name":"(anonymous_18)","line":462,"loc":{"start":{"line":462,"column":14},"end":{"line":462,"column":31}}},"19":{"name":"(anonymous_19)","line":471,"loc":{"start":{"line":471,"column":16},"end":{"line":471,"column":27}}},"20":{"name":"(anonymous_20)","line":483,"loc":{"start":{"line":483,"column":16},"end":{"line":483,"column":27}}},"21":{"name":"(anonymous_21)","line":497,"loc":{"start":{"line":497,"column":17},"end":{"line":497,"column":28}}},"22":{"name":"(anonymous_22)","line":512,"loc":{"start":{"line":512,"column":14},"end":{"line":512,"column":31}}},"23":{"name":"(anonymous_23)","line":526,"loc":{"start":{"line":526,"column":19},"end":{"line":526,"column":30}}},"24":{"name":"(anonymous_24)","line":542,"loc":{"start":{"line":542,"column":19},"end":{"line":542,"column":43}}},"25":{"name":"(anonymous_25)","line":578,"loc":{"start":{"line":578,"column":20},"end":{"line":578,"column":31}}},"26":{"name":"(anonymous_26)","line":603,"loc":{"start":{"line":603,"column":23},"end":{"line":603,"column":34}}},"27":{"name":"(anonymous_27)","line":614,"loc":{"start":{"line":614,"column":23},"end":{"line":614,"column":43}}},"28":{"name":"(anonymous_28)","line":656,"loc":{"start":{"line":656,"column":20},"end":{"line":656,"column":35}}},"29":{"name":"(anonymous_29)","line":676,"loc":{"start":{"line":676,"column":20},"end":{"line":676,"column":31}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":684,"column":59}},"2":{"start":{"line":23,"column":4},"end":{"line":55,"column":21}},"3":{"start":{"line":57,"column":4},"end":{"line":58,"column":15}},"4":{"start":{"line":60,"column":4},"end":{"line":63,"column":6}},"5":{"start":{"line":61,"column":8},"end":{"line":61,"column":61}},"6":{"start":{"line":62,"column":8},"end":{"line":62,"column":48}},"7":{"start":{"line":65,"column":4},"end":{"line":65,"column":25}},"8":{"start":{"line":67,"column":4},"end":{"line":67,"column":27}},"9":{"start":{"line":75,"column":4},"end":{"line":75,"column":97}},"10":{"start":{"line":83,"column":4},"end":{"line":83,"column":31}},"11":{"start":{"line":85,"column":4},"end":{"line":87,"column":6}},"12":{"start":{"line":86,"column":8},"end":{"line":86,"column":29}},"13":{"start":{"line":96,"column":4},"end":{"line":96,"column":30}},"14":{"start":{"line":104,"column":4},"end":{"line":110,"column":6}},"15":{"start":{"line":107,"column":16},"end":{"line":107,"column":45}},"16":{"start":{"line":112,"column":4},"end":{"line":112,"column":49}},"17":{"start":{"line":120,"column":4},"end":{"line":139,"column":6}},"18":{"start":{"line":121,"column":8},"end":{"line":123,"column":72}},"19":{"start":{"line":125,"column":8},"end":{"line":138,"column":9}},"20":{"start":{"line":126,"column":12},"end":{"line":133,"column":13}},"21":{"start":{"line":127,"column":16},"end":{"line":127,"column":34}},"22":{"start":{"line":128,"column":16},"end":{"line":128,"column":47}},"23":{"start":{"line":129,"column":19},"end":{"line":133,"column":13}},"24":{"start":{"line":130,"column":16},"end":{"line":130,"column":44}},"25":{"start":{"line":131,"column":19},"end":{"line":133,"column":13}},"26":{"start":{"line":132,"column":16},"end":{"line":132,"column":35}},"27":{"start":{"line":134,"column":15},"end":{"line":138,"column":9}},"28":{"start":{"line":135,"column":12},"end":{"line":135,"column":31}},"29":{"start":{"line":136,"column":15},"end":{"line":138,"column":9}},"30":{"start":{"line":137,"column":12},"end":{"line":137,"column":28}},"31":{"start":{"line":147,"column":4},"end":{"line":167,"column":6}},"32":{"start":{"line":148,"column":8},"end":{"line":150,"column":21}},"33":{"start":{"line":152,"column":8},"end":{"line":164,"column":9}},"34":{"start":{"line":153,"column":12},"end":{"line":159,"column":13}},"35":{"start":{"line":154,"column":16},"end":{"line":154,"column":49}},"36":{"start":{"line":155,"column":19},"end":{"line":159,"column":13}},"37":{"start":{"line":156,"column":16},"end":{"line":156,"column":45}},"38":{"start":{"line":157,"column":19},"end":{"line":159,"column":13}},"39":{"start":{"line":158,"column":16},"end":{"line":158,"column":35}},"40":{"start":{"line":160,"column":15},"end":{"line":164,"column":9}},"41":{"start":{"line":161,"column":12},"end":{"line":161,"column":32}},"42":{"start":{"line":162,"column":15},"end":{"line":164,"column":9}},"43":{"start":{"line":163,"column":12},"end":{"line":163,"column":28}},"44":{"start":{"line":166,"column":8},"end":{"line":166,"column":19}},"45":{"start":{"line":169,"column":4},"end":{"line":347,"column":6}},"46":{"start":{"line":177,"column":16},"end":{"line":181,"column":17}},"47":{"start":{"line":178,"column":20},"end":{"line":180,"column":21}},"48":{"start":{"line":179,"column":24},"end":{"line":179,"column":43}},"49":{"start":{"line":183,"column":16},"end":{"line":183,"column":34}},"50":{"start":{"line":184,"column":16},"end":{"line":185,"column":17}},"51":{"start":{"line":186,"column":16},"end":{"line":186,"column":28}},"52":{"start":{"line":209,"column":16},"end":{"line":211,"column":17}},"53":{"start":{"line":210,"column":20},"end":{"line":210,"column":41}},"54":{"start":{"line":282,"column":16},"end":{"line":282,"column":49}},"55":{"start":{"line":354,"column":4},"end":{"line":362,"column":6}},"56":{"start":{"line":355,"column":8},"end":{"line":356,"column":14}},"57":{"start":{"line":357,"column":8},"end":{"line":361,"column":9}},"58":{"start":{"line":358,"column":12},"end":{"line":360,"column":13}},"59":{"start":{"line":359,"column":16},"end":{"line":359,"column":35}},"60":{"start":{"line":369,"column":4},"end":{"line":377,"column":6}},"61":{"start":{"line":370,"column":8},"end":{"line":374,"column":9}},"62":{"start":{"line":371,"column":12},"end":{"line":373,"column":13}},"63":{"start":{"line":372,"column":16},"end":{"line":372,"column":36}},"64":{"start":{"line":376,"column":8},"end":{"line":376,"column":28}},"65":{"start":{"line":384,"column":4},"end":{"line":391,"column":6}},"66":{"start":{"line":385,"column":8},"end":{"line":389,"column":9}},"67":{"start":{"line":386,"column":12},"end":{"line":388,"column":13}},"68":{"start":{"line":387,"column":16},"end":{"line":387,"column":35}},"69":{"start":{"line":390,"column":8},"end":{"line":390,"column":28}},"70":{"start":{"line":393,"column":4},"end":{"line":397,"column":6}},"71":{"start":{"line":394,"column":8},"end":{"line":396,"column":9}},"72":{"start":{"line":395,"column":12},"end":{"line":395,"column":73}},"73":{"start":{"line":399,"column":4},"end":{"line":402,"column":6}},"74":{"start":{"line":400,"column":8},"end":{"line":400,"column":30}},"75":{"start":{"line":401,"column":8},"end":{"line":401,"column":19}},"76":{"start":{"line":410,"column":4},"end":{"line":423,"column":6}},"77":{"start":{"line":411,"column":8},"end":{"line":412,"column":17}},"78":{"start":{"line":413,"column":8},"end":{"line":418,"column":9}},"79":{"start":{"line":414,"column":12},"end":{"line":417,"column":13}},"80":{"start":{"line":415,"column":16},"end":{"line":415,"column":29}},"81":{"start":{"line":416,"column":16},"end":{"line":416,"column":43}},"82":{"start":{"line":420,"column":8},"end":{"line":422,"column":9}},"83":{"start":{"line":421,"column":12},"end":{"line":421,"column":32}},"84":{"start":{"line":425,"column":4},"end":{"line":425,"column":71}},"85":{"start":{"line":427,"column":4},"end":{"line":679,"column":6}},"86":{"start":{"line":434,"column":12},"end":{"line":438,"column":13}},"87":{"start":{"line":435,"column":16},"end":{"line":435,"column":31}},"88":{"start":{"line":436,"column":19},"end":{"line":438,"column":13}},"89":{"start":{"line":437,"column":16},"end":{"line":437,"column":30}},"90":{"start":{"line":439,"column":12},"end":{"line":439,"column":24}},"91":{"start":{"line":450,"column":12},"end":{"line":452,"column":13}},"92":{"start":{"line":451,"column":16},"end":{"line":451,"column":30}},"93":{"start":{"line":453,"column":12},"end":{"line":453,"column":24}},"94":{"start":{"line":463,"column":12},"end":{"line":465,"column":13}},"95":{"start":{"line":464,"column":16},"end":{"line":464,"column":34}},"96":{"start":{"line":466,"column":12},"end":{"line":466,"column":24}},"97":{"start":{"line":472,"column":12},"end":{"line":472,"column":71}},"98":{"start":{"line":473,"column":12},"end":{"line":473,"column":35}},"99":{"start":{"line":474,"column":12},"end":{"line":476,"column":13}},"100":{"start":{"line":475,"column":16},"end":{"line":475,"column":37}},"101":{"start":{"line":477,"column":12},"end":{"line":477,"column":43}},"102":{"start":{"line":478,"column":12},"end":{"line":478,"column":33}},"103":{"start":{"line":480,"column":12},"end":{"line":480,"column":29}},"104":{"start":{"line":484,"column":12},"end":{"line":484,"column":40}},"105":{"start":{"line":485,"column":12},"end":{"line":485,"column":36}},"106":{"start":{"line":486,"column":12},"end":{"line":486,"column":43}},"107":{"start":{"line":494,"column":12},"end":{"line":494,"column":31}},"108":{"start":{"line":498,"column":12},"end":{"line":498,"column":37}},"109":{"start":{"line":499,"column":12},"end":{"line":499,"column":43}},"110":{"start":{"line":500,"column":12},"end":{"line":500,"column":71}},"111":{"start":{"line":501,"column":12},"end":{"line":501,"column":33}},"112":{"start":{"line":509,"column":12},"end":{"line":509,"column":32}},"113":{"start":{"line":513,"column":12},"end":{"line":513,"column":55}},"114":{"start":{"line":514,"column":12},"end":{"line":516,"column":13}},"115":{"start":{"line":515,"column":16},"end":{"line":515,"column":70}},"116":{"start":{"line":518,"column":12},"end":{"line":518,"column":40}},"117":{"start":{"line":519,"column":12},"end":{"line":519,"column":39}},"118":{"start":{"line":520,"column":12},"end":{"line":520,"column":37}},"119":{"start":{"line":522,"column":12},"end":{"line":522,"column":43}},"120":{"start":{"line":523,"column":12},"end":{"line":523,"column":62}},"121":{"start":{"line":527,"column":12},"end":{"line":530,"column":32}},"122":{"start":{"line":532,"column":12},"end":{"line":532,"column":42}},"123":{"start":{"line":533,"column":12},"end":{"line":533,"column":36}},"124":{"start":{"line":534,"column":12},"end":{"line":534,"column":39}},"125":{"start":{"line":536,"column":12},"end":{"line":536,"column":29}},"126":{"start":{"line":537,"column":12},"end":{"line":539,"column":13}},"127":{"start":{"line":538,"column":16},"end":{"line":538,"column":34}},"128":{"start":{"line":543,"column":12},"end":{"line":550,"column":18}},"129":{"start":{"line":552,"column":12},"end":{"line":554,"column":13}},"130":{"start":{"line":553,"column":16},"end":{"line":553,"column":28}},"131":{"start":{"line":556,"column":12},"end":{"line":559,"column":13}},"132":{"start":{"line":557,"column":16},"end":{"line":557,"column":26}},"133":{"start":{"line":558,"column":16},"end":{"line":558,"column":30}},"134":{"start":{"line":561,"column":12},"end":{"line":573,"column":13}},"135":{"start":{"line":562,"column":16},"end":{"line":572,"column":17}},"136":{"start":{"line":563,"column":20},"end":{"line":563,"column":40}},"137":{"start":{"line":564,"column":20},"end":{"line":565,"column":70}},"138":{"start":{"line":567,"column":20},"end":{"line":571,"column":21}},"139":{"start":{"line":568,"column":24},"end":{"line":568,"column":100}},"140":{"start":{"line":570,"column":24},"end":{"line":570,"column":108}},"141":{"start":{"line":579,"column":12},"end":{"line":580,"column":54}},"142":{"start":{"line":582,"column":12},"end":{"line":582,"column":27}},"143":{"start":{"line":583,"column":12},"end":{"line":597,"column":13}},"144":{"start":{"line":584,"column":16},"end":{"line":586,"column":17}},"145":{"start":{"line":585,"column":20},"end":{"line":585,"column":58}},"146":{"start":{"line":593,"column":16},"end":{"line":593,"column":39}},"147":{"start":{"line":595,"column":16},"end":{"line":595,"column":30}},"148":{"start":{"line":596,"column":16},"end":{"line":596,"column":28}},"149":{"start":{"line":599,"column":12},"end":{"line":599,"column":46}},"150":{"start":{"line":600,"column":12},"end":{"line":600,"column":50}},"151":{"start":{"line":604,"column":12},"end":{"line":612,"column":33}},"152":{"start":{"line":614,"column":12},"end":{"line":649,"column":21}},"153":{"start":{"line":615,"column":16},"end":{"line":617,"column":17}},"154":{"start":{"line":616,"column":20},"end":{"line":616,"column":47}},"155":{"start":{"line":619,"column":16},"end":{"line":619,"column":35}},"156":{"start":{"line":620,"column":16},"end":{"line":625,"column":17}},"157":{"start":{"line":621,"column":20},"end":{"line":622,"column":97}},"158":{"start":{"line":623,"column":23},"end":{"line":625,"column":17}},"159":{"start":{"line":624,"column":20},"end":{"line":624,"column":51}},"160":{"start":{"line":627,"column":16},"end":{"line":628,"column":52}},"161":{"start":{"line":630,"column":16},"end":{"line":630,"column":49}},"162":{"start":{"line":631,"column":16},"end":{"line":631,"column":41}},"163":{"start":{"line":632,"column":16},"end":{"line":632,"column":61}},"164":{"start":{"line":634,"column":16},"end":{"line":636,"column":17}},"165":{"start":{"line":635,"column":20},"end":{"line":635,"column":47}},"166":{"start":{"line":638,"column":16},"end":{"line":641,"column":17}},"167":{"start":{"line":639,"column":20},"end":{"line":639,"column":81}},"168":{"start":{"line":640,"column":20},"end":{"line":640,"column":27}},"169":{"start":{"line":643,"column":16},"end":{"line":647,"column":18}},"170":{"start":{"line":651,"column":12},"end":{"line":651,"column":37}},"171":{"start":{"line":657,"column":12},"end":{"line":661,"column":25}},"172":{"start":{"line":663,"column":12},"end":{"line":671,"column":13}},"173":{"start":{"line":664,"column":16},"end":{"line":664,"column":53}},"174":{"start":{"line":665,"column":16},"end":{"line":670,"column":17}},"175":{"start":{"line":666,"column":20},"end":{"line":666,"column":38}},"176":{"start":{"line":667,"column":20},"end":{"line":667,"column":35}},"177":{"start":{"line":669,"column":20},"end":{"line":669,"column":28}},"178":{"start":{"line":673,"column":12},"end":{"line":673,"column":23}},"179":{"start":{"line":677,"column":12},"end":{"line":677,"column":52}},"180":{"start":{"line":681,"column":4},"end":{"line":681,"column":36}}},"branchMap":{"1":{"line":125,"type":"if","locations":[{"start":{"line":125,"column":8},"end":{"line":125,"column":8}},{"start":{"line":125,"column":8},"end":{"line":125,"column":8}}]},"2":{"line":126,"type":"if","locations":[{"start":{"line":126,"column":12},"end":{"line":126,"column":12}},{"start":{"line":126,"column":12},"end":{"line":126,"column":12}}]},"3":{"line":126,"type":"binary-expr","locations":[{"start":{"line":126,"column":16},"end":{"line":126,"column":34}},{"start":{"line":126,"column":39},"end":{"line":126,"column":59}},{"start":{"line":126,"column":63},"end":{"line":126,"column":89}}]},"4":{"line":127,"type":"binary-expr","locations":[{"start":{"line":127,"column":23},"end":{"line":127,"column":27}},{"start":{"line":127,"column":31},"end":{"line":127,"column":33}}]},"5":{"line":129,"type":"if","locations":[{"start":{"line":129,"column":19},"end":{"line":129,"column":19}},{"start":{"line":129,"column":19},"end":{"line":129,"column":19}}]},"6":{"line":129,"type":"binary-expr","locations":[{"start":{"line":129,"column":23},"end":{"line":129,"column":46}},{"start":{"line":129,"column":50},"end":{"line":129,"column":75}}]},"7":{"line":131,"type":"if","locations":[{"start":{"line":131,"column":19},"end":{"line":131,"column":19}},{"start":{"line":131,"column":19},"end":{"line":131,"column":19}}]},"8":{"line":134,"type":"if","locations":[{"start":{"line":134,"column":15},"end":{"line":134,"column":15}},{"start":{"line":134,"column":15},"end":{"line":134,"column":15}}]},"9":{"line":136,"type":"if","locations":[{"start":{"line":136,"column":15},"end":{"line":136,"column":15}},{"start":{"line":136,"column":15},"end":{"line":136,"column":15}}]},"10":{"line":152,"type":"if","locations":[{"start":{"line":152,"column":8},"end":{"line":152,"column":8}},{"start":{"line":152,"column":8},"end":{"line":152,"column":8}}]},"11":{"line":153,"type":"if","locations":[{"start":{"line":153,"column":12},"end":{"line":153,"column":12}},{"start":{"line":153,"column":12},"end":{"line":153,"column":12}}]},"12":{"line":153,"type":"binary-expr","locations":[{"start":{"line":153,"column":16},"end":{"line":153,"column":34}},{"start":{"line":153,"column":39},"end":{"line":153,"column":59}},{"start":{"line":153,"column":63},"end":{"line":153,"column":89}}]},"13":{"line":155,"type":"if","locations":[{"start":{"line":155,"column":19},"end":{"line":155,"column":19}},{"start":{"line":155,"column":19},"end":{"line":155,"column":19}}]},"14":{"line":155,"type":"binary-expr","locations":[{"start":{"line":155,"column":23},"end":{"line":155,"column":46}},{"start":{"line":155,"column":50},"end":{"line":155,"column":75}}]},"15":{"line":157,"type":"if","locations":[{"start":{"line":157,"column":19},"end":{"line":157,"column":19}},{"start":{"line":157,"column":19},"end":{"line":157,"column":19}}]},"16":{"line":160,"type":"if","locations":[{"start":{"line":160,"column":15},"end":{"line":160,"column":15}},{"start":{"line":160,"column":15},"end":{"line":160,"column":15}}]},"17":{"line":162,"type":"if","locations":[{"start":{"line":162,"column":15},"end":{"line":162,"column":15}},{"start":{"line":162,"column":15},"end":{"line":162,"column":15}}]},"18":{"line":177,"type":"if","locations":[{"start":{"line":177,"column":16},"end":{"line":177,"column":16}},{"start":{"line":177,"column":16},"end":{"line":177,"column":16}}]},"19":{"line":178,"type":"if","locations":[{"start":{"line":178,"column":20},"end":{"line":178,"column":20}},{"start":{"line":178,"column":20},"end":{"line":178,"column":20}}]},"20":{"line":178,"type":"binary-expr","locations":[{"start":{"line":178,"column":24},"end":{"line":178,"column":48}},{"start":{"line":178,"column":52},"end":{"line":178,"column":65}}]},"21":{"line":184,"type":"if","locations":[{"start":{"line":184,"column":16},"end":{"line":184,"column":16}},{"start":{"line":184,"column":16},"end":{"line":184,"column":16}}]},"22":{"line":209,"type":"if","locations":[{"start":{"line":209,"column":16},"end":{"line":209,"column":16}},{"start":{"line":209,"column":16},"end":{"line":209,"column":16}}]},"23":{"line":209,"type":"binary-expr","locations":[{"start":{"line":209,"column":20},"end":{"line":209,"column":43}},{"start":{"line":209,"column":47},"end":{"line":209,"column":55}}]},"24":{"line":358,"type":"if","locations":[{"start":{"line":358,"column":12},"end":{"line":358,"column":12}},{"start":{"line":358,"column":12},"end":{"line":358,"column":12}}]},"25":{"line":371,"type":"if","locations":[{"start":{"line":371,"column":12},"end":{"line":371,"column":12}},{"start":{"line":371,"column":12},"end":{"line":371,"column":12}}]},"26":{"line":386,"type":"if","locations":[{"start":{"line":386,"column":12},"end":{"line":386,"column":12}},{"start":{"line":386,"column":12},"end":{"line":386,"column":12}}]},"27":{"line":394,"type":"if","locations":[{"start":{"line":394,"column":8},"end":{"line":394,"column":8}},{"start":{"line":394,"column":8},"end":{"line":394,"column":8}}]},"28":{"line":414,"type":"if","locations":[{"start":{"line":414,"column":12},"end":{"line":414,"column":12}},{"start":{"line":414,"column":12},"end":{"line":414,"column":12}}]},"29":{"line":420,"type":"if","locations":[{"start":{"line":420,"column":8},"end":{"line":420,"column":8}},{"start":{"line":420,"column":8},"end":{"line":420,"column":8}}]},"30":{"line":434,"type":"if","locations":[{"start":{"line":434,"column":12},"end":{"line":434,"column":12}},{"start":{"line":434,"column":12},"end":{"line":434,"column":12}}]},"31":{"line":436,"type":"if","locations":[{"start":{"line":436,"column":19},"end":{"line":436,"column":19}},{"start":{"line":436,"column":19},"end":{"line":436,"column":19}}]},"32":{"line":450,"type":"if","locations":[{"start":{"line":450,"column":12},"end":{"line":450,"column":12}},{"start":{"line":450,"column":12},"end":{"line":450,"column":12}}]},"33":{"line":463,"type":"if","locations":[{"start":{"line":463,"column":12},"end":{"line":463,"column":12}},{"start":{"line":463,"column":12},"end":{"line":463,"column":12}}]},"34":{"line":463,"type":"binary-expr","locations":[{"start":{"line":463,"column":16},"end":{"line":463,"column":33}},{"start":{"line":463,"column":37},"end":{"line":463,"column":53}}]},"35":{"line":474,"type":"if","locations":[{"start":{"line":474,"column":12},"end":{"line":474,"column":12}},{"start":{"line":474,"column":12},"end":{"line":474,"column":12}}]},"36":{"line":514,"type":"if","locations":[{"start":{"line":514,"column":12},"end":{"line":514,"column":12}},{"start":{"line":514,"column":12},"end":{"line":514,"column":12}}]},"37":{"line":537,"type":"if","locations":[{"start":{"line":537,"column":12},"end":{"line":537,"column":12}},{"start":{"line":537,"column":12},"end":{"line":537,"column":12}}]},"38":{"line":552,"type":"if","locations":[{"start":{"line":552,"column":12},"end":{"line":552,"column":12}},{"start":{"line":552,"column":12},"end":{"line":552,"column":12}}]},"39":{"line":556,"type":"if","locations":[{"start":{"line":556,"column":12},"end":{"line":556,"column":12}},{"start":{"line":556,"column":12},"end":{"line":556,"column":12}}]},"40":{"line":562,"type":"if","locations":[{"start":{"line":562,"column":16},"end":{"line":562,"column":16}},{"start":{"line":562,"column":16},"end":{"line":562,"column":16}}]},"41":{"line":564,"type":"cond-expr","locations":[{"start":{"line":565,"column":28},"end":{"line":565,"column":45}},{"start":{"line":565,"column":48},"end":{"line":565,"column":69}}]},"42":{"line":564,"type":"binary-expr","locations":[{"start":{"line":564,"column":30},"end":{"line":564,"column":45}},{"start":{"line":564,"column":49},"end":{"line":564,"column":71}}]},"43":{"line":567,"type":"if","locations":[{"start":{"line":567,"column":20},"end":{"line":567,"column":20}},{"start":{"line":567,"column":20},"end":{"line":567,"column":20}}]},"44":{"line":583,"type":"if","locations":[{"start":{"line":583,"column":12},"end":{"line":583,"column":12}},{"start":{"line":583,"column":12},"end":{"line":583,"column":12}}]},"45":{"line":583,"type":"binary-expr","locations":[{"start":{"line":583,"column":16},"end":{"line":583,"column":35}},{"start":{"line":583,"column":39},"end":{"line":583,"column":55}}]},"46":{"line":584,"type":"if","locations":[{"start":{"line":584,"column":16},"end":{"line":584,"column":16}},{"start":{"line":584,"column":16},"end":{"line":584,"column":16}}]},"47":{"line":604,"type":"binary-expr","locations":[{"start":{"line":604,"column":23},"end":{"line":604,"column":39}},{"start":{"line":604,"column":43},"end":{"line":604,"column":45}}]},"48":{"line":605,"type":"binary-expr","locations":[{"start":{"line":605,"column":21},"end":{"line":605,"column":35}},{"start":{"line":605,"column":39},"end":{"line":605,"column":41}}]},"49":{"line":615,"type":"if","locations":[{"start":{"line":615,"column":16},"end":{"line":615,"column":16}},{"start":{"line":615,"column":16},"end":{"line":615,"column":16}}]},"50":{"line":620,"type":"if","locations":[{"start":{"line":620,"column":16},"end":{"line":620,"column":16}},{"start":{"line":620,"column":16},"end":{"line":620,"column":16}}]},"51":{"line":621,"type":"cond-expr","locations":[{"start":{"line":622,"column":28},"end":{"line":622,"column":60}},{"start":{"line":622,"column":63},"end":{"line":622,"column":96}}]},"52":{"line":621,"type":"binary-expr","locations":[{"start":{"line":621,"column":29},"end":{"line":621,"column":47}},{"start":{"line":621,"column":51},"end":{"line":621,"column":76}}]},"53":{"line":623,"type":"if","locations":[{"start":{"line":623,"column":23},"end":{"line":623,"column":23}},{"start":{"line":623,"column":23},"end":{"line":623,"column":23}}]},"54":{"line":630,"type":"cond-expr","locations":[{"start":{"line":630,"column":32},"end":{"line":630,"column":40}},{"start":{"line":630,"column":43},"end":{"line":630,"column":48}}]},"55":{"line":631,"type":"cond-expr","locations":[{"start":{"line":631,"column":28},"end":{"line":631,"column":34}},{"start":{"line":631,"column":37},"end":{"line":631,"column":40}}]},"56":{"line":632,"type":"cond-expr","locations":[{"start":{"line":632,"column":29},"end":{"line":632,"column":35}},{"start":{"line":632,"column":38},"end":{"line":632,"column":60}}]},"57":{"line":632,"type":"cond-expr","locations":[{"start":{"line":632,"column":47},"end":{"line":632,"column":55}},{"start":{"line":632,"column":58},"end":{"line":632,"column":60}}]},"58":{"line":634,"type":"if","locations":[{"start":{"line":634,"column":16},"end":{"line":634,"column":16}},{"start":{"line":634,"column":16},"end":{"line":634,"column":16}}]},"59":{"line":634,"type":"binary-expr","locations":[{"start":{"line":634,"column":20},"end":{"line":634,"column":25}},{"start":{"line":634,"column":29},"end":{"line":634,"column":62}}]},"60":{"line":638,"type":"if","locations":[{"start":{"line":638,"column":16},"end":{"line":638,"column":16}},{"start":{"line":638,"column":16},"end":{"line":638,"column":16}}]},"61":{"line":638,"type":"binary-expr","locations":[{"start":{"line":638,"column":20},"end":{"line":638,"column":26}},{"start":{"line":638,"column":30},"end":{"line":638,"column":34}}]},"62":{"line":644,"type":"cond-expr","locations":[{"start":{"line":644,"column":51},"end":{"line":644,"column":65}},{"start":{"line":644,"column":68},"end":{"line":644,"column":73}}]},"63":{"line":659,"type":"cond-expr","locations":[{"start":{"line":659,"column":42},"end":{"line":659,"column":48}},{"start":{"line":659,"column":50},"end":{"line":659,"column":56}}]},"64":{"line":660,"type":"cond-expr","locations":[{"start":{"line":660,"column":42},"end":{"line":660,"column":48}},{"start":{"line":660,"column":50},"end":{"line":660,"column":56}}]},"65":{"line":663,"type":"if","locations":[{"start":{"line":663,"column":12},"end":{"line":663,"column":12}},{"start":{"line":663,"column":12},"end":{"line":663,"column":12}}]},"66":{"line":665,"type":"if","locations":[{"start":{"line":665,"column":16},"end":{"line":665,"column":16}},{"start":{"line":665,"column":16},"end":{"line":665,"column":16}}]},"67":{"line":665,"type":"binary-expr","locations":[{"start":{"line":665,"column":20},"end":{"line":665,"column":43}},{"start":{"line":665,"column":47},"end":{"line":665,"column":67}}]}},"code":["(function () { YUI.add('anim-base', function (Y, NAME) {","","/**","* The Animation Utility provides an API for creating advanced transitions.","* @module anim","*/","","/**","* Provides the base Anim class, for animating numeric properties.","*","* @module anim","* @submodule anim-base","*/",""," /**"," * A class for constructing animation instances."," * @class Anim"," * @for Anim"," * @constructor"," * @extends Base"," */",""," var RUNNING = 'running',"," START_TIME = 'startTime',"," ELAPSED_TIME = 'elapsedTime',"," /**"," * @for Anim"," * @event start"," * @description fires when an animation begins."," * @param {Event} ev The start event."," * @type Event.Custom"," */"," START = 'start',",""," /**"," * @event tween"," * @description fires every frame of the animation."," * @param {Event} ev The tween event."," * @type Event.Custom"," */"," TWEEN = 'tween',",""," /**"," * @event end"," * @description fires after the animation completes."," * @param {Event} ev The end event."," * @type Event.Custom"," */"," END = 'end',"," NODE = 'node',"," PAUSED = 'paused',"," REVERSE = 'reverse', // TODO: cleanup"," ITERATION_COUNT = 'iterationCount',",""," NUM = Number;",""," var _running = {},"," _timer;",""," Y.Anim = function() {"," Y.Anim.superclass.constructor.apply(this, arguments);"," Y.Anim._instances[Y.stamp(this)] = this;"," };",""," Y.Anim.NAME = 'anim';",""," Y.Anim._instances = {};",""," /**"," * Regex of properties that should use the default unit."," *"," * @property RE_DEFAULT_UNIT"," * @static"," */"," Y.Anim.RE_DEFAULT_UNIT = /^width|height|top|right|bottom|left|margin.*|padding.*|border.*$/i;",""," /**"," * The default unit to use with properties that pass the RE_DEFAULT_UNIT test."," *"," * @property DEFAULT_UNIT"," * @static"," */"," Y.Anim.DEFAULT_UNIT = 'px';",""," Y.Anim.DEFAULT_EASING = function (t, b, c, d) {"," return c * t / d + b; // linear easing"," };",""," /**"," * Time in milliseconds passed to setInterval for frame processing"," *"," * @property intervalTime"," * @default 20"," * @static"," */"," Y.Anim._intervalTime = 20;",""," /**"," * Bucket for custom getters and setters"," *"," * @property behaviors"," * @static"," */"," Y.Anim.behaviors = {"," left: {"," get: function(anim, attr) {"," return anim._getOffset(attr);"," }"," }"," };",""," Y.Anim.behaviors.top = Y.Anim.behaviors.left;",""," /**"," * The default setter to use when setting object properties."," *"," * @property DEFAULT_SETTER"," * @static"," */"," Y.Anim.DEFAULT_SETTER = function(anim, att, from, to, elapsed, duration, fn, unit) {"," var node = anim._node,"," domNode = node._node,"," val = fn(elapsed, NUM(from), NUM(to) - NUM(from), duration);",""," if (domNode) {"," if ('style' in domNode && (att in domNode.style || att in Y.DOM.CUSTOM_STYLES)) {"," unit = unit || '';"," node.setStyle(att, val + unit);"," } else if ('attributes' in domNode && att in domNode.attributes) {"," node.setAttribute(att, val);"," } else if (att in domNode) {"," domNode[att] = val;"," }"," } else if (node.set) {"," node.set(att, val);"," } else if (att in node) {"," node[att] = val;"," }"," };",""," /**"," * The default getter to use when getting object properties."," *"," * @property DEFAULT_GETTER"," * @static"," */"," Y.Anim.DEFAULT_GETTER = function(anim, att) {"," var node = anim._node,"," domNode = node._node,"," val = '';",""," if (domNode) {"," if ('style' in domNode && (att in domNode.style || att in Y.DOM.CUSTOM_STYLES)) {"," val = node.getComputedStyle(att);"," } else if ('attributes' in domNode && att in domNode.attributes) {"," val = node.getAttribute(att);"," } else if (att in domNode) {"," val = domNode[att];"," }"," } else if (node.get) {"," val = node.get(att);"," } else if (att in node) {"," val = node[att];"," }",""," return val;"," };",""," Y.Anim.ATTRS = {"," /**"," * The object to be animated."," * @attribute node"," * @type Node"," */"," node: {"," setter: function(node) {"," if (node) {"," if (typeof node === 'string' || node.nodeType) {"," node = Y.one(node);"," }"," }",""," this._node = node;"," if (!node) {"," }"," return node;"," }"," },",""," /**"," * The length of the animation. Defaults to \"1\" (second)."," * @attribute duration"," * @type NUM"," */"," duration: {"," value: 1"," },",""," /**"," * The method that will provide values to the attribute(s) during the animation."," * Defaults to \"Easing.easeNone\"."," * @attribute easing"," * @type Function"," */"," easing: {"," value: Y.Anim.DEFAULT_EASING,",""," setter: function(val) {"," if (typeof val === 'string' && Y.Easing) {"," return Y.Easing[val];"," }"," }"," },",""," /**"," * The starting values for the animated properties."," *"," * Fields may be strings, numbers, or functions."," * If a function is used, the return value becomes the from value."," * If no from value is specified, the DEFAULT_GETTER will be used."," * Supports any unit, provided it matches the \"to\" (or default)"," * unit (e.g. `{width: '10em', color: 'rgb(0, 0, 0)', borderColor: '#ccc'}`)."," *"," * If using the default ('px' for length-based units), the unit may be omitted"," * (e.g. `{width: 100}, borderColor: 'ccc'}`, which defaults to pixels"," * and hex, respectively)."," *"," * @attribute from"," * @type Object"," */"," from: {},",""," /**"," * The ending values for the animated properties."," *"," * Fields may be strings, numbers, or functions."," * Supports any unit, provided it matches the \"from\" (or default)"," * unit (e.g. `{width: '50%', color: 'red', borderColor: '#ccc'}`)."," *"," * If using the default ('px' for length-based units), the unit may be omitted"," * (e.g. `{width: 100, borderColor: 'ccc'}`, which defaults to pixels"," * and hex, respectively)."," *"," * @attribute to"," * @type Object"," */"," to: {},",""," /**"," * Date stamp for the first frame of the animation."," * @attribute startTime"," * @type Int"," * @default 0"," * @readOnly"," */"," startTime: {"," value: 0,"," readOnly: true"," },",""," /**"," * Current time the animation has been running."," * @attribute elapsedTime"," * @type Int"," * @default 0"," * @readOnly"," */"," elapsedTime: {"," value: 0,"," readOnly: true"," },",""," /**"," * Whether or not the animation is currently running."," * @attribute running"," * @type Boolean"," * @default false"," * @readOnly"," */"," running: {"," getter: function() {"," return !!_running[Y.stamp(this)];"," },"," value: false,"," readOnly: true"," },",""," /**"," * The number of times the animation should run"," * @attribute iterations"," * @type Int"," * @default 1"," */"," iterations: {"," value: 1"," },",""," /**"," * The number of iterations that have occurred."," * Resets when an animation ends (reaches iteration count or stop() called)."," * @attribute iterationCount"," * @type Int"," * @default 0"," * @readOnly"," */"," iterationCount: {"," value: 0,"," readOnly: true"," },",""," /**"," * How iterations of the animation should behave."," * Possible values are \"normal\" and \"alternate\"."," * Normal will repeat the animation, alternate will reverse on every other pass."," *"," * @attribute direction"," * @type String"," * @default \"normal\""," */"," direction: {"," value: 'normal' // | alternate (fwd on odd, rev on even per spec)"," },",""," /**"," * Whether or not the animation is currently paused."," * @attribute paused"," * @type Boolean"," * @default false"," * @readOnly"," */"," paused: {"," readOnly: true,"," value: false"," },",""," /**"," * If true, animation begins from last frame"," * @attribute reverse"," * @type Boolean"," * @default false"," */"," reverse: {"," value: false"," }","",""," };",""," /**"," * Runs all animation instances."," * @method run"," * @static"," */"," Y.Anim.run = function() {"," var instances = Y.Anim._instances,"," i;"," for (i in instances) {"," if (instances[i].run) {"," instances[i].run();"," }"," }"," };",""," /**"," * Pauses all animation instances."," * @method pause"," * @static"," */"," Y.Anim.pause = function() {"," for (var i in _running) { // stop timer if nothing running"," if (_running[i].pause) {"," _running[i].pause();"," }"," }",""," Y.Anim._stopTimer();"," };",""," /**"," * Stops all animation instances."," * @method stop"," * @static"," */"," Y.Anim.stop = function() {"," for (var i in _running) { // stop timer if nothing running"," if (_running[i].stop) {"," _running[i].stop();"," }"," }"," Y.Anim._stopTimer();"," };",""," Y.Anim._startTimer = function() {"," if (!_timer) {"," _timer = setInterval(Y.Anim._runFrame, Y.Anim._intervalTime);"," }"," };",""," Y.Anim._stopTimer = function() {"," clearInterval(_timer);"," _timer = 0;"," };",""," /**"," * Called per Interval to handle each animation frame."," * @method _runFrame"," * @private"," * @static"," */"," Y.Anim._runFrame = function() {"," var done = true,"," anim;"," for (anim in _running) {"," if (_running[anim]._runFrame) {"," done = false;"," _running[anim]._runFrame();"," }"," }",""," if (done) {"," Y.Anim._stopTimer();"," }"," };",""," Y.Anim.RE_UNITS = /^(-?\\d*\\.?\\d*){1}(em|ex|px|in|cm|mm|pt|pc|%)*$/;",""," var proto = {"," /**"," * Starts or resumes an animation."," * @method run"," * @chainable"," */"," run: function() {"," if (this.get(PAUSED)) {"," this._resume();"," } else if (!this.get(RUNNING)) {"," this._start();"," }"," return this;"," },",""," /**"," * Pauses the animation and"," * freezes it in its current state and time."," * Calling run() will continue where it left off."," * @method pause"," * @chainable"," */"," pause: function() {"," if (this.get(RUNNING)) {"," this._pause();"," }"," return this;"," },",""," /**"," * Stops the animation and resets its time."," * @method stop"," * @param {Boolean} finish If true, the animation will move to the last frame"," * @chainable"," */"," stop: function(finish) {"," if (this.get(RUNNING) || this.get(PAUSED)) {"," this._end(finish);"," }"," return this;"," },",""," _added: false,",""," _start: function() {"," this._set(START_TIME, new Date() - this.get(ELAPSED_TIME));"," this._actualFrames = 0;"," if (!this.get(PAUSED)) {"," this._initAnimAttr();"," }"," _running[Y.stamp(this)] = this;"," Y.Anim._startTimer();",""," this.fire(START);"," },",""," _pause: function() {"," this._set(START_TIME, null);"," this._set(PAUSED, true);"," delete _running[Y.stamp(this)];",""," /**"," * @event pause"," * @description fires when an animation is paused."," * @param {Event} ev The pause event."," * @type Event.Custom"," */"," this.fire('pause');"," },",""," _resume: function() {"," this._set(PAUSED, false);"," _running[Y.stamp(this)] = this;"," this._set(START_TIME, new Date() - this.get(ELAPSED_TIME));"," Y.Anim._startTimer();",""," /**"," * @event resume"," * @description fires when an animation is resumed (run from pause)."," * @param {Event} ev The pause event."," * @type Event.Custom"," */"," this.fire('resume');"," },",""," _end: function(finish) {"," var duration = this.get('duration') * 1000;"," if (finish) { // jump to last frame"," this._runAttrs(duration, duration, this.get(REVERSE));"," }",""," this._set(START_TIME, null);"," this._set(ELAPSED_TIME, 0);"," this._set(PAUSED, false);",""," delete _running[Y.stamp(this)];"," this.fire(END, {elapsed: this.get(ELAPSED_TIME)});"," },",""," _runFrame: function() {"," var d = this._runtimeAttr.duration,"," t = new Date() - this.get(START_TIME),"," reverse = this.get(REVERSE),"," done = (t >= d);",""," this._runAttrs(t, d, reverse);"," this._actualFrames += 1;"," this._set(ELAPSED_TIME, t);",""," this.fire(TWEEN);"," if (done) {"," this._lastFrame();"," }"," },",""," _runAttrs: function(t, d, reverse) {"," var attr = this._runtimeAttr,"," customAttr = Y.Anim.behaviors,"," easing = attr.easing,"," lastFrame = d,"," done = false,"," attribute,"," setter,"," i;",""," if (t >= d) {"," done = true;"," }",""," if (reverse) {"," t = d - t;"," lastFrame = 0;"," }",""," for (i in attr) {"," if (attr[i].to) {"," attribute = attr[i];"," setter = (i in customAttr && 'set' in customAttr[i]) ?"," customAttr[i].set : Y.Anim.DEFAULT_SETTER;",""," if (!done) {"," setter(this, i, attribute.from, attribute.to, t, d, easing, attribute.unit);"," } else {"," setter(this, i, attribute.from, attribute.to, lastFrame, d, easing, attribute.unit);"," }"," }"," }","",""," },",""," _lastFrame: function() {"," var iter = this.get('iterations'),"," iterCount = this.get(ITERATION_COUNT);",""," iterCount += 1;"," if (iter === 'infinite' || iterCount < iter) {"," if (this.get('direction') === 'alternate') {"," this.set(REVERSE, !this.get(REVERSE)); // flip it"," }"," /**"," * @event iteration"," * @description fires when an animation begins an iteration."," * @param {Event} ev The iteration event."," * @type Event.Custom"," */"," this.fire('iteration');"," } else {"," iterCount = 0;"," this._end();"," }",""," this._set(START_TIME, new Date());"," this._set(ITERATION_COUNT, iterCount);"," },",""," _initAnimAttr: function() {"," var from = this.get('from') || {},"," to = this.get('to') || {},"," attr = {"," duration: this.get('duration') * 1000,"," easing: this.get('easing')"," },"," customAttr = Y.Anim.behaviors,"," node = this.get(NODE), // implicit attr init"," unit, begin, end;",""," Y.each(to, function(val, name) {"," if (typeof val === 'function') {"," val = val.call(this, node);"," }",""," begin = from[name];"," if (begin === undefined) {"," begin = (name in customAttr && 'get' in customAttr[name]) ?"," customAttr[name].get(this, name) : Y.Anim.DEFAULT_GETTER(this, name);"," } else if (typeof begin === 'function') {"," begin = begin.call(this, node);"," }",""," var mFrom = Y.Anim.RE_UNITS.exec(begin),"," mTo = Y.Anim.RE_UNITS.exec(val);",""," begin = mFrom ? mFrom[1] : begin;"," end = mTo ? mTo[1] : val;"," unit = mTo ? mTo[2] : mFrom ? mFrom[2] : ''; // one might be zero TODO: mixed units",""," if (!unit && Y.Anim.RE_DEFAULT_UNIT.test(name)) {"," unit = Y.Anim.DEFAULT_UNIT;"," }",""," if (!begin || !end) {"," Y.error('invalid \"from\" or \"to\" for \"' + name + '\"', 'Anim');"," return;"," }",""," attr[name] = {"," from: Y.Lang.isObject(begin) ? Y.clone(begin) : begin,"," to: end,"," unit: unit"," };",""," }, this);",""," this._runtimeAttr = attr;"," },","",""," // TODO: move to computedStyle? (browsers dont agree on default computed offsets)"," _getOffset: function(attr) {"," var node = this._node,"," val = node.getComputedStyle(attr),"," get = (attr === 'left') ? 'getX': 'getY',"," set = (attr === 'left') ? 'setX': 'setY',"," position;",""," if (val === 'auto') {"," position = node.getStyle('position');"," if (position === 'absolute' || position === 'fixed') {"," val = node[get]();"," node[set](val);"," } else {"," val = 0;"," }"," }",""," return val;"," },",""," destructor: function() {"," delete Y.Anim._instances[Y.stamp(this)];"," }"," };",""," Y.extend(Y.Anim, Y.Base, proto);","","","}, '@VERSION@', {\"requires\": [\"base-base\", \"node-style\"]});","","}());"]}; } var __cov_LgJ5P4ZXEcllOMVJL_pLXQ = __coverage__['build/anim-base/anim-base.js']; __cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['1']++;YUI.add('anim-base',function(Y,NAME){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['1']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['2']++;var RUNNING='running',START_TIME='startTime',ELAPSED_TIME='elapsedTime',START='start',TWEEN='tween',END='end',NODE='node',PAUSED='paused',REVERSE='reverse',ITERATION_COUNT='iterationCount',NUM=Number;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['3']++;var _running={},_timer;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['4']++;Y.Anim=function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['2']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['5']++;Y.Anim.superclass.constructor.apply(this,arguments);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['6']++;Y.Anim._instances[Y.stamp(this)]=this;};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['7']++;Y.Anim.NAME='anim';__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['8']++;Y.Anim._instances={};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['9']++;Y.Anim.RE_DEFAULT_UNIT=/^width|height|top|right|bottom|left|margin.*|padding.*|border.*$/i;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['10']++;Y.Anim.DEFAULT_UNIT='px';__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['11']++;Y.Anim.DEFAULT_EASING=function(t,b,c,d){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['3']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['12']++;return c*t/d+b;};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['13']++;Y.Anim._intervalTime=20;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['14']++;Y.Anim.behaviors={left:{get:function(anim,attr){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['4']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['15']++;return anim._getOffset(attr);}}};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['16']++;Y.Anim.behaviors.top=Y.Anim.behaviors.left;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['17']++;Y.Anim.DEFAULT_SETTER=function(anim,att,from,to,elapsed,duration,fn,unit){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['5']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['18']++;var node=anim._node,domNode=node._node,val=fn(elapsed,NUM(from),NUM(to)-NUM(from),duration);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['19']++;if(domNode){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['1'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['20']++;if((__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['3'][0]++,'style'in domNode)&&((__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['3'][1]++,att in domNode.style)||(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['3'][2]++,att in Y.DOM.CUSTOM_STYLES))){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['2'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['21']++;unit=(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['4'][0]++,unit)||(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['4'][1]++,'');__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['22']++;node.setStyle(att,val+unit);}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['2'][1]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['23']++;if((__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['6'][0]++,'attributes'in domNode)&&(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['6'][1]++,att in domNode.attributes)){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['5'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['24']++;node.setAttribute(att,val);}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['5'][1]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['25']++;if(att in domNode){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['7'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['26']++;domNode[att]=val;}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['7'][1]++;}}}}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['1'][1]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['27']++;if(node.set){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['8'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['28']++;node.set(att,val);}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['8'][1]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['29']++;if(att in node){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['9'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['30']++;node[att]=val;}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['9'][1]++;}}}};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['31']++;Y.Anim.DEFAULT_GETTER=function(anim,att){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['6']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['32']++;var node=anim._node,domNode=node._node,val='';__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['33']++;if(domNode){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['10'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['34']++;if((__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['12'][0]++,'style'in domNode)&&((__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['12'][1]++,att in domNode.style)||(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['12'][2]++,att in Y.DOM.CUSTOM_STYLES))){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['11'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['35']++;val=node.getComputedStyle(att);}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['11'][1]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['36']++;if((__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['14'][0]++,'attributes'in domNode)&&(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['14'][1]++,att in domNode.attributes)){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['13'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['37']++;val=node.getAttribute(att);}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['13'][1]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['38']++;if(att in domNode){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['15'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['39']++;val=domNode[att];}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['15'][1]++;}}}}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['10'][1]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['40']++;if(node.get){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['16'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['41']++;val=node.get(att);}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['16'][1]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['42']++;if(att in node){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['17'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['43']++;val=node[att];}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['17'][1]++;}}}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['44']++;return val;};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['45']++;Y.Anim.ATTRS={node:{setter:function(node){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['7']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['46']++;if(node){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['18'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['47']++;if((__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['20'][0]++,typeof node==='string')||(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['20'][1]++,node.nodeType)){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['19'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['48']++;node=Y.one(node);}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['19'][1]++;}}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['18'][1]++;}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['49']++;this._node=node;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['50']++;if(!node){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['21'][0]++;}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['21'][1]++;}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['51']++;return node;}},duration:{value:1},easing:{value:Y.Anim.DEFAULT_EASING,setter:function(val){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['8']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['52']++;if((__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['23'][0]++,typeof val==='string')&&(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['23'][1]++,Y.Easing)){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['22'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['53']++;return Y.Easing[val];}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['22'][1]++;}}},from:{},to:{},startTime:{value:0,readOnly:true},elapsedTime:{value:0,readOnly:true},running:{getter:function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['9']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['54']++;return!!_running[Y.stamp(this)];},value:false,readOnly:true},iterations:{value:1},iterationCount:{value:0,readOnly:true},direction:{value:'normal'},paused:{readOnly:true,value:false},reverse:{value:false}};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['55']++;Y.Anim.run=function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['10']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['56']++;var instances=Y.Anim._instances,i;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['57']++;for(i in instances){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['58']++;if(instances[i].run){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['24'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['59']++;instances[i].run();}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['24'][1]++;}}};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['60']++;Y.Anim.pause=function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['11']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['61']++;for(var i in _running){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['62']++;if(_running[i].pause){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['25'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['63']++;_running[i].pause();}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['25'][1]++;}}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['64']++;Y.Anim._stopTimer();};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['65']++;Y.Anim.stop=function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['12']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['66']++;for(var i in _running){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['67']++;if(_running[i].stop){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['26'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['68']++;_running[i].stop();}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['26'][1]++;}}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['69']++;Y.Anim._stopTimer();};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['70']++;Y.Anim._startTimer=function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['13']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['71']++;if(!_timer){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['27'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['72']++;_timer=setInterval(Y.Anim._runFrame,Y.Anim._intervalTime);}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['27'][1]++;}};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['73']++;Y.Anim._stopTimer=function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['14']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['74']++;clearInterval(_timer);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['75']++;_timer=0;};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['76']++;Y.Anim._runFrame=function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['15']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['77']++;var done=true,anim;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['78']++;for(anim in _running){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['79']++;if(_running[anim]._runFrame){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['28'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['80']++;done=false;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['81']++;_running[anim]._runFrame();}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['28'][1]++;}}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['82']++;if(done){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['29'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['83']++;Y.Anim._stopTimer();}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['29'][1]++;}};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['84']++;Y.Anim.RE_UNITS=/^(-?\d*\.?\d*){1}(em|ex|px|in|cm|mm|pt|pc|%)*$/;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['85']++;var proto={run:function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['16']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['86']++;if(this.get(PAUSED)){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['30'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['87']++;this._resume();}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['30'][1]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['88']++;if(!this.get(RUNNING)){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['31'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['89']++;this._start();}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['31'][1]++;}}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['90']++;return this;},pause:function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['17']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['91']++;if(this.get(RUNNING)){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['32'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['92']++;this._pause();}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['32'][1]++;}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['93']++;return this;},stop:function(finish){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['18']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['94']++;if((__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['34'][0]++,this.get(RUNNING))||(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['34'][1]++,this.get(PAUSED))){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['33'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['95']++;this._end(finish);}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['33'][1]++;}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['96']++;return this;},_added:false,_start:function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['19']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['97']++;this._set(START_TIME,new Date()-this.get(ELAPSED_TIME));__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['98']++;this._actualFrames=0;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['99']++;if(!this.get(PAUSED)){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['35'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['100']++;this._initAnimAttr();}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['35'][1]++;}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['101']++;_running[Y.stamp(this)]=this;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['102']++;Y.Anim._startTimer();__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['103']++;this.fire(START);},_pause:function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['20']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['104']++;this._set(START_TIME,null);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['105']++;this._set(PAUSED,true);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['106']++;delete _running[Y.stamp(this)];__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['107']++;this.fire('pause');},_resume:function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['21']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['108']++;this._set(PAUSED,false);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['109']++;_running[Y.stamp(this)]=this;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['110']++;this._set(START_TIME,new Date()-this.get(ELAPSED_TIME));__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['111']++;Y.Anim._startTimer();__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['112']++;this.fire('resume');},_end:function(finish){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['22']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['113']++;var duration=this.get('duration')*1000;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['114']++;if(finish){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['36'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['115']++;this._runAttrs(duration,duration,this.get(REVERSE));}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['36'][1]++;}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['116']++;this._set(START_TIME,null);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['117']++;this._set(ELAPSED_TIME,0);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['118']++;this._set(PAUSED,false);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['119']++;delete _running[Y.stamp(this)];__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['120']++;this.fire(END,{elapsed:this.get(ELAPSED_TIME)});},_runFrame:function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['23']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['121']++;var d=this._runtimeAttr.duration,t=new Date()-this.get(START_TIME),reverse=this.get(REVERSE),done=t>=d;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['122']++;this._runAttrs(t,d,reverse);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['123']++;this._actualFrames+=1;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['124']++;this._set(ELAPSED_TIME,t);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['125']++;this.fire(TWEEN);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['126']++;if(done){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['37'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['127']++;this._lastFrame();}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['37'][1]++;}},_runAttrs:function(t,d,reverse){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['24']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['128']++;var attr=this._runtimeAttr,customAttr=Y.Anim.behaviors,easing=attr.easing,lastFrame=d,done=false,attribute,setter,i;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['129']++;if(t>=d){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['38'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['130']++;done=true;}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['38'][1]++;}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['131']++;if(reverse){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['39'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['132']++;t=d-t;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['133']++;lastFrame=0;}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['39'][1]++;}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['134']++;for(i in attr){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['135']++;if(attr[i].to){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['40'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['136']++;attribute=attr[i];__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['137']++;setter=(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['42'][0]++,i in customAttr)&&(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['42'][1]++,'set'in customAttr[i])?(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['41'][0]++,customAttr[i].set):(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['41'][1]++,Y.Anim.DEFAULT_SETTER);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['138']++;if(!done){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['43'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['139']++;setter(this,i,attribute.from,attribute.to,t,d,easing,attribute.unit);}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['43'][1]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['140']++;setter(this,i,attribute.from,attribute.to,lastFrame,d,easing,attribute.unit);}}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['40'][1]++;}}},_lastFrame:function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['25']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['141']++;var iter=this.get('iterations'),iterCount=this.get(ITERATION_COUNT);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['142']++;iterCount+=1;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['143']++;if((__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['45'][0]++,iter==='infinite')||(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['45'][1]++,iterCount<iter)){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['44'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['144']++;if(this.get('direction')==='alternate'){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['46'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['145']++;this.set(REVERSE,!this.get(REVERSE));}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['46'][1]++;}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['146']++;this.fire('iteration');}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['44'][1]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['147']++;iterCount=0;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['148']++;this._end();}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['149']++;this._set(START_TIME,new Date());__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['150']++;this._set(ITERATION_COUNT,iterCount);},_initAnimAttr:function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['26']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['151']++;var from=(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['47'][0]++,this.get('from'))||(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['47'][1]++,{}),to=(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['48'][0]++,this.get('to'))||(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['48'][1]++,{}),attr={duration:this.get('duration')*1000,easing:this.get('easing')},customAttr=Y.Anim.behaviors,node=this.get(NODE),unit,begin,end;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['152']++;Y.each(to,function(val,name){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['27']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['153']++;if(typeof val==='function'){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['49'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['154']++;val=val.call(this,node);}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['49'][1]++;}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['155']++;begin=from[name];__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['156']++;if(begin===undefined){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['50'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['157']++;begin=(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['52'][0]++,name in customAttr)&&(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['52'][1]++,'get'in customAttr[name])?(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['51'][0]++,customAttr[name].get(this,name)):(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['51'][1]++,Y.Anim.DEFAULT_GETTER(this,name));}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['50'][1]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['158']++;if(typeof begin==='function'){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['53'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['159']++;begin=begin.call(this,node);}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['53'][1]++;}}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['160']++;var mFrom=Y.Anim.RE_UNITS.exec(begin),mTo=Y.Anim.RE_UNITS.exec(val);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['161']++;begin=mFrom?(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['54'][0]++,mFrom[1]):(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['54'][1]++,begin);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['162']++;end=mTo?(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['55'][0]++,mTo[1]):(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['55'][1]++,val);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['163']++;unit=mTo?(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['56'][0]++,mTo[2]):(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['56'][1]++,mFrom?(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['57'][0]++,mFrom[2]):(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['57'][1]++,''));__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['164']++;if((__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['59'][0]++,!unit)&&(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['59'][1]++,Y.Anim.RE_DEFAULT_UNIT.test(name))){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['58'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['165']++;unit=Y.Anim.DEFAULT_UNIT;}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['58'][1]++;}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['166']++;if((__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['61'][0]++,!begin)||(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['61'][1]++,!end)){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['60'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['167']++;Y.error('invalid "from" or "to" for "'+name+'"','Anim');__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['168']++;return;}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['60'][1]++;}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['169']++;attr[name]={from:Y.Lang.isObject(begin)?(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['62'][0]++,Y.clone(begin)):(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['62'][1]++,begin),to:end,unit:unit};},this);__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['170']++;this._runtimeAttr=attr;},_getOffset:function(attr){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['28']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['171']++;var node=this._node,val=node.getComputedStyle(attr),get=attr==='left'?(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['63'][0]++,'getX'):(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['63'][1]++,'getY'),set=attr==='left'?(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['64'][0]++,'setX'):(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['64'][1]++,'setY'),position;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['172']++;if(val==='auto'){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['65'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['173']++;position=node.getStyle('position');__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['174']++;if((__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['67'][0]++,position==='absolute')||(__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['67'][1]++,position==='fixed')){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['66'][0]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['175']++;val=node[get]();__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['176']++;node[set](val);}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['66'][1]++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['177']++;val=0;}}else{__cov_LgJ5P4ZXEcllOMVJL_pLXQ.b['65'][1]++;}__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['178']++;return val;},destructor:function(){__cov_LgJ5P4ZXEcllOMVJL_pLXQ.f['29']++;__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['179']++;delete Y.Anim._instances[Y.stamp(this)];}};__cov_LgJ5P4ZXEcllOMVJL_pLXQ.s['180']++;Y.extend(Y.Anim,Y.Base,proto);},'@VERSION@',{'requires':['base-base','node-style']});
jimmybyrum/cdnjs
ajax/libs/yui/3.13.0/anim-base/anim-base-coverage.js
JavaScript
mit
71,790
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){var d=a("../lib/Angular");b.exports=d},{"../lib/Angular":2}],2:[function(a,b,c){"use strict";var d=window.ForerunnerDB.shared,e={};d.addModule("Angular",e),e.extendCollection=function(a){var b=a.prototype.drop;a.prototype.ng=function(a,b,c){var d,e,f=this;if(!a||!b)throw this.logIdentifier()+" Cannot link to angular $scope if no scope or variable name is passed!";f._ngLinks=f._ngLinks||[],d={scope:a,varName:b,callback:function(){c&&c.$single?a[b]=f.findOne()||{}:a[b]=f.find(),setTimeout(function(){a.$apply()},0)}},f._ngLinks.push(d),a.$on("$destroy",function(){if(f._ngLinks&&f._ngLinks.length)for(e=f._ngLinks.length-1;e>=0;e--)f._ngLinks[e].scope===a&&(f.off("immediateChange",d.callback),f._ngLinks.splice(e,1))}),f.on("immediateChange",d.callback),d.callback&&d.callback()},a.prototype.drop=function(){return this._ngLinks&&delete this._ngLinks,b.apply(this,arguments)}},e.extendView=function(a){var b=a.prototype.drop;a.prototype.ng=function(a,b,c){var d,e,f=this;if(!a||!b)throw this.logIdentifier()+" Cannot link to angular $scope if no scope or variable name is passed!";f._ngLinks=f._ngLinks||[],d={scope:a,varName:b,callback:function(){c&&c.$single?a[b]=f.data().findOne()||{}:a[b]=f.data().find(),setTimeout(function(){a.$apply()},0)}},f._ngLinks.push(d),a.$on("$destroy",function(){if(f._ngLinks&&f._ngLinks.length)for(e=f._ngLinks.length-1;e>=0;e--)f._ngLinks[e].scope===a&&(f.data().off("immediateChange",d.callback),f._ngLinks.splice(e,1))}),f.data().on("immediateChange",function(){d.callback()}),d.callback&&d.callback()},a.prototype.drop=function(){return this._ngLinks&&delete this._ngLinks,b.apply(this,arguments)}},e.extendDocument=function(a){var b=a.prototype.drop;a.prototype.ng=function(a,b,c){var d,e,f=this,g=!1;if(!a||!b)throw this.logIdentifier()+" Cannot link to angular $scope if no scope or variable name is passed!";f._ngLinks=f._ngLinks||[],d={scope:a,varName:b,callback:function(){a[b]=f.find(),setTimeout(function(){a.$apply()},0)}},f._ngLinks.push(d),a.$on("$destroy",function(){if(f._ngLinks&&f._ngLinks.length)for(e=f._ngLinks.length-1;e>=0;e--)f._ngLinks[e].scope===a&&(f.off("change",d.callback),f._ngLinks.splice(e,1))}),a.$watch(b,function(a){g=!0,console.log("Updating",a),f.update({},a),g=!1},!0),f.on("change",function(){g?console.log("Ignoring update as it is a watch update"):d.callback.apply(this,arguments)}),d.callback&&d.callback()},a.prototype.drop=function(){return this._ngLinks&&delete this._ngLinks,b.apply(this,arguments)}},e.extendOverview=function(a){a.prototype.ng=function(a,b,c){this._data.ng.apply(this._data,arguments),this._refresh()}};var f,g=["Collection","View","Overview","Document"],h=function(a,b){e["extend"+a]&&e["extend"+a](b)};for(f=0;f<g.length;f++)d.moduleFinished(g[f],h);"undefined"!=typeof angular&&angular.module&&angular.module("forerunnerdb",[]).factory("$fdb",function(){return new ForerunnerDB}),d.finishModule("Angular"),b.exports=e},{}]},{},[1]);
pombredanne/cdnjs
ajax/libs/forerunnerdb/1.3.705/fdb-angular.min.js
JavaScript
mit
3,398
/* * # Semantic UI - 1.7.3 * https://github.com/Semantic-Org/Semantic-UI * http://www.semantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ .ui.segment{position:relative;background-color:#fff;box-shadow:0 0 0 1px rgba(39,41,43,.15),0 1px 2px 0 rgba(0,0,0,.05);margin:1rem 0;padding:1em;border-radius:.2857rem;border:none}.ui.segment:first-child{margin-top:0}.ui.segment:last-child{margin-bottom:0}.ui.segment:after{content:'';display:block;height:0;clear:both;visibility:hidden}.ui[class*="vertical segment"]{margin:0;padding-left:0;padding-right:0;background-color:transparent;border-radius:0;border:none;box-shadow:0 -1px 0 rgba(39,41,43,.15) inset}.ui[class*="vertical segment"]:last-child{box-shadow:none}.ui[class*="horizontal segment"]{margin:0;padding-top:0;padding-bottom:0;background-color:transparent;border-radius:0;border:none;box-shadow:1px 0 0 rgba(39,41,43,.15)}.ui.inverted.segment>.ui.header{color:#fff}.ui[class*="bottom attached"].segment>[class*="top attached"].label{border-top-left-radius:0;border-top-right-radius:0}.ui[class*="top attached"].segment>[class*="bottom attached"].label{border-bottom-left-radius:0;border-bottom-right-radius:0}.ui.attached.segment:not(.top):not(.bottom)>[class*="top attached"].label{border-top-left-radius:0;border-top-right-radius:0}.ui.attached.segment:not(.top):not(.bottom)>[class*="bottom attached"].label{border-bottom-left-radius:0;border-bottom-right-radius:0}.ui.grid .ui.segment.column,.ui.page.grid.segment{padding-top:2em;padding-bottom:2em}.ui.grid.segment{margin:1rem 0;border-radius:.2857rem}.ui.basic.table.segment{background:#fff;border:none;box-shadow:0 0 0 1px rgba(39,41,43,.15),0 1px 2px 0 rgba(0,0,0,.05)}.ui[class*="very basic"].table.segment{padding:1em}.ui.piled.segment{margin:3em 0;box-shadow:0 0 1px 1px rgba(39,41,43,.15);z-index:auto}.ui.piled.segment:first-child{margin-top:0}.ui.piled.segment:last-child{margin-bottom:0}.ui.piled.segment:after,.ui.piled.segment:before{background-color:#fff;visibility:visible;content:'';display:block;height:100%;left:0;position:absolute;width:100%;box-shadow:0 0 1px 1px rgba(39,41,43,.15)}.ui.piled.segment:after{-webkit-transform:rotate(1.2deg);-ms-transform:rotate(1.2deg);transform:rotate(1.2deg);top:0;z-index:-1}.ui.piled.segment:before{-webkit-transform:rotate(-1.2deg);-ms-transform:rotate(-1.2deg);transform:rotate(-1.2deg);top:0;z-index:-2}.ui[class*="top attached"].piled.segment{margin-top:3em;margin-bottom:0}.ui.piled.segment[class*="top attached"]:first-child{margin-top:0}.ui.piled.segment[class*="bottom attached"]{margin-top:0;margin-bottom:3em}.ui.piled.segment[class*="bottom attached"]:last-child{margin-bottom:0}.ui.stacked.segment{padding-bottom:1.4em}.ui.stacked.segment:after,.ui.stacked.segment:before{content:'';position:absolute;bottom:-3px;left:0;border-top:1px solid rgba(39,41,43,.15);background-color:rgba(0,0,0,.03);width:100%;height:6px;visibility:visible}.ui.stacked.segment:before{display:none}.ui.tall.stacked.segment:before{display:block;bottom:0}.ui.stacked.inverted.segment:after,.ui.stacked.inverted.segment:before{background-color:rgba(0,0,0,.03);border-top:1px solid rgba(39,41,43,.3)}.ui.compact.segment{display:table}.ui.circular.segment{display:table-cell;padding:2em;text-align:center;vertical-align:middle;border-radius:500em}.ui.raised.segment{box-shadow:0 0 0 1px rgba(39,41,43,.15),0 1px 4px 0 rgba(0,0,0,.15)}.ui.disabled.segment{opacity:.3;color:rgba(40,40,40,.3)}.ui.loading.segment{position:relative;cursor:default;point-events:none;text-shadow:none!important;color:transparent!important;-webkit-transition:all 0s linear;transition:all 0s linear}.ui.loading.segment:before{position:absolute;content:'';top:0;left:0;background:rgba(255,255,255,.8);width:100%;height:100%;border-radius:.2857rem;z-index:100}.ui.loading.segment:after{position:absolute;content:'';top:50%;left:50%;margin:-1.5em 0 0 -1.5em;width:3em;height:3em;-webkit-animation:segment-spin .6s linear;animation:segment-spin .6s linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;border-radius:500rem;border-color:#aaa rgba(0,0,0,.1) rgba(0,0,0,.1);border-style:solid;border-width:.2em;box-shadow:0 0 0 1px transparent;visibility:visible;z-index:101}@-webkit-keyframes segment-spin{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes segment-spin{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ui.basic.segment{position:relative;background-color:transparent;box-shadow:none;border-radius:0}.ui.fitted.segment{padding:0}.ui.black.segment:not(.inverted){border-top:2px solid #1b1c1d}.ui.blue.segment:not(.inverted){border-top:2px solid #3b83c0}.ui.green.segment:not(.inverted){border-top:2px solid #5bbd72}.ui.orange.segment:not(.inverted){border-top:2px solid #e07b53}.ui.pink.segment:not(.inverted){border-top:2px solid #d9499a}.ui.purple.segment:not(.inverted){border-top:2px solid #564f8a}.ui.red.segment:not(.inverted){border-top:2px solid #d95c5c}.ui.teal.segment:not(.inverted){border-top:2px solid #00b5ad}.ui.yellow.segment:not(.inverted){border-top:2px solid #f2c61f}.ui.black.segment:not(.inverted):not(.attached),.ui.blue.segment:not(.inverted):not(.attached),.ui.green.segment:not(.inverted):not(.attached),.ui.orange.segment:not(.inverted):not(.attached),.ui.pink.segment:not(.inverted):not(.attached),.ui.purple.segment:not(.inverted):not(.attached),.ui.red.segment:not(.inverted):not(.attached),.ui.teal.segment:not(.inverted):not(.attached),.ui.yellow.segment:not(.inverted):not(.attached){border-top-left-radius:.2857rem!important;border-top-right-radius:.2857rem!important}.ui.inverted.black.segment,.ui.inverted.segment{background-color:#1b1c1d!important;color:#fff!important}.ui.inverted.blue.segment{background-color:#3b83c0!important;color:#fff!important}.ui.inverted.green.segment{background-color:#5bbd72!important;color:#fff!important}.ui.inverted.orange.segment{background-color:#e07b53!important;color:#fff!important}.ui.inverted.pink.segment{background-color:#d9499a!important;color:#fff!important}.ui.inverted.purple.segment{background-color:#564f8a!important;color:#fff!important}.ui.inverted.red.segment{background-color:#d95c5c!important;color:#fff!important}.ui.inverted.teal.segment{background-color:#00b5ad!important;color:#fff!important}.ui.inverted.yellow.segment{background-color:#f2c61f!important;color:#fff!important}.ui[class*="left aligned"].segment{text-align:left}.ui[class*="right aligned"].segment{text-align:right}.ui[class*="center aligned"].segment{text-align:center}.ui.floated.segment,.ui[class*="left floated"].segment{float:left;margin-right:1rem}.ui[class*="right floated"].segment{float:right;margin-left:1rem}.ui.inverted.segment{border:none;box-shadow:none}.ui.inverted.segment .segment{color:rgba(0,0,0,.8)}.ui.inverted.segment .inverted.segment{color:#fff}.ui.inverted.segment,.ui.primary.inverted.segment{background-color:#1b1c1d;color:#fff}.ui.inverted.attached.segment,.ui.inverted.block.segment{border-color:#555}.ui.secondary.segment{background:#faf9fa;color:rgba(0,0,0,.8)}.ui.tertiary.segment{background:#ebebeb;color:rgba(0,0,0,.8)}.ui.secondary.inverted.segment{background:-webkit-linear-gradient(rgba(255,255,255,.3) 0,rgba(255,255,255,.3) 100%);background:linear-gradient(rgba(255,255,255,.3) 0,rgba(255,255,255,.3) 100%);color:#fafafa}.ui.tertiary.inverted.segment{background:-webkit-linear-gradient(rgba(255,255,255,.5) 0,rgba(255,255,255,.5) 100%);background:linear-gradient(rgba(255,255,255,.5) 0,rgba(255,255,255,.5) 100%);color:#f0f0f0}.ui.segment.attached{top:0;bottom:0;margin:0 -1px;width:-webkit-calc(100% + 2px);width:calc(100% + 2px);max-width:-webkit-calc(100% + 2px);max-width:calc(100% + 2px);border-radius:0;box-shadow:none;border:1px solid #d4d4d5}.ui.segment.attached+.ui.segment.attached:not(.top){border-top:none}.ui[class*="top attached"].segment{top:0;bottom:0;margin-top:1rem;margin-bottom:0;border-radius:.2857rem .2857rem 0 0}.ui.segment[class*="top attached"]:first-child{margin-top:0}.ui.segment[class*="bottom attached"]{top:0;bottom:0;margin-top:0;margin-bottom:1rem;box-shadow:none,0 1px 2px 0 rgba(0,0,0,.05);border-radius:0 0 .2857rem .2857rem}.ui.segment[class*="bottom attached"]:last-child{margin-bottom:0}
vvo/jsdelivr
files/semantic-ui/1.7.3/components/segment.min.css
CSS
mit
8,419
/** * Copyright 2014 Tim Down. * * 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. */ if(!Array.prototype.push){Array.prototype.push=function(){for(var i=0,len=arguments.length;i<len;i++){this[this.length]=arguments[i];} return this.length;};} if(!Array.prototype.shift){Array.prototype.shift=function(){if(this.length>0){var firstItem=this[0];for(var i=0,len=this.length-1;i<len;i++){this[i]=this[i+1];} this.length=this.length-1;return firstItem;}};} if(!Array.prototype.splice){Array.prototype.splice=function(startIndex,deleteCount){var itemsAfterDeleted=this.slice(startIndex+deleteCount);var itemsDeleted=this.slice(startIndex,startIndex+deleteCount);this.length=startIndex;var argumentsArray=[];for(var i=0,len=arguments.length;i<len;i++){argumentsArray[i]=arguments[i];} var itemsToAppend=(argumentsArray.length>2)?itemsAfterDeleted=argumentsArray.slice(2).concat(itemsAfterDeleted):itemsAfterDeleted;for(i=0,len=itemsToAppend.length;i<len;i++){this.push(itemsToAppend[i]);} return itemsDeleted;};} var log4javascript=(function(){function isUndefined(obj){return typeof obj=="undefined";} function EventSupport(){} EventSupport.prototype={eventTypes:[],eventListeners:{},setEventTypes:function(eventTypesParam){if(eventTypesParam instanceof Array){this.eventTypes=eventTypesParam;this.eventListeners={};for(var i=0,len=this.eventTypes.length;i<len;i++){this.eventListeners[this.eventTypes[i]]=[];}}else{handleError("log4javascript.EventSupport ["+this+"]: setEventTypes: eventTypes parameter must be an Array");}},addEventListener:function(eventType,listener){if(typeof listener=="function"){if(!array_contains(this.eventTypes,eventType)){handleError("log4javascript.EventSupport ["+this+"]: addEventListener: no event called '"+eventType+"'");} this.eventListeners[eventType].push(listener);}else{handleError("log4javascript.EventSupport ["+this+"]: addEventListener: listener must be a function");}},removeEventListener:function(eventType,listener){if(typeof listener=="function"){if(!array_contains(this.eventTypes,eventType)){handleError("log4javascript.EventSupport ["+this+"]: removeEventListener: no event called '"+eventType+"'");} array_remove(this.eventListeners[eventType],listener);}else{handleError("log4javascript.EventSupport ["+this+"]: removeEventListener: listener must be a function");}},dispatchEvent:function(eventType,eventArgs){if(array_contains(this.eventTypes,eventType)){var listeners=this.eventListeners[eventType];for(var i=0,len=listeners.length;i<len;i++){listeners[i](this,eventType,eventArgs);}}else{handleError("log4javascript.EventSupport ["+this+"]: dispatchEvent: no event called '"+eventType+"'");}}};var applicationStartDate=new Date();var uniqueId="log4javascript_"+applicationStartDate.getTime()+"_"+ Math.floor(Math.random()*100000000);var emptyFunction=function(){};var newLine="\r\n";var pageLoaded=false;function Log4JavaScript(){} Log4JavaScript.prototype=new EventSupport();log4javascript=new Log4JavaScript();log4javascript.version="1.4.9";log4javascript.edition="log4javascript_production";function toStr(obj){if(obj&&obj.toString){return obj.toString();}else{return String(obj);}} function getExceptionMessage(ex){if(ex.message){return ex.message;}else if(ex.description){return ex.description;}else{return toStr(ex);}} function getUrlFileName(url){var lastSlashIndex=Math.max(url.lastIndexOf("/"),url.lastIndexOf("\\"));return url.substr(lastSlashIndex+1);} function getExceptionStringRep(ex){if(ex){var exStr="Exception: "+getExceptionMessage(ex);try{if(ex.lineNumber){exStr+=" on line number "+ex.lineNumber;} if(ex.fileName){exStr+=" in file "+getUrlFileName(ex.fileName);}}catch(localEx){logLog.warn("Unable to obtain file and line information for error");} if(showStackTraces&&ex.stack){exStr+=newLine+"Stack trace:"+newLine+ex.stack;} return exStr;} return null;} function bool(obj){return Boolean(obj);} function trim(str){return str.replace(/^\s+/,"").replace(/\s+$/,"");} function splitIntoLines(text){var text2=text.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return text2.split("\n");} var urlEncode=(typeof window.encodeURIComponent!="undefined")?function(str){return encodeURIComponent(str);}:function(str){return escape(str).replace(/\+/g,"%2B").replace(/"/g,"%22").replace(/'/g,"%27").replace(/\//g,"%2F").replace(/=/g,"%3D");};var urlDecode=(typeof window.decodeURIComponent!="undefined")?function(str){return decodeURIComponent(str);}:function(str){return unescape(str).replace(/%2B/g,"+").replace(/%22/g,"\"").replace(/%27/g,"'").replace(/%2F/g,"/").replace(/%3D/g,"=");};function array_remove(arr,val){var index=-1;for(var i=0,len=arr.length;i<len;i++){if(arr[i]===val){index=i;break;}} if(index>=0){arr.splice(index,1);return true;}else{return false;}} function array_contains(arr,val){for(var i=0,len=arr.length;i<len;i++){if(arr[i]==val){return true;}} return false;} function extractBooleanFromParam(param,defaultValue){if(isUndefined(param)){return defaultValue;}else{return bool(param);}} function extractStringFromParam(param,defaultValue){if(isUndefined(param)){return defaultValue;}else{return String(param);}} function extractIntFromParam(param,defaultValue){if(isUndefined(param)){return defaultValue;}else{try{var value=parseInt(param,10);return isNaN(value)?defaultValue:value;}catch(ex){logLog.warn("Invalid int param "+param,ex);return defaultValue;}}} function extractFunctionFromParam(param,defaultValue){if(typeof param=="function"){return param;}else{return defaultValue;}} function isError(err){return(err instanceof Error);} if(!Function.prototype.apply){Function.prototype.apply=function(obj,args){var methodName="__apply__";if(typeof obj[methodName]!="undefined"){methodName+=String(Math.random()).substr(2);} obj[methodName]=this;var argsStrings=[];for(var i=0,len=args.length;i<len;i++){argsStrings[i]="args["+i+"]";} var script="obj."+methodName+"("+argsStrings.join(",")+")";var returnValue=eval(script);delete obj[methodName];return returnValue;};} if(!Function.prototype.call){Function.prototype.call=function(obj){var args=[];for(var i=1,len=arguments.length;i<len;i++){args[i-1]=arguments[i];} return this.apply(obj,args);};} function getListenersPropertyName(eventName){return"__log4javascript_listeners__"+eventName;} function addEvent(node,eventName,listener,useCapture,win){win=win?win:window;if(node.addEventListener){node.addEventListener(eventName,listener,useCapture);}else if(node.attachEvent){node.attachEvent("on"+eventName,listener);}else{var propertyName=getListenersPropertyName(eventName);if(!node[propertyName]){node[propertyName]=[];node["on"+eventName]=function(evt){evt=getEvent(evt,win);var listenersPropertyName=getListenersPropertyName(eventName);var listeners=this[listenersPropertyName].concat([]);var currentListener;while((currentListener=listeners.shift())){currentListener.call(this,evt);}};} node[propertyName].push(listener);}} function removeEvent(node,eventName,listener,useCapture){if(node.removeEventListener){node.removeEventListener(eventName,listener,useCapture);}else if(node.detachEvent){node.detachEvent("on"+eventName,listener);}else{var propertyName=getListenersPropertyName(eventName);if(node[propertyName]){array_remove(node[propertyName],listener);}}} function getEvent(evt,win){win=win?win:window;return evt?evt:win.event;} function stopEventPropagation(evt){if(evt.stopPropagation){evt.stopPropagation();}else if(typeof evt.cancelBubble!="undefined"){evt.cancelBubble=true;} evt.returnValue=false;} var logLog={quietMode:false,debugMessages:[],setQuietMode:function(quietMode){this.quietMode=bool(quietMode);},numberOfErrors:0,alertAllErrors:false,setAlertAllErrors:function(alertAllErrors){this.alertAllErrors=alertAllErrors;},debug:function(message){this.debugMessages.push(message);},displayDebug:function(){alert(this.debugMessages.join(newLine));},warn:function(message,exception){},error:function(message,exception){if(++this.numberOfErrors==1||this.alertAllErrors){if(!this.quietMode){var alertMessage="log4javascript error: "+message;if(exception){alertMessage+=newLine+newLine+"Original error: "+getExceptionStringRep(exception);} alert(alertMessage);}}}};log4javascript.logLog=logLog;log4javascript.setEventTypes(["load","error"]);function handleError(message,exception){logLog.error(message,exception);log4javascript.dispatchEvent("error",{"message":message,"exception":exception});} log4javascript.handleError=handleError;var enabled=!((typeof log4javascript_disabled!="undefined")&&log4javascript_disabled);log4javascript.setEnabled=function(enable){enabled=bool(enable);};log4javascript.isEnabled=function(){return enabled;};var useTimeStampsInMilliseconds=true;log4javascript.setTimeStampsInMilliseconds=function(timeStampsInMilliseconds){useTimeStampsInMilliseconds=bool(timeStampsInMilliseconds);};log4javascript.isTimeStampsInMilliseconds=function(){return useTimeStampsInMilliseconds;};log4javascript.evalInScope=function(expr){return eval(expr);};var showStackTraces=false;log4javascript.setShowStackTraces=function(show){showStackTraces=bool(show);};var Level=function(level,name){this.level=level;this.name=name;};Level.prototype={toString:function(){return this.name;},equals:function(level){return this.level==level.level;},isGreaterOrEqual:function(level){return this.level>=level.level;}};Level.ALL=new Level(Number.MIN_VALUE,"ALL");Level.TRACE=new Level(10000,"TRACE");Level.DEBUG=new Level(20000,"DEBUG");Level.INFO=new Level(30000,"INFO");Level.WARN=new Level(40000,"WARN");Level.ERROR=new Level(50000,"ERROR");Level.FATAL=new Level(60000,"FATAL");Level.OFF=new Level(Number.MAX_VALUE,"OFF");log4javascript.Level=Level;function Timer(name,level){this.name=name;this.level=isUndefined(level)?Level.INFO:level;this.start=new Date();} Timer.prototype.getElapsedTime=function(){return new Date().getTime()-this.start.getTime();};var anonymousLoggerName="[anonymous]";var defaultLoggerName="[default]";var nullLoggerName="[null]";var rootLoggerName="root";function Logger(name){this.name=name;this.parent=null;this.children=[];var appenders=[];var loggerLevel=null;var isRoot=(this.name===rootLoggerName);var isNull=(this.name===nullLoggerName);var appenderCache=null;var appenderCacheInvalidated=false;this.addChild=function(childLogger){this.children.push(childLogger);childLogger.parent=this;childLogger.invalidateAppenderCache();};var additive=true;this.getAdditivity=function(){return additive;};this.setAdditivity=function(additivity){var valueChanged=(additive!=additivity);additive=additivity;if(valueChanged){this.invalidateAppenderCache();}};this.addAppender=function(appender){if(isNull){handleError("Logger.addAppender: you may not add an appender to the null logger");}else{if(appender instanceof log4javascript.Appender){if(!array_contains(appenders,appender)){appenders.push(appender);appender.setAddedToLogger(this);this.invalidateAppenderCache();}}else{handleError("Logger.addAppender: appender supplied ('"+ toStr(appender)+"') is not a subclass of Appender");}}};this.removeAppender=function(appender){array_remove(appenders,appender);appender.setRemovedFromLogger(this);this.invalidateAppenderCache();};this.removeAllAppenders=function(){var appenderCount=appenders.length;if(appenderCount>0){for(var i=0;i<appenderCount;i++){appenders[i].setRemovedFromLogger(this);} appenders.length=0;this.invalidateAppenderCache();}};this.getEffectiveAppenders=function(){if(appenderCache===null||appenderCacheInvalidated){var parentEffectiveAppenders=(isRoot||!this.getAdditivity())?[]:this.parent.getEffectiveAppenders();appenderCache=parentEffectiveAppenders.concat(appenders);appenderCacheInvalidated=false;} return appenderCache;};this.invalidateAppenderCache=function(){appenderCacheInvalidated=true;for(var i=0,len=this.children.length;i<len;i++){this.children[i].invalidateAppenderCache();}};this.log=function(level,params){if(enabled&&level.isGreaterOrEqual(this.getEffectiveLevel())){var exception;var finalParamIndex=params.length-1;var lastParam=params[finalParamIndex];if(params.length>1&&isError(lastParam)){exception=lastParam;finalParamIndex--;} var messages=[];for(var i=0;i<=finalParamIndex;i++){messages[i]=params[i];} var loggingEvent=new LoggingEvent(this,new Date(),level,messages,exception);this.callAppenders(loggingEvent);}};this.callAppenders=function(loggingEvent){var effectiveAppenders=this.getEffectiveAppenders();for(var i=0,len=effectiveAppenders.length;i<len;i++){effectiveAppenders[i].doAppend(loggingEvent);}};this.setLevel=function(level){if(isRoot&&level===null){handleError("Logger.setLevel: you cannot set the level of the root logger to null");}else if(level instanceof Level){loggerLevel=level;}else{handleError("Logger.setLevel: level supplied to logger "+ this.name+" is not an instance of log4javascript.Level");}};this.getLevel=function(){return loggerLevel;};this.getEffectiveLevel=function(){for(var logger=this;logger!==null;logger=logger.parent){var level=logger.getLevel();if(level!==null){return level;}}};this.group=function(name,initiallyExpanded){if(enabled){var effectiveAppenders=this.getEffectiveAppenders();for(var i=0,len=effectiveAppenders.length;i<len;i++){effectiveAppenders[i].group(name,initiallyExpanded);}}};this.groupEnd=function(){if(enabled){var effectiveAppenders=this.getEffectiveAppenders();for(var i=0,len=effectiveAppenders.length;i<len;i++){effectiveAppenders[i].groupEnd();}}};var timers={};this.time=function(name,level){if(enabled){if(isUndefined(name)){handleError("Logger.time: a name for the timer must be supplied");}else if(level&&!(level instanceof Level)){handleError("Logger.time: level supplied to timer "+ name+" is not an instance of log4javascript.Level");}else{timers[name]=new Timer(name,level);}}};this.timeEnd=function(name){if(enabled){if(isUndefined(name)){handleError("Logger.timeEnd: a name for the timer must be supplied");}else if(timers[name]){var timer=timers[name];var milliseconds=timer.getElapsedTime();this.log(timer.level,["Timer "+toStr(name)+" completed in "+milliseconds+"ms"]);delete timers[name];}else{logLog.warn("Logger.timeEnd: no timer found with name "+name);}}};this.assert=function(expr){if(enabled&&!expr){var args=[];for(var i=1,len=arguments.length;i<len;i++){args.push(arguments[i]);} args=(args.length>0)?args:["Assertion Failure"];args.push(newLine);args.push(expr);this.log(Level.ERROR,args);}};this.toString=function(){return"Logger["+this.name+"]";};} Logger.prototype={trace:function(){this.log(Level.TRACE,arguments);},debug:function(){this.log(Level.DEBUG,arguments);},info:function(){this.log(Level.INFO,arguments);},warn:function(){this.log(Level.WARN,arguments);},error:function(){this.log(Level.ERROR,arguments);},fatal:function(){this.log(Level.FATAL,arguments);},isEnabledFor:function(level){return level.isGreaterOrEqual(this.getEffectiveLevel());},isTraceEnabled:function(){return this.isEnabledFor(Level.TRACE);},isDebugEnabled:function(){return this.isEnabledFor(Level.DEBUG);},isInfoEnabled:function(){return this.isEnabledFor(Level.INFO);},isWarnEnabled:function(){return this.isEnabledFor(Level.WARN);},isErrorEnabled:function(){return this.isEnabledFor(Level.ERROR);},isFatalEnabled:function(){return this.isEnabledFor(Level.FATAL);}};Logger.prototype.trace.isEntryPoint=true;Logger.prototype.debug.isEntryPoint=true;Logger.prototype.info.isEntryPoint=true;Logger.prototype.warn.isEntryPoint=true;Logger.prototype.error.isEntryPoint=true;Logger.prototype.fatal.isEntryPoint=true;var loggers={};var loggerNames=[];var ROOT_LOGGER_DEFAULT_LEVEL=Level.DEBUG;var rootLogger=new Logger(rootLoggerName);rootLogger.setLevel(ROOT_LOGGER_DEFAULT_LEVEL);log4javascript.getRootLogger=function(){return rootLogger;};log4javascript.getLogger=function(loggerName){if(!(typeof loggerName=="string")){loggerName=anonymousLoggerName;logLog.warn("log4javascript.getLogger: non-string logger name "+ toStr(loggerName)+" supplied, returning anonymous logger");} if(loggerName==rootLoggerName){handleError("log4javascript.getLogger: root logger may not be obtained by name");} if(!loggers[loggerName]){var logger=new Logger(loggerName);loggers[loggerName]=logger;loggerNames.push(loggerName);var lastDotIndex=loggerName.lastIndexOf(".");var parentLogger;if(lastDotIndex>-1){var parentLoggerName=loggerName.substring(0,lastDotIndex);parentLogger=log4javascript.getLogger(parentLoggerName);}else{parentLogger=rootLogger;} parentLogger.addChild(logger);} return loggers[loggerName];};var defaultLogger=null;log4javascript.getDefaultLogger=function(){if(!defaultLogger){defaultLogger=log4javascript.getLogger(defaultLoggerName);var a=new log4javascript.PopUpAppender();defaultLogger.addAppender(a);} return defaultLogger;};var nullLogger=null;log4javascript.getNullLogger=function(){if(!nullLogger){nullLogger=new Logger(nullLoggerName);nullLogger.setLevel(Level.OFF);} return nullLogger;};log4javascript.resetConfiguration=function(){rootLogger.setLevel(ROOT_LOGGER_DEFAULT_LEVEL);loggers={};};var LoggingEvent=function(logger,timeStamp,level,messages,exception){this.logger=logger;this.timeStamp=timeStamp;this.timeStampInMilliseconds=timeStamp.getTime();this.timeStampInSeconds=Math.floor(this.timeStampInMilliseconds/1000);this.milliseconds=this.timeStamp.getMilliseconds();this.level=level;this.messages=messages;this.exception=exception;};LoggingEvent.prototype={getThrowableStrRep:function(){return this.exception?getExceptionStringRep(this.exception):"";},getCombinedMessages:function(){return(this.messages.length==1)?this.messages[0]:this.messages.join(newLine);},toString:function(){return"LoggingEvent["+this.level+"]";}};log4javascript.LoggingEvent=LoggingEvent;var Layout=function(){};Layout.prototype={defaults:{loggerKey:"logger",timeStampKey:"timestamp",millisecondsKey:"milliseconds",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url"},loggerKey:"logger",timeStampKey:"timestamp",millisecondsKey:"milliseconds",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url",batchHeader:"",batchFooter:"",batchSeparator:"",returnsPostData:false,overrideTimeStampsSetting:false,useTimeStampsInMilliseconds:null,format:function(){handleError("Layout.format: layout supplied has no format() method");},ignoresThrowable:function(){handleError("Layout.ignoresThrowable: layout supplied has no ignoresThrowable() method");},getContentType:function(){return"text/plain";},allowBatching:function(){return true;},setTimeStampsInMilliseconds:function(timeStampsInMilliseconds){this.overrideTimeStampsSetting=true;this.useTimeStampsInMilliseconds=bool(timeStampsInMilliseconds);},isTimeStampsInMilliseconds:function(){return this.overrideTimeStampsSetting?this.useTimeStampsInMilliseconds:useTimeStampsInMilliseconds;},getTimeStampValue:function(loggingEvent){return this.isTimeStampsInMilliseconds()?loggingEvent.timeStampInMilliseconds:loggingEvent.timeStampInSeconds;},getDataValues:function(loggingEvent,combineMessages){var dataValues=[[this.loggerKey,loggingEvent.logger.name],[this.timeStampKey,this.getTimeStampValue(loggingEvent)],[this.levelKey,loggingEvent.level.name],[this.urlKey,window.location.href],[this.messageKey,combineMessages?loggingEvent.getCombinedMessages():loggingEvent.messages]];if(!this.isTimeStampsInMilliseconds()){dataValues.push([this.millisecondsKey,loggingEvent.milliseconds]);} if(loggingEvent.exception){dataValues.push([this.exceptionKey,getExceptionStringRep(loggingEvent.exception)]);} if(this.hasCustomFields()){for(var i=0,len=this.customFields.length;i<len;i++){var val=this.customFields[i].value;if(typeof val==="function"){val=val(this,loggingEvent);} dataValues.push([this.customFields[i].name,val]);}} return dataValues;},setKeys:function(loggerKey,timeStampKey,levelKey,messageKey,exceptionKey,urlKey,millisecondsKey){this.loggerKey=extractStringFromParam(loggerKey,this.defaults.loggerKey);this.timeStampKey=extractStringFromParam(timeStampKey,this.defaults.timeStampKey);this.levelKey=extractStringFromParam(levelKey,this.defaults.levelKey);this.messageKey=extractStringFromParam(messageKey,this.defaults.messageKey);this.exceptionKey=extractStringFromParam(exceptionKey,this.defaults.exceptionKey);this.urlKey=extractStringFromParam(urlKey,this.defaults.urlKey);this.millisecondsKey=extractStringFromParam(millisecondsKey,this.defaults.millisecondsKey);},setCustomField:function(name,value){var fieldUpdated=false;for(var i=0,len=this.customFields.length;i<len;i++){if(this.customFields[i].name===name){this.customFields[i].value=value;fieldUpdated=true;}} if(!fieldUpdated){this.customFields.push({"name":name,"value":value});}},hasCustomFields:function(){return(this.customFields.length>0);},formatWithException:function(loggingEvent){var formatted=this.format(loggingEvent);if(loggingEvent.exception&&this.ignoresThrowable()){formatted+=loggingEvent.getThrowableStrRep();} return formatted;},toString:function(){handleError("Layout.toString: all layouts must override this method");}};log4javascript.Layout=Layout;var Appender=function(){};Appender.prototype=new EventSupport();Appender.prototype.layout=new PatternLayout();Appender.prototype.threshold=Level.ALL;Appender.prototype.loggers=[];Appender.prototype.doAppend=function(loggingEvent){if(enabled&&loggingEvent.level.level>=this.threshold.level){this.append(loggingEvent);}};Appender.prototype.append=function(loggingEvent){};Appender.prototype.setLayout=function(layout){if(layout instanceof Layout){this.layout=layout;}else{handleError("Appender.setLayout: layout supplied to "+ this.toString()+" is not a subclass of Layout");}};Appender.prototype.getLayout=function(){return this.layout;};Appender.prototype.setThreshold=function(threshold){if(threshold instanceof Level){this.threshold=threshold;}else{handleError("Appender.setThreshold: threshold supplied to "+ this.toString()+" is not a subclass of Level");}};Appender.prototype.getThreshold=function(){return this.threshold;};Appender.prototype.setAddedToLogger=function(logger){this.loggers.push(logger);};Appender.prototype.setRemovedFromLogger=function(logger){array_remove(this.loggers,logger);};Appender.prototype.group=emptyFunction;Appender.prototype.groupEnd=emptyFunction;Appender.prototype.toString=function(){handleError("Appender.toString: all appenders must override this method");};log4javascript.Appender=Appender;function SimpleLayout(){this.customFields=[];} SimpleLayout.prototype=new Layout();SimpleLayout.prototype.format=function(loggingEvent){return loggingEvent.level.name+" - "+loggingEvent.getCombinedMessages();};SimpleLayout.prototype.ignoresThrowable=function(){return true;};SimpleLayout.prototype.toString=function(){return"SimpleLayout";};log4javascript.SimpleLayout=SimpleLayout;function NullLayout(){this.customFields=[];} NullLayout.prototype=new Layout();NullLayout.prototype.format=function(loggingEvent){return loggingEvent.messages;};NullLayout.prototype.ignoresThrowable=function(){return true;};NullLayout.prototype.formatWithException=function(loggingEvent){var messages=loggingEvent.messages,ex=loggingEvent.exception;return ex?messages.concat([ex]):messages;};NullLayout.prototype.toString=function(){return"NullLayout";};log4javascript.NullLayout=NullLayout;function XmlLayout(combineMessages){this.combineMessages=extractBooleanFromParam(combineMessages,true);this.customFields=[];} XmlLayout.prototype=new Layout();XmlLayout.prototype.isCombinedMessages=function(){return this.combineMessages;};XmlLayout.prototype.getContentType=function(){return"text/xml";};XmlLayout.prototype.escapeCdata=function(str){return str.replace(/\]\]>/,"]]>]]&gt;<![CDATA[");};XmlLayout.prototype.format=function(loggingEvent){var layout=this;var i,len;function formatMessage(message){message=(typeof message==="string")?message:toStr(message);return"<log4javascript:message><![CDATA["+ layout.escapeCdata(message)+"]]></log4javascript:message>";} var str="<log4javascript:event logger=\""+loggingEvent.logger.name+"\" timestamp=\""+this.getTimeStampValue(loggingEvent)+"\"";if(!this.isTimeStampsInMilliseconds()){str+=" milliseconds=\""+loggingEvent.milliseconds+"\"";} str+=" level=\""+loggingEvent.level.name+"\">"+newLine;if(this.combineMessages){str+=formatMessage(loggingEvent.getCombinedMessages());}else{str+="<log4javascript:messages>"+newLine;for(i=0,len=loggingEvent.messages.length;i<len;i++){str+=formatMessage(loggingEvent.messages[i])+newLine;} str+="</log4javascript:messages>"+newLine;} if(this.hasCustomFields()){for(i=0,len=this.customFields.length;i<len;i++){str+="<log4javascript:customfield name=\""+ this.customFields[i].name+"\"><![CDATA["+ this.customFields[i].value.toString()+"]]></log4javascript:customfield>"+newLine;}} if(loggingEvent.exception){str+="<log4javascript:exception><![CDATA["+ getExceptionStringRep(loggingEvent.exception)+"]]></log4javascript:exception>"+newLine;} str+="</log4javascript:event>"+newLine+newLine;return str;};XmlLayout.prototype.ignoresThrowable=function(){return false;};XmlLayout.prototype.toString=function(){return"XmlLayout";};log4javascript.XmlLayout=XmlLayout;function escapeNewLines(str){return str.replace(/\r\n|\r|\n/g,"\\r\\n");} function JsonLayout(readable,combineMessages){this.readable=extractBooleanFromParam(readable,false);this.combineMessages=extractBooleanFromParam(combineMessages,true);this.batchHeader=this.readable?"["+newLine:"[";this.batchFooter=this.readable?"]"+newLine:"]";this.batchSeparator=this.readable?","+newLine:",";this.setKeys();this.colon=this.readable?": ":":";this.tab=this.readable?"\t":"";this.lineBreak=this.readable?newLine:"";this.customFields=[];} JsonLayout.prototype=new Layout();JsonLayout.prototype.isReadable=function(){return this.readable;};JsonLayout.prototype.isCombinedMessages=function(){return this.combineMessages;};JsonLayout.prototype.format=function(loggingEvent){var layout=this;var dataValues=this.getDataValues(loggingEvent,this.combineMessages);var str="{"+this.lineBreak;var i,len;function formatValue(val,prefix,expand){var formattedValue;var valType=typeof val;if(val instanceof Date){formattedValue=String(val.getTime());}else if(expand&&(val instanceof Array)){formattedValue="["+layout.lineBreak;for(var i=0,len=val.length;i<len;i++){var childPrefix=prefix+layout.tab;formattedValue+=childPrefix+formatValue(val[i],childPrefix,false);if(i<val.length-1){formattedValue+=",";} formattedValue+=layout.lineBreak;} formattedValue+=prefix+"]";}else if(valType!=="number"&&valType!=="boolean"){formattedValue="\""+escapeNewLines(toStr(val).replace(/\"/g,"\\\""))+"\"";}else{formattedValue=val;} return formattedValue;} for(i=0,len=dataValues.length-1;i<=len;i++){str+=this.tab+"\""+dataValues[i][0]+"\""+this.colon+formatValue(dataValues[i][1],this.tab,true);if(i<len){str+=",";} str+=this.lineBreak;} str+="}"+this.lineBreak;return str;};JsonLayout.prototype.ignoresThrowable=function(){return false;};JsonLayout.prototype.toString=function(){return"JsonLayout";};JsonLayout.prototype.getContentType=function(){return"application/json";};log4javascript.JsonLayout=JsonLayout;function HttpPostDataLayout(){this.setKeys();this.customFields=[];this.returnsPostData=true;} HttpPostDataLayout.prototype=new Layout();HttpPostDataLayout.prototype.allowBatching=function(){return false;};HttpPostDataLayout.prototype.format=function(loggingEvent){var dataValues=this.getDataValues(loggingEvent);var queryBits=[];for(var i=0,len=dataValues.length;i<len;i++){var val=(dataValues[i][1]instanceof Date)?String(dataValues[i][1].getTime()):dataValues[i][1];queryBits.push(urlEncode(dataValues[i][0])+"="+urlEncode(val));} return queryBits.join("&");};HttpPostDataLayout.prototype.ignoresThrowable=function(loggingEvent){return false;};HttpPostDataLayout.prototype.toString=function(){return"HttpPostDataLayout";};log4javascript.HttpPostDataLayout=HttpPostDataLayout;function formatObjectExpansion(obj,depth,indentation){var objectsExpanded=[];function doFormat(obj,depth,indentation){var i,j,len,childDepth,childIndentation,childLines,expansion,childExpansion;if(!indentation){indentation="";} function formatString(text){var lines=splitIntoLines(text);for(var j=1,jLen=lines.length;j<jLen;j++){lines[j]=indentation+lines[j];} return lines.join(newLine);} if(obj===null){return"null";}else if(typeof obj=="undefined"){return"undefined";}else if(typeof obj=="string"){return formatString(obj);}else if(typeof obj=="object"&&array_contains(objectsExpanded,obj)){try{expansion=toStr(obj);}catch(ex){expansion="Error formatting property. Details: "+getExceptionStringRep(ex);} return expansion+" [already expanded]";}else if((obj instanceof Array)&&depth>0){objectsExpanded.push(obj);expansion="["+newLine;childDepth=depth-1;childIndentation=indentation+" ";childLines=[];for(i=0,len=obj.length;i<len;i++){try{childExpansion=doFormat(obj[i],childDepth,childIndentation);childLines.push(childIndentation+childExpansion);}catch(ex){childLines.push(childIndentation+"Error formatting array member. Details: "+ getExceptionStringRep(ex)+"");}} expansion+=childLines.join(","+newLine)+newLine+indentation+"]";return expansion;}else if(Object.prototype.toString.call(obj)=="[object Date]"){return obj.toString();}else if(typeof obj=="object"&&depth>0){objectsExpanded.push(obj);expansion="{"+newLine;childDepth=depth-1;childIndentation=indentation+" ";childLines=[];for(i in obj){try{childExpansion=doFormat(obj[i],childDepth,childIndentation);childLines.push(childIndentation+i+": "+childExpansion);}catch(ex){childLines.push(childIndentation+i+": Error formatting property. Details: "+ getExceptionStringRep(ex));}} expansion+=childLines.join(","+newLine)+newLine+indentation+"}";return expansion;}else{return formatString(toStr(obj));}} return doFormat(obj,depth,indentation);} var SimpleDateFormat;(function(){var regex=/('[^']*')|(G+|y+|M+|w+|W+|D+|d+|F+|E+|a+|H+|k+|K+|h+|m+|s+|S+|Z+)|([a-zA-Z]+)|([^a-zA-Z']+)/;var monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];var dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var TEXT2=0,TEXT3=1,NUMBER=2,YEAR=3,MONTH=4,TIMEZONE=5;var types={G:TEXT2,y:YEAR,M:MONTH,w:NUMBER,W:NUMBER,D:NUMBER,d:NUMBER,F:NUMBER,E:TEXT3,a:TEXT2,H:NUMBER,k:NUMBER,K:NUMBER,h:NUMBER,m:NUMBER,s:NUMBER,S:NUMBER,Z:TIMEZONE};var ONE_DAY=24*60*60*1000;var ONE_WEEK=7*ONE_DAY;var DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK=1;var newDateAtMidnight=function(year,month,day){var d=new Date(year,month,day,0,0,0);d.setMilliseconds(0);return d;};Date.prototype.getDifference=function(date){return this.getTime()-date.getTime();};Date.prototype.isBefore=function(d){return this.getTime()<d.getTime();};Date.prototype.getUTCTime=function(){return Date.UTC(this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds(),this.getMilliseconds());};Date.prototype.getTimeSince=function(d){return this.getUTCTime()-d.getUTCTime();};Date.prototype.getPreviousSunday=function(){var midday=new Date(this.getFullYear(),this.getMonth(),this.getDate(),12,0,0);var previousSunday=new Date(midday.getTime()-this.getDay()*ONE_DAY);return newDateAtMidnight(previousSunday.getFullYear(),previousSunday.getMonth(),previousSunday.getDate());};Date.prototype.getWeekInYear=function(minimalDaysInFirstWeek){if(isUndefined(this.minimalDaysInFirstWeek)){minimalDaysInFirstWeek=DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK;} var previousSunday=this.getPreviousSunday();var startOfYear=newDateAtMidnight(this.getFullYear(),0,1);var numberOfSundays=previousSunday.isBefore(startOfYear)?0:1+Math.floor(previousSunday.getTimeSince(startOfYear)/ONE_WEEK);var numberOfDaysInFirstWeek=7-startOfYear.getDay();var weekInYear=numberOfSundays;if(numberOfDaysInFirstWeek<minimalDaysInFirstWeek){weekInYear--;} return weekInYear;};Date.prototype.getWeekInMonth=function(minimalDaysInFirstWeek){if(isUndefined(this.minimalDaysInFirstWeek)){minimalDaysInFirstWeek=DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK;} var previousSunday=this.getPreviousSunday();var startOfMonth=newDateAtMidnight(this.getFullYear(),this.getMonth(),1);var numberOfSundays=previousSunday.isBefore(startOfMonth)?0:1+Math.floor(previousSunday.getTimeSince(startOfMonth)/ONE_WEEK);var numberOfDaysInFirstWeek=7-startOfMonth.getDay();var weekInMonth=numberOfSundays;if(numberOfDaysInFirstWeek>=minimalDaysInFirstWeek){weekInMonth++;} return weekInMonth;};Date.prototype.getDayInYear=function(){var startOfYear=newDateAtMidnight(this.getFullYear(),0,1);return 1+Math.floor(this.getTimeSince(startOfYear)/ONE_DAY);};SimpleDateFormat=function(formatString){this.formatString=formatString;};SimpleDateFormat.prototype.setMinimalDaysInFirstWeek=function(days){this.minimalDaysInFirstWeek=days;};SimpleDateFormat.prototype.getMinimalDaysInFirstWeek=function(){return isUndefined(this.minimalDaysInFirstWeek)?DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK:this.minimalDaysInFirstWeek;};var padWithZeroes=function(str,len){while(str.length<len){str="0"+str;} return str;};var formatText=function(data,numberOfLetters,minLength){return(numberOfLetters>=4)?data:data.substr(0,Math.max(minLength,numberOfLetters));};var formatNumber=function(data,numberOfLetters){var dataString=""+data;return padWithZeroes(dataString,numberOfLetters);};SimpleDateFormat.prototype.format=function(date){var formattedString="";var result;var searchString=this.formatString;while((result=regex.exec(searchString))){var quotedString=result[1];var patternLetters=result[2];var otherLetters=result[3];var otherCharacters=result[4];if(quotedString){if(quotedString=="''"){formattedString+="'";}else{formattedString+=quotedString.substring(1,quotedString.length-1);}}else if(otherLetters){}else if(otherCharacters){formattedString+=otherCharacters;}else if(patternLetters){var patternLetter=patternLetters.charAt(0);var numberOfLetters=patternLetters.length;var rawData="";switch(patternLetter){case"G":rawData="AD";break;case"y":rawData=date.getFullYear();break;case"M":rawData=date.getMonth();break;case"w":rawData=date.getWeekInYear(this.getMinimalDaysInFirstWeek());break;case"W":rawData=date.getWeekInMonth(this.getMinimalDaysInFirstWeek());break;case"D":rawData=date.getDayInYear();break;case"d":rawData=date.getDate();break;case"F":rawData=1+Math.floor((date.getDate()-1)/7);break;case"E":rawData=dayNames[date.getDay()];break;case"a":rawData=(date.getHours()>=12)?"PM":"AM";break;case"H":rawData=date.getHours();break;case"k":rawData=date.getHours()||24;break;case"K":rawData=date.getHours()%12;break;case"h":rawData=(date.getHours()%12)||12;break;case"m":rawData=date.getMinutes();break;case"s":rawData=date.getSeconds();break;case"S":rawData=date.getMilliseconds();break;case"Z":rawData=date.getTimezoneOffset();break;} switch(types[patternLetter]){case TEXT2:formattedString+=formatText(rawData,numberOfLetters,2);break;case TEXT3:formattedString+=formatText(rawData,numberOfLetters,3);break;case NUMBER:formattedString+=formatNumber(rawData,numberOfLetters);break;case YEAR:if(numberOfLetters<=3){var dataString=""+rawData;formattedString+=dataString.substr(2,2);}else{formattedString+=formatNumber(rawData,numberOfLetters);} break;case MONTH:if(numberOfLetters>=3){formattedString+=formatText(monthNames[rawData],numberOfLetters,numberOfLetters);}else{formattedString+=formatNumber(rawData+1,numberOfLetters);} break;case TIMEZONE:var isPositive=(rawData>0);var prefix=isPositive?"-":"+";var absData=Math.abs(rawData);var hours=""+Math.floor(absData/60);hours=padWithZeroes(hours,2);var minutes=""+(absData%60);minutes=padWithZeroes(minutes,2);formattedString+=prefix+hours+minutes;break;}} searchString=searchString.substr(result.index+result[0].length);} return formattedString;};})();log4javascript.SimpleDateFormat=SimpleDateFormat;function PatternLayout(pattern){if(pattern){this.pattern=pattern;}else{this.pattern=PatternLayout.DEFAULT_CONVERSION_PATTERN;} this.customFields=[];} PatternLayout.TTCC_CONVERSION_PATTERN="%r %p %c - %m%n";PatternLayout.DEFAULT_CONVERSION_PATTERN="%m%n";PatternLayout.ISO8601_DATEFORMAT="yyyy-MM-dd HH:mm:ss,SSS";PatternLayout.DATETIME_DATEFORMAT="dd MMM yyyy HH:mm:ss,SSS";PatternLayout.ABSOLUTETIME_DATEFORMAT="HH:mm:ss,SSS";PatternLayout.prototype=new Layout();PatternLayout.prototype.format=function(loggingEvent){var regex=/%(-?[0-9]+)?(\.?[0-9]+)?([acdfmMnpr%])(\{([^\}]+)\})?|([^%]+)/;var formattedString="";var result;var searchString=this.pattern;while((result=regex.exec(searchString))){var matchedString=result[0];var padding=result[1];var truncation=result[2];var conversionCharacter=result[3];var specifier=result[5];var text=result[6];if(text){formattedString+=""+text;}else{var replacement="";switch(conversionCharacter){case"a":case"m":var depth=0;if(specifier){depth=parseInt(specifier,10);if(isNaN(depth)){handleError("PatternLayout.format: invalid specifier '"+ specifier+"' for conversion character '"+conversionCharacter+"' - should be a number");depth=0;}} var messages=(conversionCharacter==="a")?loggingEvent.messages[0]:loggingEvent.messages;for(var i=0,len=messages.length;i<len;i++){if(i>0&&(replacement.charAt(replacement.length-1)!==" ")){replacement+=" ";} if(depth===0){replacement+=messages[i];}else{replacement+=formatObjectExpansion(messages[i],depth);}} break;case"c":var loggerName=loggingEvent.logger.name;if(specifier){var precision=parseInt(specifier,10);var loggerNameBits=loggingEvent.logger.name.split(".");if(precision>=loggerNameBits.length){replacement=loggerName;}else{replacement=loggerNameBits.slice(loggerNameBits.length-precision).join(".");}}else{replacement=loggerName;} break;case"d":var dateFormat=PatternLayout.ISO8601_DATEFORMAT;if(specifier){dateFormat=specifier;if(dateFormat=="ISO8601"){dateFormat=PatternLayout.ISO8601_DATEFORMAT;}else if(dateFormat=="ABSOLUTE"){dateFormat=PatternLayout.ABSOLUTETIME_DATEFORMAT;}else if(dateFormat=="DATE"){dateFormat=PatternLayout.DATETIME_DATEFORMAT;}} replacement=(new SimpleDateFormat(dateFormat)).format(loggingEvent.timeStamp);break;case"f":if(this.hasCustomFields()){var fieldIndex=0;if(specifier){fieldIndex=parseInt(specifier,10);if(isNaN(fieldIndex)){handleError("PatternLayout.format: invalid specifier '"+ specifier+"' for conversion character 'f' - should be a number");}else if(fieldIndex===0){handleError("PatternLayout.format: invalid specifier '"+ specifier+"' for conversion character 'f' - must be greater than zero");}else if(fieldIndex>this.customFields.length){handleError("PatternLayout.format: invalid specifier '"+ specifier+"' for conversion character 'f' - there aren't that many custom fields");}else{fieldIndex=fieldIndex-1;}} var val=this.customFields[fieldIndex].value;if(typeof val=="function"){val=val(this,loggingEvent);} replacement=val;} break;case"n":replacement=newLine;break;case"p":replacement=loggingEvent.level.name;break;case"r":replacement=""+loggingEvent.timeStamp.getDifference(applicationStartDate);break;case"%":replacement="%";break;default:replacement=matchedString;break;} var l;if(truncation){l=parseInt(truncation.substr(1),10);var strLen=replacement.length;if(l<strLen){replacement=replacement.substring(strLen-l,strLen);}} if(padding){if(padding.charAt(0)=="-"){l=parseInt(padding.substr(1),10);while(replacement.length<l){replacement+=" ";}}else{l=parseInt(padding,10);while(replacement.length<l){replacement=" "+replacement;}}} formattedString+=replacement;} searchString=searchString.substr(result.index+result[0].length);} return formattedString;};PatternLayout.prototype.ignoresThrowable=function(){return true;};PatternLayout.prototype.toString=function(){return"PatternLayout";};log4javascript.PatternLayout=PatternLayout;var xhrFactory=function(){return new XMLHttpRequest();};var xmlHttpFactories=[xhrFactory,function(){return new ActiveXObject("Msxml2.XMLHTTP");},function(){return new ActiveXObject("Microsoft.XMLHTTP");}];var withCredentialsSupported=false;var getXmlHttp=function(errorHandler){var xmlHttp=null,factory;for(var i=0,len=xmlHttpFactories.length;i<len;i++){factory=xmlHttpFactories[i];try{xmlHttp=factory();withCredentialsSupported=(factory==xhrFactory&&("withCredentials"in xmlHttp));getXmlHttp=factory;return xmlHttp;}catch(e){}} if(errorHandler){errorHandler();}else{handleError("getXmlHttp: unable to obtain XMLHttpRequest object");}};function isHttpRequestSuccessful(xmlHttp){return isUndefined(xmlHttp.status)||xmlHttp.status===0||(xmlHttp.status>=200&&xmlHttp.status<300)||xmlHttp.status==1223;} function AjaxAppender(url,withCredentials){var appender=this;var isSupported=true;if(!url){handleError("AjaxAppender: URL must be specified in constructor");isSupported=false;} var timed=this.defaults.timed;var waitForResponse=this.defaults.waitForResponse;var batchSize=this.defaults.batchSize;var timerInterval=this.defaults.timerInterval;var requestSuccessCallback=this.defaults.requestSuccessCallback;var failCallback=this.defaults.failCallback;var postVarName=this.defaults.postVarName;var sendAllOnUnload=this.defaults.sendAllOnUnload;var contentType=this.defaults.contentType;var sessionId=null;var queuedLoggingEvents=[];var queuedRequests=[];var headers=[];var sending=false;var initialized=false;function checkCanConfigure(configOptionName){if(initialized){handleError("AjaxAppender: configuration option '"+ configOptionName+"' may not be set after the appender has been initialized");return false;} return true;} this.getSessionId=function(){return sessionId;};this.setSessionId=function(sessionIdParam){sessionId=extractStringFromParam(sessionIdParam,null);this.layout.setCustomField("sessionid",sessionId);};this.setLayout=function(layoutParam){if(checkCanConfigure("layout")){this.layout=layoutParam;if(sessionId!==null){this.setSessionId(sessionId);}}};this.isTimed=function(){return timed;};this.setTimed=function(timedParam){if(checkCanConfigure("timed")){timed=bool(timedParam);}};this.getTimerInterval=function(){return timerInterval;};this.setTimerInterval=function(timerIntervalParam){if(checkCanConfigure("timerInterval")){timerInterval=extractIntFromParam(timerIntervalParam,timerInterval);}};this.isWaitForResponse=function(){return waitForResponse;};this.setWaitForResponse=function(waitForResponseParam){if(checkCanConfigure("waitForResponse")){waitForResponse=bool(waitForResponseParam);}};this.getBatchSize=function(){return batchSize;};this.setBatchSize=function(batchSizeParam){if(checkCanConfigure("batchSize")){batchSize=extractIntFromParam(batchSizeParam,batchSize);}};this.isSendAllOnUnload=function(){return sendAllOnUnload;};this.setSendAllOnUnload=function(sendAllOnUnloadParam){if(checkCanConfigure("sendAllOnUnload")){sendAllOnUnload=extractBooleanFromParam(sendAllOnUnloadParam,sendAllOnUnload);}};this.setRequestSuccessCallback=function(requestSuccessCallbackParam){requestSuccessCallback=extractFunctionFromParam(requestSuccessCallbackParam,requestSuccessCallback);};this.setFailCallback=function(failCallbackParam){failCallback=extractFunctionFromParam(failCallbackParam,failCallback);};this.getPostVarName=function(){return postVarName;};this.setPostVarName=function(postVarNameParam){if(checkCanConfigure("postVarName")){postVarName=extractStringFromParam(postVarNameParam,postVarName);}};this.getHeaders=function(){return headers;};this.addHeader=function(name,value){if(name.toLowerCase()=="content-type"){contentType=value;}else{headers.push({name:name,value:value});}};function sendAll(){if(isSupported&&enabled){sending=true;var currentRequestBatch;if(waitForResponse){if(queuedRequests.length>0){currentRequestBatch=queuedRequests.shift();sendRequest(preparePostData(currentRequestBatch),sendAll);}else{sending=false;if(timed){scheduleSending();}}}else{while((currentRequestBatch=queuedRequests.shift())){sendRequest(preparePostData(currentRequestBatch));} sending=false;if(timed){scheduleSending();}}}} this.sendAll=sendAll;function sendAllRemaining(){var sendingAnything=false;if(isSupported&&enabled){var actualBatchSize=appender.getLayout().allowBatching()?batchSize:1;var currentLoggingEvent;var batchedLoggingEvents=[];while((currentLoggingEvent=queuedLoggingEvents.shift())){batchedLoggingEvents.push(currentLoggingEvent);if(queuedLoggingEvents.length>=actualBatchSize){queuedRequests.push(batchedLoggingEvents);batchedLoggingEvents=[];}} if(batchedLoggingEvents.length>0){queuedRequests.push(batchedLoggingEvents);} sendingAnything=(queuedRequests.length>0);waitForResponse=false;timed=false;sendAll();} return sendingAnything;} this.sendAllRemaining=sendAllRemaining;function preparePostData(batchedLoggingEvents){var formattedMessages=[];var currentLoggingEvent;var postData="";while((currentLoggingEvent=batchedLoggingEvents.shift())){formattedMessages.push(appender.getLayout().formatWithException(currentLoggingEvent));} if(batchedLoggingEvents.length==1){postData=formattedMessages.join("");}else{postData=appender.getLayout().batchHeader+ formattedMessages.join(appender.getLayout().batchSeparator)+ appender.getLayout().batchFooter;} if(contentType==appender.defaults.contentType){postData=appender.getLayout().returnsPostData?postData:urlEncode(postVarName)+"="+urlEncode(postData);if(postData.length>0){postData+="&";} postData+="layout="+urlEncode(appender.getLayout().toString());} return postData;} function scheduleSending(){window.setTimeout(sendAll,timerInterval);} function xmlHttpErrorHandler(){var msg="AjaxAppender: could not create XMLHttpRequest object. AjaxAppender disabled";handleError(msg);isSupported=false;if(failCallback){failCallback(msg);}} function sendRequest(postData,successCallback){try{var xmlHttp=getXmlHttp(xmlHttpErrorHandler);if(isSupported){if(withCredentials&&withCredentialsSupported){xmlHttp.withCredentials=true;} xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(isHttpRequestSuccessful(xmlHttp)){if(requestSuccessCallback){requestSuccessCallback(xmlHttp);} if(successCallback){successCallback(xmlHttp);}}else{var msg="AjaxAppender.append: XMLHttpRequest request to URL "+ url+" returned status code "+xmlHttp.status;handleError(msg);if(failCallback){failCallback(msg);}} xmlHttp.onreadystatechange=emptyFunction;xmlHttp=null;}};xmlHttp.open("POST",url,true);try{for(var i=0,header;header=headers[i++];){xmlHttp.setRequestHeader(header.name,header.value);} xmlHttp.setRequestHeader("Content-Type",contentType);}catch(headerEx){var msg="AjaxAppender.append: your browser's XMLHttpRequest implementation"+" does not support setRequestHeader, therefore cannot post data. AjaxAppender disabled";handleError(msg);isSupported=false;if(failCallback){failCallback(msg);} return;} xmlHttp.send(postData);}}catch(ex){var errMsg="AjaxAppender.append: error sending log message to "+url;handleError(errMsg,ex);isSupported=false;if(failCallback){failCallback(errMsg+". Details: "+getExceptionStringRep(ex));}}} this.append=function(loggingEvent){if(isSupported){if(!initialized){init();} queuedLoggingEvents.push(loggingEvent);var actualBatchSize=this.getLayout().allowBatching()?batchSize:1;if(queuedLoggingEvents.length>=actualBatchSize){var currentLoggingEvent;var batchedLoggingEvents=[];while((currentLoggingEvent=queuedLoggingEvents.shift())){batchedLoggingEvents.push(currentLoggingEvent);} queuedRequests.push(batchedLoggingEvents);if(!timed&&(!waitForResponse||(waitForResponse&&!sending))){sendAll();}}}};function init(){initialized=true;if(sendAllOnUnload){var oldBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){if(oldBeforeUnload){oldBeforeUnload();} if(sendAllRemaining()){return"Sending log messages";}};} if(timed){scheduleSending();}}} AjaxAppender.prototype=new Appender();AjaxAppender.prototype.defaults={waitForResponse:false,timed:false,timerInterval:1000,batchSize:1,sendAllOnUnload:false,requestSuccessCallback:null,failCallback:null,postVarName:"data",contentType:"application/x-www-form-urlencoded"};AjaxAppender.prototype.layout=new HttpPostDataLayout();AjaxAppender.prototype.toString=function(){return"AjaxAppender";};log4javascript.AjaxAppender=AjaxAppender;log4javascript.setDocumentReady=function(){pageLoaded=true;log4javascript.dispatchEvent("load",{});};if(window.addEventListener){window.addEventListener("load",log4javascript.setDocumentReady,false);}else if(window.attachEvent){window.attachEvent("onload",log4javascript.setDocumentReady);}else{var oldOnload=window.onload;if(typeof window.onload!="function"){window.onload=log4javascript.setDocumentReady;}else{window.onload=function(evt){if(oldOnload){oldOnload(evt);} log4javascript.setDocumentReady();};}} window.log4javascript=log4javascript;return log4javascript;})();
RNELord/cdnjs
ajax/libs/log4javascript/1.4.9/log4javascript_production.js
JavaScript
mit
49,088
/* 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 */ if(!dojo._hasResource["dojo.Stateful"]){ dojo._hasResource["dojo.Stateful"]=true; dojo.provide("dojo.Stateful"); dojo.declare("dojo.Stateful",null,{postscript:function(_1){ if(_1){ dojo.mixin(this,_1); } },get:function(_2){ return this[_2]; },set:function(_3,_4){ if(typeof _3==="object"){ for(var x in _3){ this.set(x,_3[x]); } return this; } var _5=this[_3]; this[_3]=_4; if(this._watchCallbacks){ this._watchCallbacks(_3,_5,_4); } return this; },watch:function(_6,_7){ var _8=this._watchCallbacks; if(!_8){ var _9=this; _8=this._watchCallbacks=function(_a,_b,_c,_d){ var _e=function(_f){ if(_f){ _f=_f.slice(); for(var i=0,l=_f.length;i<l;i++){ try{ _f[i].call(_9,_a,_b,_c); } catch(e){ console.error(e); } } } }; _e(_8["_"+_a]); if(!_d){ _e(_8["*"]); } }; } if(!_7&&typeof _6==="function"){ _7=_6; _6="*"; }else{ _6="_"+_6; } var _10=_8[_6]; if(typeof _10!=="object"){ _10=_8[_6]=[]; } _10.push(_7); return {unwatch:function(){ _10.splice(dojo.indexOf(_10,_7),1); }}; }}); }
yinghunglai/cdnjs
ajax/libs/dojo/1.6.1/Stateful.js
JavaScript
mit
1,176
'use strict'; // See state defs from inflate.js var BAD = 30; /* got a data error -- remain here until reset */ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ /* Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is available, an end-of-block is encountered, or a data error is encountered. When large enough input and output buffers are supplied to inflate(), for example, a 16K input buffer and a 64K output buffer, more than 95% of the inflate execution time is spent in this routine. Entry assumptions: state.mode === LEN strm.avail_in >= 6 strm.avail_out >= 258 start >= strm.avail_out state.bits < 8 On return, state.mode is one of: LEN -- ran out of enough output space or enough available input TYPE -- reached end of block code, inflate() to interpret next block BAD -- error in block data Notes: - The maximum input bits used by a length/distance pair is 15 bits for the length code, 5 bits for the length extra, 15 bits for the distance code, and 13 bits for the distance extra. This totals 48 bits, or six bytes. Therefore if strm.avail_in >= 6, then there is enough input to avoid checking for available input while decoding. - The maximum bytes that a single length/distance pair can output is 258 bytes, which is the maximum length that can be coded. inflate_fast() requires strm.avail_out >= 258 for each loop to avoid checking for output space. */ module.exports = function inflate_fast(strm, start) { var state; var _in; /* local strm.input */ var last; /* have enough input while in < last */ var _out; /* local strm.output */ var beg; /* inflate()'s initial strm.output */ var end; /* while out < end, enough space available */ //#ifdef INFLATE_STRICT var dmax; /* maximum distance from zlib header */ //#endif var wsize; /* window size or zero if not using window */ var whave; /* valid bytes in the window */ var wnext; /* window write index */ var window; /* allocated sliding window, if wsize != 0 */ var hold; /* local strm.hold */ var bits; /* local strm.bits */ var lcode; /* local strm.lencode */ var dcode; /* local strm.distcode */ var lmask; /* mask for first level of length codes */ var dmask; /* mask for first level of distance codes */ var here; /* retrieved table entry */ var op; /* code bits, operation, extra bits, or */ /* window position, window bytes to copy */ var len; /* match length, unused bytes */ var dist; /* match distance */ var from; /* where to copy match from */ var from_source; var input, output; // JS specific, because we have no pointers /* copy state to local variables */ state = strm.state; //here = state.here; _in = strm.next_in; input = strm.input; last = _in + (strm.avail_in - 5); _out = strm.next_out; output = strm.output; beg = _out - (start - strm.avail_out); end = _out + (strm.avail_out - 257); //#ifdef INFLATE_STRICT dmax = state.dmax; //#endif wsize = state.wsize; whave = state.whave; wnext = state.wnext; window = state.window; hold = state.hold; bits = state.bits; lcode = state.lencode; dcode = state.distcode; lmask = (1 << state.lenbits) - 1; dmask = (1 << state.distbits) - 1; /* decode literals and length/distances until end-of-block or not enough input data or output space */ top: do { if (bits < 15) { hold += input[_in++] << bits; bits += 8; hold += input[_in++] << bits; bits += 8; } here = lcode[hold & lmask]; dolen: for (;;) { // Goto emulation op = here >>> 24/*here.bits*/; hold >>>= op; bits -= op; op = (here >>> 16) & 0xff/*here.op*/; if (op === 0) { /* literal */ //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? // "inflate: literal '%c'\n" : // "inflate: literal 0x%02x\n", here.val)); output[_out++] = here & 0xffff/*here.val*/; } else if (op & 16) { /* length base */ len = here & 0xffff/*here.val*/; op &= 15; /* number of extra bits */ if (op) { if (bits < op) { hold += input[_in++] << bits; bits += 8; } len += hold & ((1 << op) - 1); hold >>>= op; bits -= op; } //Tracevv((stderr, "inflate: length %u\n", len)); if (bits < 15) { hold += input[_in++] << bits; bits += 8; hold += input[_in++] << bits; bits += 8; } here = dcode[hold & dmask]; dodist: for (;;) { // goto emulation op = here >>> 24/*here.bits*/; hold >>>= op; bits -= op; op = (here >>> 16) & 0xff/*here.op*/; if (op & 16) { /* distance base */ dist = here & 0xffff/*here.val*/; op &= 15; /* number of extra bits */ if (bits < op) { hold += input[_in++] << bits; bits += 8; if (bits < op) { hold += input[_in++] << bits; bits += 8; } } dist += hold & ((1 << op) - 1); //#ifdef INFLATE_STRICT if (dist > dmax) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break top; } //#endif hold >>>= op; bits -= op; //Tracevv((stderr, "inflate: distance %u\n", dist)); op = _out - beg; /* max distance in output */ if (dist > op) { /* see if copy from window */ op = dist - op; /* distance back in window */ if (op > whave) { if (state.sane) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break top; } // (!) This block is disabled in zlib defailts, // don't enable it for binary compatibility //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR // if (len <= op - whave) { // do { // output[_out++] = 0; // } while (--len); // continue top; // } // len -= op - whave; // do { // output[_out++] = 0; // } while (--op > whave); // if (op === 0) { // from = _out - dist; // do { // output[_out++] = output[from++]; // } while (--len); // continue top; // } //#endif } from = 0; // window index from_source = window; if (wnext === 0) { /* very common case */ from += wsize - op; if (op < len) { /* some from window */ len -= op; do { output[_out++] = window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } else if (wnext < op) { /* wrap around window */ from += wsize + wnext - op; op -= wnext; if (op < len) { /* some from end of window */ len -= op; do { output[_out++] = window[from++]; } while (--op); from = 0; if (wnext < len) { /* some from start of window */ op = wnext; len -= op; do { output[_out++] = window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } } else { /* contiguous in window */ from += wnext - op; if (op < len) { /* some from window */ len -= op; do { output[_out++] = window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } while (len > 2) { output[_out++] = from_source[from++]; output[_out++] = from_source[from++]; output[_out++] = from_source[from++]; len -= 3; } if (len) { output[_out++] = from_source[from++]; if (len > 1) { output[_out++] = from_source[from++]; } } } else { from = _out - dist; /* copy direct from output */ do { /* minimum length is three */ output[_out++] = output[from++]; output[_out++] = output[from++]; output[_out++] = output[from++]; len -= 3; } while (len > 2); if (len) { output[_out++] = output[from++]; if (len > 1) { output[_out++] = output[from++]; } } } } else if ((op & 64) === 0) { /* 2nd level distance code */ here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; continue dodist; } else { strm.msg = 'invalid distance code'; state.mode = BAD; break top; } break; // need to emulate goto via "continue" } } else if ((op & 64) === 0) { /* 2nd level length code */ here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; continue dolen; } else if (op & 32) { /* end-of-block */ //Tracevv((stderr, "inflate: end of block\n")); state.mode = TYPE; break top; } else { strm.msg = 'invalid literal/length code'; state.mode = BAD; break top; } break; // need to emulate goto via "continue" } } while (_in < last && _out < end); /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ len = bits >> 3; _in -= len; bits -= len << 3; hold &= (1 << bits) - 1; /* update state and return */ strm.next_in = _in; strm.next_out = _out; strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); state.hold = hold; state.bits = bits; return; };
kapalhq/site-src
node_modules/grunt-contrib-cssmin/node_modules/maxmin/node_modules/gzip-size/node_modules/browserify-zlib/node_modules/pako/lib/zlib/inffast.js
JavaScript
mit
11,615
<?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.0.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); /** * CodeIgniter String Helpers * * @package CodeIgniter * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team * @link https://codeigniter.com/user_guide/helpers/string_helper.html */ // ------------------------------------------------------------------------ if ( ! function_exists('trim_slashes')) { /** * Trim Slashes * * Removes any leading/trailing slashes from a string: * * /this/that/theother/ * * becomes: * * this/that/theother * * @todo Remove in version 3.1+. * @deprecated 3.0.0 This is just an alias for PHP's native trim() * * @param string * @return string */ function trim_slashes($str) { return trim($str, '/'); } } // ------------------------------------------------------------------------ if ( ! function_exists('strip_slashes')) { /** * Strip Slashes * * Removes slashes contained in a string or in an array * * @param mixed string or array * @return mixed string or array */ function strip_slashes($str) { if ( ! is_array($str)) { return stripslashes($str); } foreach ($str as $key => $val) { $str[$key] = strip_slashes($val); } return $str; } } // ------------------------------------------------------------------------ if ( ! function_exists('strip_quotes')) { /** * Strip Quotes * * Removes single and double quotes from a string * * @param string * @return string */ function strip_quotes($str) { return str_replace(array('"', "'"), '', $str); } } // ------------------------------------------------------------------------ if ( ! function_exists('quotes_to_entities')) { /** * Quotes to Entities * * Converts single and double quotes to entities * * @param string * @return string */ function quotes_to_entities($str) { return str_replace(array("\'","\"","'",'"'), array("&#39;","&quot;","&#39;","&quot;"), $str); } } // ------------------------------------------------------------------------ if ( ! function_exists('reduce_double_slashes')) { /** * Reduce Double Slashes * * Converts double slashes in a string to a single slash, * except those found in http:// * * http://www.some-site.com//index.php * * becomes: * * http://www.some-site.com/index.php * * @param string * @return string */ function reduce_double_slashes($str) { return preg_replace('#(^|[^:])//+#', '\\1/', $str); } } // ------------------------------------------------------------------------ if ( ! function_exists('reduce_multiples')) { /** * Reduce Multiples * * Reduces multiple instances of a particular character. Example: * * Fred, Bill,, Joe, Jimmy * * becomes: * * Fred, Bill, Joe, Jimmy * * @param string * @param string the character you wish to reduce * @param bool TRUE/FALSE - whether to trim the character from the beginning/end * @return string */ function reduce_multiples($str, $character = ',', $trim = FALSE) { $str = preg_replace('#'.preg_quote($character, '#').'{2,}#', $character, $str); return ($trim === TRUE) ? trim($str, $character) : $str; } } // ------------------------------------------------------------------------ if ( ! function_exists('random_string')) { /** * Create a Random String * * Useful for generating passwords or hashes. * * @param string type of random string. basic, alpha, alnum, numeric, nozero, unique, md5, encrypt and sha1 * @param int number of characters * @return string */ function random_string($type = 'alnum', $len = 8) { switch ($type) { case 'basic': return mt_rand(); case 'alnum': case 'numeric': case 'nozero': case 'alpha': switch ($type) { case 'alpha': $pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; break; case 'alnum': $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; break; case 'numeric': $pool = '0123456789'; break; case 'nozero': $pool = '123456789'; break; } return substr(str_shuffle(str_repeat($pool, ceil($len / strlen($pool)))), 0, $len); case 'unique': // todo: remove in 3.1+ case 'md5': return md5(uniqid(mt_rand())); case 'encrypt': // todo: remove in 3.1+ case 'sha1': return sha1(uniqid(mt_rand(), TRUE)); } } } // ------------------------------------------------------------------------ if ( ! function_exists('increment_string')) { /** * Add's _1 to a string or increment the ending number to allow _2, _3, etc * * @param string required * @param string What should the duplicate number be appended with * @param string Which number should be used for the first dupe increment * @return string */ function increment_string($str, $separator = '_', $first = 1) { preg_match('/(.+)'.preg_quote($separator, '/').'([0-9]+)$/', $str, $match); return isset($match[2]) ? $match[1].$separator.($match[2] + 1) : $str.$separator.$first; } } // ------------------------------------------------------------------------ if ( ! function_exists('alternator')) { /** * Alternator * * Allows strings to be alternated. See docs... * * @param string (as many parameters as needed) * @return string */ function alternator() { static $i; if (func_num_args() === 0) { $i = 0; return ''; } $args = func_get_args(); return $args[($i++ % count($args))]; } } // ------------------------------------------------------------------------ if ( ! function_exists('repeater')) { /** * Repeater function * * @todo Remove in version 3.1+. * @deprecated 3.0.0 This is just an alias for PHP's native str_repeat() * * @param string $data String to repeat * @param int $num Number of repeats * @return string */ function repeater($data, $num = 1) { return ($num > 0) ? str_repeat($data, $num) : ''; } }
wazsmwazsm/QinBlog
system/helpers/string_helper.php
PHP
mit
7,600
/*! tablesorter CSS Sticky Headers widget - updated 5/5/2014 (v2.16.4) * Requires a modern browser, tablesorter v2.8+ */ /*jshint jquery:true, unused:false */ ;(function($){ "use strict"; $.tablesorter.addWidget({ id: "cssStickyHeaders", priority: 10, options: { cssStickyHeaders_offset : 0, cssStickyHeaders_addCaption : false, cssStickyHeaders_attachTo : null, cssStickyHeaders_filteredToTop : true, cssStickyHeaders_zIndex : 10 }, init : function(table, thisWidget, c, wo) { var $attach = $(wo.cssStickyHeaders_attachTo), namespace = '.cssstickyheader', $thead = c.$table.children('thead'), $caption = c.$table.find('caption'), $win = $attach.length ? $attach : $(window); $win.bind('scroll resize '.split(' ').join(namespace + ' '), function() { var top = $attach.length ? $attach.offset().top : $win.scrollTop(), // add caption height; include table padding top & border-spacing or text may be above the fold (jQuery UI themes) // border-spacing needed in Firefox, but not webkit... not sure if I should account for that captionTop = wo.cssStickyHeaders_addCaption ? $caption.outerHeight(true) + (parseInt(c.$table.css('padding-top'), 10) || 0) + (parseInt(c.$table.css('border-spacing'), 10) || 0) : 0, bottom = c.$table.height() - $thead.height() - (c.$table.find('tfoot').height() || 0) - captionTop, deltaY = top - $thead.offset().top + (parseInt(c.$table.css('border-top-width'), 10) || 0) + (wo.cssStickyHeaders_offset || 0) + captionTop, finalY = (deltaY > 0 && deltaY <= bottom ? deltaY : 0), // IE can only transform header cells - fixes #447 thanks to @gakreol! $cells = $thead.children().children(); if (wo.cssStickyHeaders_addCaption) { $cells = $cells.add($caption); } $cells.css({ "position" : "relative", "z-index" : wo.cssStickyHeaders_zIndex, "transform" : finalY === 0 ? "" : "translate(0px," + finalY + "px)", "-ms-transform" : finalY === 0 ? "" : "translate(0px," + finalY + "px)", "-webkit-transform" : finalY === 0 ? "" : "translate(0px," + finalY + "px)" }); }); c.$table.bind('filterEnd', function() { if (wo.cssStickyHeaders_filteredToTop) { // scroll top of table into view window.scrollTo(0, c.$table.position().top); } }); }, remove: function(table, c, wo){ var namespace = '.cssstickyheader'; $(window).unbind('scroll resize '.split(' ').join(namespace + ' ')); c.$table .unbind('update updateAll '.split(' ').join(namespace + ' ')) .children('thead, caption').css({ "position" : "", "z-index" : "", "transform" : "", "-ms-transform" : "", "-webkit-transform" : "" }); } }); })(jQuery);
callumacrae/cdnjs
ajax/libs/jquery.tablesorter/2.17.8/js/widgets/widget-cssStickyHeaders.js
JavaScript
mit
2,767
YUI.add('io-xdr', function (Y, NAME) { /** Extends IO to provide an alternate, Flash transport, for making cross-domain requests. @module io @submodule io-xdr @for IO **/ /** Fires when the XDR transport is ready for use. @event io:xdrReady **/ var E_XDR_READY = Y.publish('io:xdrReady', { fireOnce: true }), /** Map of stored configuration objects when using Flash as the transport for cross-domain requests. @property _cB @private @type {Object} **/ _cB = {}, /** Map of transaction simulated readyState values when XDomainRequest is the transport. @property _rS @private @type {Object} **/ _rS = {}, // Document reference d = Y.config.doc, // Window reference w = Y.config.win, // XDomainRequest cross-origin request detection xdr = w && w.XDomainRequest; /** Method that creates the Flash transport swf. @method _swf @private @param {String} uri - location of io.swf. @param {String} yid - YUI sandbox id. @param {String} yid - IO instance id. **/ function _swf(uri, yid, uid) { var o = '<object id="io_swf" type="application/x-shockwave-flash" data="' + uri + '" width="0" height="0">' + '<param name="movie" value="' + uri + '">' + '<param name="FlashVars" value="yid=' + yid + '&uid=' + uid + '">' + '<param name="allowScriptAccess" value="always">' + '</object>', c = d.createElement('div'); d.body.appendChild(c); c.innerHTML = o; } /** Creates a response object for XDR transactions, for success and failure cases. @method _data @private @param {Object} o - Transaction object generated by _create() in io-base. @param {Boolean} u - Configuration xdr.use. @param {Boolean} d - Configuration xdr.dataType. @return {Object} **/ function _data(o, u, d) { if (u === 'flash') { o.c.responseText = decodeURI(o.c.responseText); } if (d === 'xml') { o.c.responseXML = Y.DataType.XML.parse(o.c.responseText); } return o; } /** Method for intiating an XDR transaction abort. @method _abort @private @param {Object} o - Transaction object generated by _create() in io-base. @param {Object} c - configuration object for the transaction. **/ function _abort(o, c) { return o.c.abort(o.id, c); } /** Method for determining if an XDR transaction has completed and all data are received. @method _isInProgress @private @param {Object} o - Transaction object generated by _create() in io-base. **/ function _isInProgress(o) { return xdr ? _rS[o.id] !== 4 : o.c.isInProgress(o.id); } Y.mix(Y.IO.prototype, { /** Map of io transports. @property _transport @private @type {Object} **/ _transport: {}, /** Sets event handlers for XDomainRequest transactions. @method _ieEvt @private @static @param {Object} o - Transaction object generated by _create() in io-base. @param {Object} c - configuration object for the transaction. **/ _ieEvt: function(o, c) { var io = this, i = o.id, t = 'timeout'; o.c.onprogress = function() { _rS[i] = 3; }; o.c.onload = function() { _rS[i] = 4; io.xdrResponse('success', o, c); }; o.c.onerror = function() { _rS[i] = 4; io.xdrResponse('failure', o, c); }; if (c[t]) { o.c.ontimeout = function() { _rS[i] = 4; io.xdrResponse(t, o, c); }; o.c[t] = c[t]; } }, /** Method for accessing the transport's interface for making a cross-domain transaction. @method xdr @param {String} uri - qualified path to transaction resource. @param {Object} o - Transaction object generated by _create() in io-base. @param {Object} c - configuration object for the transaction. **/ xdr: function(uri, o, c) { var io = this; if (c.xdr.use === 'flash') { // The configuration object cannot be serialized safely // across Flash's ExternalInterface. _cB[o.id] = c; w.setTimeout(function() { try { o.c.send(uri, { id: o.id, uid: o.uid, method: c.method, data: c.data, headers: c.headers }); } catch(e) { io.xdrResponse('transport error', o, c); delete _cB[o.id]; } }, Y.io.xdr.delay); } else if (xdr) { io._ieEvt(o, c); o.c.open(c.method || 'GET', uri); o.c.send(c.data); } else { o.c.send(uri, o, c); } return { id: o.id, abort: function() { return o.c ? _abort(o, c) : false; }, isInProgress: function() { return o.c ? _isInProgress(o.id) : false; }, io: io }; }, /** Response controller for cross-domain requests when using the Flash transport or IE8's XDomainRequest object. @method xdrResponse @param {String} e Event name @param {Object} o Transaction object generated by _create() in io-base. @param {Object} c Configuration object for the transaction. @return {Object} **/ xdrResponse: function(e, o, c) { c = _cB[o.id] ? _cB[o.id] : c; var io = this, m = xdr ? _rS : _cB, u = c.xdr.use, d = c.xdr.dataType; switch (e) { case 'start': io.start(o, c); break; //case 'complete': //This case is not used by Flash or XDomainRequest. //io.complete(o, c); //break; case 'success': io.success(_data(o, u, d), c); delete m[o.id]; break; case 'timeout': case 'abort': case 'transport error': o.c = { status: 0, statusText: e }; case 'failure': io.failure(_data(o, u, d), c); delete m[o.id]; break; } }, /** Fires event "io:xdrReady" @method _xdrReady @private @param {Number} yid - YUI sandbox id. @param {Number} uid - IO instance id. **/ _xdrReady: function(yid, uid) { Y.fire(E_XDR_READY, yid, uid); }, /** Initializes the desired transport. @method transport @param {Object} o - object of transport configurations. **/ transport: function(c) { if (c.id === 'flash') { _swf(Y.UA.ie ? c.src + '?d=' + new Date().valueOf().toString() : c.src, Y.id, c.uid); Y.IO.transports.flash = function() { return d.getElementById('io_swf'); }; } } }); /** Fires event "io:xdrReady" @method xdrReady @protected @static @param {Number} yid - YUI sandbox id. @param {Number} uid - IO instance id. **/ Y.io.xdrReady = function(yid, uid){ var io = Y.io._map[uid]; Y.io.xdr.delay = 0; io._xdrReady.apply(io, [yid, uid]); }; Y.io.xdrResponse = function(e, o, c){ var io = Y.io._map[o.uid]; io.xdrResponse.apply(io, [e, o, c]); }; Y.io.transport = function(c){ var io = Y.io._map['io:0'] || new Y.IO(); c.uid = io._uid; io.transport.apply(io, [c]); }; /** Delay value to calling the Flash transport, in the event io.swf has not finished loading. Once the E_XDR_READY event is fired, this value will be set to 0. @property delay @static @type {Number} **/ Y.io.xdr = { delay : 100 }; }, '@VERSION@', {"requires": ["io-base", "datatype-xml-parse"]});
fatso83/cdnjs
ajax/libs/yui/3.7.1/io-xdr/io-xdr.js
JavaScript
mit
7,789
.ui-timepicker-wrapper{overflow-y:auto;height:150px;width:6.5em;background:#fff;border:1px solid #ddd;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);outline:0;z-index:10001;margin:0}.ui-timepicker-wrapper.ui-timepicker-with-duration{width:11em}.ui-timepicker-list{margin:0;padding:0;list-style:none}.ui-timepicker-duration{margin-left:5px;color:#888}.ui-timepicker-list:hover .ui-timepicker-duration{color:#888}.ui-timepicker-list li{padding:3px 0 3px 5px;cursor:pointer;white-space:nowrap;color:#000;list-style:none;margin:0}.ui-timepicker-list:hover .ui-timepicker-selected{background:#fff;color:#000}.ui-timepicker-list .ui-timepicker-selected:hover,.ui-timepicker-list li:hover,li.ui-timepicker-selected{background:#1980EC;color:#fff}.ui-timepicker-list li:hover .ui-timepicker-duration,li.ui-timepicker-selected .ui-timepicker-duration{color:#ccc}.ui-timepicker-list li.ui-timepicker-disabled,.ui-timepicker-list li.ui-timepicker-disabled:hover,.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled{color:#888;cursor:default}.ui-timepicker-list li.ui-timepicker-disabled:hover,.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled{background:#f2f2f2}
CosmicWebServices/cdnjs
ajax/libs/jquery-timepicker/1.2.2/jquery.timepicker.min.css
CSS
mit
1,262
/*! * Bootstrap v3.1.1 (http://getbootstrap.com) * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ .btn-default,.btn-primary,.btn-success,.btn-info,.btn-warning,.btn-danger{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-default:active,.btn-primary:active,.btn-success:active,.btn-info:active,.btn-warning:active,.btn-danger:active,.btn-default.active,.btn-primary.active,.btn-success.active,.btn-info.active,.btn-warning.active,.btn-danger.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:active,.btn.active{background-image:none}.btn-default{background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);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;text-shadow:0 1px 0 #fff;border-color:#ccc}.btn-default:hover,.btn-default:focus{background-color:#e0e0e0;background-position:0 -15px}.btn-default:active,.btn-default.active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-primary{background-image:-webkit-linear-gradient(top,#428bca 0,#2d6ca2 100%);background-image:linear-gradient(to bottom,#428bca 0,#2d6ca2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff2d6ca2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#2b669a}.btn-primary:hover,.btn-primary:focus{background-color:#2d6ca2;background-position:0 -15px}.btn-primary:active,.btn-primary.active{background-color:#2d6ca2;border-color:#2b669a}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);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:hover,.btn-success:focus{background-color:#419641;background-position:0 -15px}.btn-success:active,.btn-success.active{background-color:#419641;border-color:#3e8f3e}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);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:hover,.btn-info:focus{background-color:#2aabd2;background-position:0 -15px}.btn-info:active,.btn-info.active{background-color:#2aabd2;border-color:#28a4c9}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);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:hover,.btn-warning:focus{background-color:#eb9316;background-position:0 -15px}.btn-warning:active,.btn-warning.active{background-color:#eb9316;border-color:#e38d13}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);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:hover,.btn-danger:focus{background-color:#c12e2a;background-position:0 -15px}.btn-danger:active,.btn-danger.active{background-color:#c12e2a;border-color:#b92c28}.thumbnail,.img-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:hover,.dropdown-menu>li>a:focus{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-color:#e8e8e8}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);background-color:#357ebd}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);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{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f3f3f3 100%);background-image:linear-gradient(to bottom,#ebebeb 0,#f3f3f3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff3f3f3', GradientType=0);-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:linear-gradient(to bottom,#3c3c3c 0,#222 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.navbar-inverse .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#222 0,#282828 100%);background-image:linear-gradient(to bottom,#222 0,#282828 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff282828', GradientType=0);-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-static-top,.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}.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:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0)}.progress-bar{background-image:-webkit-linear-gradient(top,#428bca 0,#3071a9 100%);background-image:linear-gradient(to bottom,#428bca 0,#3071a9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0)}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0)}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0)}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0)}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0)}.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:hover,.list-group-item.active:focus{text-shadow:0 -1px 0 #3071a9;background-image:-webkit-linear-gradient(top,#428bca 0,#3278b3 100%);background-image:linear-gradient(to bottom,#428bca 0,#3278b3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0);border-color:#3278b3}.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:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0)}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0)}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0)}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0)}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0)}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0)}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);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)}
GuillaumeHaben/IndexTree
public/css/bootstrap-theme.min.css
CSS
mit
13,185